1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.sysdyn.ui.handlers.newComponents;
\r
14 import java.util.ArrayList;
\r
16 import org.simantics.db.ReadGraph;
\r
17 import org.simantics.db.Resource;
\r
18 import org.simantics.db.WriteGraph;
\r
19 import org.simantics.db.common.utils.ListUtils;
\r
20 import org.simantics.db.exception.DatabaseException;
\r
21 import org.simantics.layer0.Layer0;
\r
22 import org.simantics.layer0.utils.direct.GraphUtils;
\r
23 import org.simantics.sysdyn.SysdynResource;
\r
26 * Creates a new sensitivity analysis experiment.
\r
28 * @author Tuomas Miettinen
\r
31 public class NewSensitivityAnalysisExperimentNodeHandler extends NewExperimentNodeHandler {
\r
34 protected void configureExperiment(WriteGraph graph, Resource experiment) throws DatabaseException {
\r
35 SysdynResource sr = SysdynResource.getInstance(graph);
\r
36 Layer0 L0 = Layer0.getInstance(graph);
\r
38 Resource distribution = GraphUtils.create2(graph, sr.UniformDistribution,
\r
39 sr.UniformDistribution_minValue, 0.0,
\r
40 sr.UniformDistribution_maxValue, 10.0);
\r
42 Resource parameter = GraphUtils.create2(graph, sr.SensitivityAnalysisExperiment_Parameter,
\r
43 sr.SensitivityAnalysisExperiment_Parameter_propabilityDistribution, distribution,
\r
44 sr.SensitivityAnalysisExperiment_Parameter_variable, "",
\r
45 sr.SensitivityAnalysisExperiment_Parameter_numberOfValues, 10,
\r
46 L0.PartOf, experiment);
\r
48 ArrayList<Resource> parameterList = new ArrayList<Resource>();
\r
49 parameterList.add(parameter);
\r
51 graph.claim(experiment, sr.SensitivityAnalysisExperiment_parameterList, ListUtils.create(graph, parameterList));
\r
55 protected Resource getExperimentType(ReadGraph g) {
\r
56 return SysdynResource.getInstance(g).SensitivityAnalysisExperiment;
\r
60 protected String getNameSuggestion() {
\r
61 return "Sensitivity Experiment";
\r