import org.simantics.browsing.ui.swt.widgets.impl.TrackedModifyEvent;\r
import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
import org.simantics.databoard.Bindings;\r
+import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
import org.simantics.db.WriteGraph;\r
import org.simantics.db.exception.DatabaseException;\r
\r
private boolean active;\r
private Control control;\r
+ private String rviUri;\r
+ private String indexUri;\r
\r
private char[] alphaNumericCharacters = {\r
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','å','ä','ö',\r
* @param support\r
*/\r
public RVIModifier(Control control, WidgetSupport support) {\r
+ this(control, support, JFreeChartResource.URIs.variableRVI, JFreeChartResource.URIs.variableFilter);\r
+ }\r
+ \r
+ \r
+ public RVIModifier(Control control, WidgetSupport support, String rviRelationUri, String indexUri) {\r
+ this.rviUri = rviRelationUri;\r
+ this.indexUri = indexUri;\r
+ \r
this.control = control;\r
this.active = true;\r
\r
public void applyText(WriteGraph graph, Resource resource, String text) throws DatabaseException {\r
if(active) {\r
text = "/" + text.replace('.', '/');\r
- JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
- graph.claimLiteral(resource, jfree.variableRVI, text, Bindings.STRING);\r
- graph.deny(resource, jfree.variableFilter);\r
+ graph.claimLiteral(resource, getRVIRelation(graph), text, Bindings.STRING);\r
+ graph.deny(resource, getIndexRelation(graph));\r
}\r
}\r
+ \r
+ private Resource getRVIRelation(ReadGraph graph) throws DatabaseException {\r
+ return graph.getResource(rviUri);\r
+ }\r
+ \r
+ private Resource getIndexRelation(ReadGraph graph) throws DatabaseException {\r
+ return graph.getResource(indexUri);\r
+ }\r
\r
public void deactivate() {\r
active = false;\r
\r
import java.util.Iterator;\r
import java.util.LinkedHashMap;\r
+import java.util.Map;\r
\r
import org.eclipse.jface.layout.GridDataFactory;\r
import org.eclipse.jface.layout.GridLayoutFactory;\r
import org.simantics.utils.RunnableWithObject;\r
import org.simantics.utils.datastructures.Triple;\r
import org.simantics.utils.ui.AdaptionUtils;\r
-import org.simantics.utils.ui.ExceptionUtils;\r
\r
/**\r
* Composite for range controls in chart series properties\r
public class RangeComposite extends Composite implements Widget {\r
\r
private Composite composite;\r
- \r
+\r
public RangeComposite(Composite parent, ISessionContext context, WidgetSupport support, int style) {\r
super(parent, style);\r
support.register(this);\r
\r
RangeHandlerFactory f;\r
try {\r
- f = context.getSession().syncRequest(new Read<RangeHandlerFactory>() {\r
- @Override\r
- public RangeHandlerFactory perform(ReadGraph graph)\r
- throws DatabaseException {\r
- return graph.adapt(series, RangeHandlerFactory.class);\r
- }\r
- });\r
- \r
+ f = context.getSession().syncRequest(new Read<RangeHandlerFactory>() {\r
+ @Override\r
+ public RangeHandlerFactory perform(ReadGraph graph)\r
+ throws DatabaseException {\r
+ return graph.adapt(series, RangeHandlerFactory.class);\r
+ }\r
+ });\r
+\r
} catch (DatabaseException e) {\r
- //ExceptionUtils.logAndShowError("Insert something intelligent here.", e);\r
- return;\r
+ //ExceptionUtils.logAndShowError("Insert something intelligent here.", e);\r
+ return;\r
}\r
- \r
+\r
final RangeHandlerFactory factory = f;\r
- \r
+\r
/*\r
* Listen to the enumerations assigned to the variable in this series.\r
* Listener is needed because the user can change the variableRVI for the series\r
// Remove all content (even with null result)\r
for(Control child : composite.getChildren())\r
child.dispose();\r
+ \r
+ composite.layout();\r
\r
if(getObject() == null)\r
return;\r
TrackedCombo combo;\r
LinkedHashMap<?, ?> result = (LinkedHashMap<?, ?>)getObject();\r
Iterator<?> iterator = result.keySet().iterator();\r
+\r
+ // Set the width of the combo \r
+ GridLayout gl = (GridLayout)composite.getLayout();\r
+ gl.numColumns = result.size();\r
\r
// For each array index (enumeration), create a label and a combo \r
int index = 0;\r
Composite c = new Composite(composite, SWT.NONE);\r
GridDataFactory.fillDefaults().applyTo(c);\r
GridLayoutFactory.fillDefaults().applyTo(c);\r
- \r
+\r
label = new Label(c, SWT.NONE);\r
label.setText((String)key);\r
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.END).applyTo(label);\r
GridDataFactory.fillDefaults().applyTo(combo.getWidget());\r
index++;\r
}\r
- \r
- // Set the width of the combo \r
- GridLayout gl = (GridLayout)composite.getLayout();\r
- gl.numColumns = index;\r
- \r
+\r
// Set input for the combos\r
support.fireInput(context, input);\r
- \r
+\r
/*\r
* Find out if this composite is located in a scrolled composite. \r
* If it is, resize the scrolled composite\r
*/\r
+ composite.layout();\r
Composite previousParent = composite.getParent();\r
- for(int i = 0; i < 5; i++) {\r
+ for(int i = 0; i < 7 && previousParent != null; i++) {\r
+ previousParent.layout();\r
if(previousParent.getParent() instanceof ScrolledComposite) {\r
- previousParent.layout();\r
ScrolledComposite sc = (ScrolledComposite) previousParent.getParent();\r
Point size = previousParent.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
sc.setMinSize(size);\r
\r
@Override\r
public String perform(ReadGraph graph, Resource series) throws DatabaseException {\r
- JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
- String[] filter = graph.getPossibleRelatedValue(series, jfree.variableFilter, Bindings.STRING_ARRAY);\r
- \r
+ String[] filter = graph.getPossibleRelatedValue(series, getIndexRelation(graph), Bindings.STRING_ARRAY);\r
+\r
+\r
/*\r
- * If no filter was found or the index is not applicable, return "All"\r
+ * If no filter was found or the index is not applicable, return the first index\r
*/\r
+ String result = null;\r
if(filter == null)\r
- return "All";\r
+ result = getFirstIndex(graph, series, index);\r
else if(filter.length < index)\r
- return "All";\r
+ result = getFirstIndex(graph, series, index); \r
else\r
- return filter[index];\r
+ result = filter[index];\r
+\r
+ return result;\r
}\r
\r
}\r
*\r
*/\r
private class RangeModifyListener extends ComboModifyListenerImpl<Resource> {\r
- \r
+\r
private int index, size;\r
\r
/**\r
\r
@Override\r
public void applyText(WriteGraph graph, Resource series, String text) throws DatabaseException {\r
- JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
- String[] filter = graph.getPossibleRelatedValue(series, jfree.variableFilter, Bindings.STRING_ARRAY);\r
- \r
+ Resource filterRelation = getIndexRelation(graph);\r
+ String[] filter = graph.getPossibleRelatedValue(series, filterRelation, Bindings.STRING_ARRAY);\r
+\r
// If there is no filter, create a default filter with all indexes "All"\r
if(filter == null) {\r
filter = new String[size];\r
for(int i = 0; i < filter.length; i++) {\r
- filter[i] = "All";\r
+ filter[i] = getFirstIndex(graph, series, i);\r
}\r
}\r
- \r
+\r
// Modify the filter index\r
filter[index] = text;\r
- graph.claimLiteral(series, jfree.variableFilter, filter, Bindings.STRING_ARRAY);\r
+ graph.claimLiteral(series, filterRelation, filter, Bindings.STRING_ARRAY);\r
}\r
}\r
+\r
+ protected Resource getIndexRelation(ReadGraph graph) {\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+ return jfree.variableFilter;\r
+ }\r
+ \r
+ private static String getFirstIndex(ReadGraph graph, Resource series, int index) throws DatabaseException {\r
+ RangeHandlerFactory f = graph.adapt(series, RangeHandlerFactory.class);\r
+ LinkedHashMap<String, Resource> map = graph.syncRequest(f.getRequest(series));\r
+ if(map == null)\r
+ return null;\r
+ else {\r
+ Resource enumeration = null;\r
+ Iterator<Resource> iterator = map.values().iterator();\r
+ for(int i = 0; i <= index && iterator.hasNext(); i++) {\r
+ enumeration = iterator.next();\r
+ }\r
+ if(enumeration != null) {\r
+ Map<String, Object> indexmap = f.getRangeItemFactory(index, enumeration).perform(graph, null);\r
+ if(indexmap != null)\r
+ return indexmap.values().iterator().next().toString();\r
+ }\r
+ }\r
+\r
+ return null;\r
+ }\r
}\r
import org.simantics.db.management.ISessionContext;\r
import org.simantics.db.procedure.Listener;\r
import org.simantics.ui.SimanticsUI;\r
-import org.simantics.ui.utils.AdaptionUtils;\r
+import org.simantics.utils.ui.AdaptionUtils;\r
\r
/**\r
* \r
@SuppressWarnings("unchecked")\r
public IContentProposal[] getProposals(String contents, int position) {\r
if (filterProposals) {\r
- ArrayList list = new ArrayList();\r
+ @SuppressWarnings("rawtypes")\r
+ ArrayList list = new ArrayList();\r
if (compareRVI) {\r
for (ChartVariable proposal : proposals) {\r
if (proposal.getRvi().length() >= contents.length() && proposal.getRvi().substring(0, contents.length()).equalsIgnoreCase(contents)) {\r
VP.BrowseContext.HasVisualsContribution _ : VP.VisualsContribution\r
VP.VisualsContribution.HasNodeType L0.Entity\r
VP.VisualsContribution.HasRule POBC.ParameterSorterRule\r
-
\ No newline at end of file
+\r
+/////////////////////////////////////////////\r
+/// Sensitivity experiment parameters\r
+/////////////////////////////////////////////\r
+SPBC = SYSDYN.SensitivityAnalysisExperiment.ParameterBrowseContext : VP.BrowseContext\r
+SPAC = SYSDYN.SensitivityAnalysisExperiment.ParameterActionContext : VP.BrowseContext\r
+\r
+SPBC.ParameterChildRule : VP.ChildRule\r
+SPBC.ParameterLabelRule : VP.LabelRule\r
+//SPBC.ParameterLabelDecorationRule : VP.LabelDecorationRule\r
+ \r
+SPBC\r
+ @VP.customChildRule SYSDYN.SensitivityAnalysisExperiment SPBC.ParameterChildRule\r
+ SYSDYN.SensitivityAnalysisExperiment.Parameter\r
+\r
+SPBC \r
+ @VP.customLabelRule SYSDYN.SensitivityAnalysisExperiment.Parameter SPBC.ParameterLabelRule\r
+ \r
+//SPBC\r
+// @VP.customLabelDecorationRule SYSDYN.SensitivityAnalysisExperiment.Parameter SPBC.ParameterLabelDecorationRule \r
+ \r
+SPBC\r
+ VP.BrowseContext.HasVisualsContribution _ : VP.VisualsContribution\r
+ VP.VisualsContribution.HasNodeType SYSDYN.SensitivityAnalysisExperiment\r
+ VP.VisualsContribution.HasRule VP.PassThruSorterRule\r
+ \r
+SPAC.Actions : L0.Library\r
SYSDYN.PlaybackExperiment <T SYSDYN.Experiment
SYSDYN.SensitivityAnalysisExperiment <T SYSDYN.Experiment
- >-- SYSDYN.SensitivityAnalysisExperiment.propabilityDistribution --> L0.String <R L0.HasProperty : L0.FunctionalRelation
-//>-- SYSDYN.SensitivityAnalysisExperiment.variedParameter --> SYSDYN.Auxiliary <R L0.HasProperty : L0.FunctionalRelation
- >-- SYSDYN.SensitivityAnalysisExperiment.variedParameter --> L0.String <R L0.HasProperty : L0.FunctionalRelation
- >-- SYSDYN.SensitivityAnalysisExperiment.minValue --> L0.Double <R L0.HasProperty : L0.FunctionalRelation
- >-- SYSDYN.SensitivityAnalysisExperiment.maxValue --> L0.Double <R L0.HasProperty : L0.FunctionalRelation
- >-- SYSDYN.SensitivityAnalysisExperiment.numValues --> L0.Integer <R L0.HasProperty : L0.FunctionalRelation
- >-- SYSDYN.SensitivityAnalysisExperiment.mean --> L0.Double <R L0.HasProperty : L0.FunctionalRelation
- >-- SYSDYN.SensitivityAnalysisExperiment.stdDeviation --> L0.Double <R L0.HasProperty : L0.FunctionalRelation
+ >-- SYSDYN.SensitivityAnalysisExperiment.parameterList --> L0.List <R L0.IsComposedOf : L0.FunctionalRelation
+ >-- SYSDYN.SensitivityAnalysisExperiment.randomSeed --> L0.Integer <R L0.HasProperty : L0.FunctionalRelation
+ >-- SYSDYN.SensitivityAnalysisExperiment.resultRefreshRate --> L0.Integer <R L0.HasProperty : L0.FunctionalRelation
+ @L0.assert SYSDYN.SensitivityAnalysisExperiment.randomSeed 123
+
+SYSDYN.SensitivityAnalysisExperiment.Parameter <T L0.Entity
+ >-- SYSDYN.SensitivityAnalysisExperiment.Parameter.propabilityDistribution --> SYSDYN.ProbabilityDistribution <R L0.HasProperty : L0.FunctionalRelation
+ >-- SYSDYN.SensitivityAnalysisExperiment.Parameter.variable --> L0.String <R L0.HasProperty : L0.FunctionalRelation
+ >-- SYSDYN.SensitivityAnalysisExperiment.Parameter.indexes --> L0.StringArray <R L0.HasProperty : L0.FunctionalRelation
+ >-- SYSDYN.SensitivityAnalysisExperiment.Parameter.numberOfValues --> L0.Integer <R L0.HasProperty : L0.FunctionalRelation
+
+
+SYSDYN.ProbabilityDistribution <T L0.Entity
+SYSDYN.UniformDistribution <T SYSDYN.ProbabilityDistribution
+ >-- SYSDYN.UniformDistribution.minValue --> L0.Double <R L0.HasProperty : L0.FunctionalRelation
+ >-- SYSDYN.UniformDistribution.maxValue --> L0.Double <R L0.HasProperty : L0.FunctionalRelation
+ @L0.assert SYSDYN.UniformDistribution.minValue 0.0
+ @L0.assert SYSDYN.UniformDistribution.maxValue 10.0
+
+SYSDYN.NormalDistribution <T SYSDYN.ProbabilityDistribution
+ >-- SYSDYN.NormalDistribution.minValue --> L0.Double <R L0.HasProperty : L0.FunctionalRelation
+ >-- SYSDYN.NormalDistribution.maxValue --> L0.Double <R L0.HasProperty : L0.FunctionalRelation
+ >-- SYSDYN.NormalDistribution.mean --> L0.Double <R L0.HasProperty : L0.FunctionalRelation
+ >-- SYSDYN.NormalDistribution.stdDeviation --> L0.Double <R L0.HasProperty : L0.FunctionalRelation
+ @L0.assert SYSDYN.NormalDistribution.mean 5.0
+ @L0.assert SYSDYN.NormalDistribution.stdDeviation 1.0
+
+SYSDYN.Interval <T SYSDYN.ProbabilityDistribution
+ >-- SYSDYN.Interval.minValue --> L0.Double <R L0.HasProperty : L0.FunctionalRelation
+ >-- SYSDYN.Interval.maxValue --> L0.Double <R L0.HasProperty : L0.FunctionalRelation
+ @L0.assert SYSDYN.Interval.minValue 0.0
+ @L0.assert SYSDYN.Interval.maxValue 10.0
//#####################################################################
// Results and history datasets
public final Resource InputSymbol;\r
public final Resource Input_defaultInputValue;\r
public final Resource Input_defaultInputValue_Inverse;\r
+ public final Resource Interval;\r
+ public final Resource Interval_maxValue;\r
+ public final Resource Interval_maxValue_Inverse;\r
+ public final Resource Interval_minValue;\r
+ public final Resource Interval_minValue_Inverse;\r
public final Resource IsHeadOfTerminal;\r
public final Resource IsOutput;\r
public final Resource IsTailOfTerminal;\r
public final Resource Module_parameterOverride_Inverse;\r
public final Resource Module_redeclaration;\r
public final Resource Module_redeclaration_Inverse;\r
+ public final Resource NormalDistribution;\r
+ public final Resource NormalDistribution_maxValue;\r
+ public final Resource NormalDistribution_maxValue_Inverse;\r
+ public final Resource NormalDistribution_mean;\r
+ public final Resource NormalDistribution_mean_Inverse;\r
+ public final Resource NormalDistribution_minValue;\r
+ public final Resource NormalDistribution_minValue_Inverse;\r
+ public final Resource NormalDistribution_stdDeviation;\r
+ public final Resource NormalDistribution_stdDeviation_Inverse;\r
public final Resource NormalExpression;\r
public final Resource Orientation;\r
public final Resource ParameterExpression;\r
public final Resource PlaybackExperiment;\r
+ public final Resource ProbabilityDistribution;\r
public final Resource Profiles;\r
public final Resource Profiles_IssueWarnings;\r
public final Resource Profiles_ShadowVisualizations;\r
public final Resource Right;\r
public final Resource SelectedSharedFunctionLibraries;\r
public final Resource SensitivityAnalysisExperiment;\r
- public final Resource SensitivityAnalysisExperiment_maxValue;\r
- public final Resource SensitivityAnalysisExperiment_maxValue_Inverse;\r
- public final Resource SensitivityAnalysisExperiment_mean;\r
- public final Resource SensitivityAnalysisExperiment_mean_Inverse;\r
- public final Resource SensitivityAnalysisExperiment_minValue;\r
- public final Resource SensitivityAnalysisExperiment_minValue_Inverse;\r
- public final Resource SensitivityAnalysisExperiment_numValues;\r
- public final Resource SensitivityAnalysisExperiment_numValues_Inverse;\r
- public final Resource SensitivityAnalysisExperiment_propabilityDistribution;\r
- public final Resource SensitivityAnalysisExperiment_propabilityDistribution_Inverse;\r
- public final Resource SensitivityAnalysisExperiment_stdDeviation;\r
- public final Resource SensitivityAnalysisExperiment_stdDeviation_Inverse;\r
- public final Resource SensitivityAnalysisExperiment_variedParameter;\r
- public final Resource SensitivityAnalysisExperiment_variedParameter_Inverse;\r
+ public final Resource SensitivityAnalysisExperiment_Parameter;\r
+ public final Resource SensitivityAnalysisExperiment_ParameterActionContext;\r
+ public final Resource SensitivityAnalysisExperiment_ParameterActionContext_Actions;\r
+ public final Resource SensitivityAnalysisExperiment_ParameterBrowseContext;\r
+ public final Resource SensitivityAnalysisExperiment_ParameterBrowseContext_ParameterChildRule;\r
+ public final Resource SensitivityAnalysisExperiment_ParameterBrowseContext_ParameterLabelRule;\r
+ public final Resource SensitivityAnalysisExperiment_Parameter_indexes;\r
+ public final Resource SensitivityAnalysisExperiment_Parameter_indexes_Inverse;\r
+ public final Resource SensitivityAnalysisExperiment_Parameter_numberOfValues;\r
+ public final Resource SensitivityAnalysisExperiment_Parameter_numberOfValues_Inverse;\r
+ public final Resource SensitivityAnalysisExperiment_Parameter_propabilityDistribution;\r
+ public final Resource SensitivityAnalysisExperiment_Parameter_propabilityDistribution_Inverse;\r
+ public final Resource SensitivityAnalysisExperiment_Parameter_variable;\r
+ public final Resource SensitivityAnalysisExperiment_Parameter_variable_Inverse;\r
+ public final Resource SensitivityAnalysisExperiment_parameterList;\r
+ public final Resource SensitivityAnalysisExperiment_parameterList_Inverse;\r
+ public final Resource SensitivityAnalysisExperiment_randomSeed;\r
+ public final Resource SensitivityAnalysisExperiment_randomSeed_Inverse;\r
+ public final Resource SensitivityAnalysisExperiment_resultRefreshRate;\r
+ public final Resource SensitivityAnalysisExperiment_resultRefreshRate_Inverse;\r
public final Resource Shadow;\r
public final Resource ShadowStyle;\r
public final Resource ShadowSymbol;\r
public final Resource SysdynOperationBrowser;\r
public final Resource SysdynTerminal;\r
public final Resource Top;\r
+ public final Resource UniformDistribution;\r
+ public final Resource UniformDistribution_maxValue;\r
+ public final Resource UniformDistribution_maxValue_Inverse;\r
+ public final Resource UniformDistribution_minValue;\r
+ public final Resource UniformDistribution_minValue_Inverse;\r
public final Resource UsedVariableIndexes;\r
public final Resource Validations;\r
public final Resource Validations_Dependencies;\r
public static final String InputSymbol = "http://www.simantics.org/Sysdyn-1.1/InputSymbol";\r
public static final String Input_defaultInputValue = "http://www.simantics.org/Sysdyn-1.1/Input/defaultInputValue";\r
public static final String Input_defaultInputValue_Inverse = "http://www.simantics.org/Sysdyn-1.1/Input/defaultInputValue/Inverse";\r
+ public static final String Interval = "http://www.simantics.org/Sysdyn-1.1/Interval";\r
+ public static final String Interval_maxValue = "http://www.simantics.org/Sysdyn-1.1/Interval/maxValue";\r
+ public static final String Interval_maxValue_Inverse = "http://www.simantics.org/Sysdyn-1.1/Interval/maxValue/Inverse";\r
+ public static final String Interval_minValue = "http://www.simantics.org/Sysdyn-1.1/Interval/minValue";\r
+ public static final String Interval_minValue_Inverse = "http://www.simantics.org/Sysdyn-1.1/Interval/minValue/Inverse";\r
public static final String IsHeadOfTerminal = "http://www.simantics.org/Sysdyn-1.1/IsHeadOfTerminal";\r
public static final String IsOutput = "http://www.simantics.org/Sysdyn-1.1/IsOutput";\r
public static final String IsTailOfTerminal = "http://www.simantics.org/Sysdyn-1.1/IsTailOfTerminal";\r
public static final String Module_parameterOverride_Inverse = "http://www.simantics.org/Sysdyn-1.1/Module/parameterOverride/Inverse";\r
public static final String Module_redeclaration = "http://www.simantics.org/Sysdyn-1.1/Module/redeclaration";\r
public static final String Module_redeclaration_Inverse = "http://www.simantics.org/Sysdyn-1.1/Module/redeclaration/Inverse";\r
+ public static final String NormalDistribution = "http://www.simantics.org/Sysdyn-1.1/NormalDistribution";\r
+ public static final String NormalDistribution_maxValue = "http://www.simantics.org/Sysdyn-1.1/NormalDistribution/maxValue";\r
+ public static final String NormalDistribution_maxValue_Inverse = "http://www.simantics.org/Sysdyn-1.1/NormalDistribution/maxValue/Inverse";\r
+ public static final String NormalDistribution_mean = "http://www.simantics.org/Sysdyn-1.1/NormalDistribution/mean";\r
+ public static final String NormalDistribution_mean_Inverse = "http://www.simantics.org/Sysdyn-1.1/NormalDistribution/mean/Inverse";\r
+ public static final String NormalDistribution_minValue = "http://www.simantics.org/Sysdyn-1.1/NormalDistribution/minValue";\r
+ public static final String NormalDistribution_minValue_Inverse = "http://www.simantics.org/Sysdyn-1.1/NormalDistribution/minValue/Inverse";\r
+ public static final String NormalDistribution_stdDeviation = "http://www.simantics.org/Sysdyn-1.1/NormalDistribution/stdDeviation";\r
+ public static final String NormalDistribution_stdDeviation_Inverse = "http://www.simantics.org/Sysdyn-1.1/NormalDistribution/stdDeviation/Inverse";\r
public static final String NormalExpression = "http://www.simantics.org/Sysdyn-1.1/NormalExpression";\r
public static final String Orientation = "http://www.simantics.org/Sysdyn-1.1/Orientation";\r
public static final String ParameterExpression = "http://www.simantics.org/Sysdyn-1.1/ParameterExpression";\r
public static final String PlaybackExperiment = "http://www.simantics.org/Sysdyn-1.1/PlaybackExperiment";\r
+ public static final String ProbabilityDistribution = "http://www.simantics.org/Sysdyn-1.1/ProbabilityDistribution";\r
public static final String Profiles = "http://www.simantics.org/Sysdyn-1.1/Profiles";\r
public static final String Profiles_IssueWarnings = "http://www.simantics.org/Sysdyn-1.1/Profiles/IssueWarnings";\r
public static final String Profiles_ShadowVisualizations = "http://www.simantics.org/Sysdyn-1.1/Profiles/ShadowVisualizations";\r
public static final String Right = "http://www.simantics.org/Sysdyn-1.1/Right";\r
public static final String SelectedSharedFunctionLibraries = "http://www.simantics.org/Sysdyn-1.1/SelectedSharedFunctionLibraries";\r
public static final String SensitivityAnalysisExperiment = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment";\r
- public static final String SensitivityAnalysisExperiment_maxValue = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/maxValue";\r
- public static final String SensitivityAnalysisExperiment_maxValue_Inverse = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/maxValue/Inverse";\r
- public static final String SensitivityAnalysisExperiment_mean = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/mean";\r
- public static final String SensitivityAnalysisExperiment_mean_Inverse = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/mean/Inverse";\r
- public static final String SensitivityAnalysisExperiment_minValue = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/minValue";\r
- public static final String SensitivityAnalysisExperiment_minValue_Inverse = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/minValue/Inverse";\r
- public static final String SensitivityAnalysisExperiment_numValues = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/numValues";\r
- public static final String SensitivityAnalysisExperiment_numValues_Inverse = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/numValues/Inverse";\r
- public static final String SensitivityAnalysisExperiment_propabilityDistribution = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/propabilityDistribution";\r
- public static final String SensitivityAnalysisExperiment_propabilityDistribution_Inverse = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/propabilityDistribution/Inverse";\r
- public static final String SensitivityAnalysisExperiment_stdDeviation = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/stdDeviation";\r
- public static final String SensitivityAnalysisExperiment_stdDeviation_Inverse = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/stdDeviation/Inverse";\r
- public static final String SensitivityAnalysisExperiment_variedParameter = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/variedParameter";\r
- public static final String SensitivityAnalysisExperiment_variedParameter_Inverse = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/variedParameter/Inverse";\r
+ public static final String SensitivityAnalysisExperiment_Parameter = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/Parameter";\r
+ public static final String SensitivityAnalysisExperiment_ParameterActionContext = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/ParameterActionContext";\r
+ public static final String SensitivityAnalysisExperiment_ParameterActionContext_Actions = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/ParameterActionContext/Actions";\r
+ public static final String SensitivityAnalysisExperiment_ParameterBrowseContext = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/ParameterBrowseContext";\r
+ public static final String SensitivityAnalysisExperiment_ParameterBrowseContext_ParameterChildRule = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/ParameterBrowseContext/ParameterChildRule";\r
+ public static final String SensitivityAnalysisExperiment_ParameterBrowseContext_ParameterLabelRule = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/ParameterBrowseContext/ParameterLabelRule";\r
+ public static final String SensitivityAnalysisExperiment_Parameter_indexes = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/Parameter/indexes";\r
+ public static final String SensitivityAnalysisExperiment_Parameter_indexes_Inverse = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/Parameter/indexes/Inverse";\r
+ public static final String SensitivityAnalysisExperiment_Parameter_numberOfValues = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/Parameter/numberOfValues";\r
+ public static final String SensitivityAnalysisExperiment_Parameter_numberOfValues_Inverse = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/Parameter/numberOfValues/Inverse";\r
+ public static final String SensitivityAnalysisExperiment_Parameter_propabilityDistribution = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/Parameter/propabilityDistribution";\r
+ public static final String SensitivityAnalysisExperiment_Parameter_propabilityDistribution_Inverse = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/Parameter/propabilityDistribution/Inverse";\r
+ public static final String SensitivityAnalysisExperiment_Parameter_variable = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/Parameter/variable";\r
+ public static final String SensitivityAnalysisExperiment_Parameter_variable_Inverse = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/Parameter/variable/Inverse";\r
+ public static final String SensitivityAnalysisExperiment_parameterList = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/parameterList";\r
+ public static final String SensitivityAnalysisExperiment_parameterList_Inverse = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/parameterList/Inverse";\r
+ public static final String SensitivityAnalysisExperiment_randomSeed = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/randomSeed";\r
+ public static final String SensitivityAnalysisExperiment_randomSeed_Inverse = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/randomSeed/Inverse";\r
+ public static final String SensitivityAnalysisExperiment_resultRefreshRate = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/resultRefreshRate";\r
+ public static final String SensitivityAnalysisExperiment_resultRefreshRate_Inverse = "http://www.simantics.org/Sysdyn-1.1/SensitivityAnalysisExperiment/resultRefreshRate/Inverse";\r
public static final String Shadow = "http://www.simantics.org/Sysdyn-1.1/Shadow";\r
public static final String ShadowStyle = "http://www.simantics.org/Sysdyn-1.1/ShadowStyle";\r
public static final String ShadowSymbol = "http://www.simantics.org/Sysdyn-1.1/ShadowSymbol";\r
public static final String SysdynOperationBrowser = "http://www.simantics.org/Sysdyn-1.1/SysdynOperationBrowser";\r
public static final String SysdynTerminal = "http://www.simantics.org/Sysdyn-1.1/SysdynTerminal";\r
public static final String Top = "http://www.simantics.org/Sysdyn-1.1/Top";\r
+ public static final String UniformDistribution = "http://www.simantics.org/Sysdyn-1.1/UniformDistribution";\r
+ public static final String UniformDistribution_maxValue = "http://www.simantics.org/Sysdyn-1.1/UniformDistribution/maxValue";\r
+ public static final String UniformDistribution_maxValue_Inverse = "http://www.simantics.org/Sysdyn-1.1/UniformDistribution/maxValue/Inverse";\r
+ public static final String UniformDistribution_minValue = "http://www.simantics.org/Sysdyn-1.1/UniformDistribution/minValue";\r
+ public static final String UniformDistribution_minValue_Inverse = "http://www.simantics.org/Sysdyn-1.1/UniformDistribution/minValue/Inverse";\r
public static final String UsedVariableIndexes = "http://www.simantics.org/Sysdyn-1.1/UsedVariableIndexes";\r
public static final String Validations = "http://www.simantics.org/Sysdyn-1.1/Validations";\r
public static final String Validations_Dependencies = "http://www.simantics.org/Sysdyn-1.1/Validations/Dependencies";\r
InputSymbol = getResourceOrNull(graph, URIs.InputSymbol);\r
Input_defaultInputValue = getResourceOrNull(graph, URIs.Input_defaultInputValue);\r
Input_defaultInputValue_Inverse = getResourceOrNull(graph, URIs.Input_defaultInputValue_Inverse);\r
+ Interval = getResourceOrNull(graph, URIs.Interval);\r
+ Interval_maxValue = getResourceOrNull(graph, URIs.Interval_maxValue);\r
+ Interval_maxValue_Inverse = getResourceOrNull(graph, URIs.Interval_maxValue_Inverse);\r
+ Interval_minValue = getResourceOrNull(graph, URIs.Interval_minValue);\r
+ Interval_minValue_Inverse = getResourceOrNull(graph, URIs.Interval_minValue_Inverse);\r
IsHeadOfTerminal = getResourceOrNull(graph, URIs.IsHeadOfTerminal);\r
IsOutput = getResourceOrNull(graph, URIs.IsOutput);\r
IsTailOfTerminal = getResourceOrNull(graph, URIs.IsTailOfTerminal);\r
Module_parameterOverride_Inverse = getResourceOrNull(graph, URIs.Module_parameterOverride_Inverse);\r
Module_redeclaration = getResourceOrNull(graph, URIs.Module_redeclaration);\r
Module_redeclaration_Inverse = getResourceOrNull(graph, URIs.Module_redeclaration_Inverse);\r
+ NormalDistribution = getResourceOrNull(graph, URIs.NormalDistribution);\r
+ NormalDistribution_maxValue = getResourceOrNull(graph, URIs.NormalDistribution_maxValue);\r
+ NormalDistribution_maxValue_Inverse = getResourceOrNull(graph, URIs.NormalDistribution_maxValue_Inverse);\r
+ NormalDistribution_mean = getResourceOrNull(graph, URIs.NormalDistribution_mean);\r
+ NormalDistribution_mean_Inverse = getResourceOrNull(graph, URIs.NormalDistribution_mean_Inverse);\r
+ NormalDistribution_minValue = getResourceOrNull(graph, URIs.NormalDistribution_minValue);\r
+ NormalDistribution_minValue_Inverse = getResourceOrNull(graph, URIs.NormalDistribution_minValue_Inverse);\r
+ NormalDistribution_stdDeviation = getResourceOrNull(graph, URIs.NormalDistribution_stdDeviation);\r
+ NormalDistribution_stdDeviation_Inverse = getResourceOrNull(graph, URIs.NormalDistribution_stdDeviation_Inverse);\r
NormalExpression = getResourceOrNull(graph, URIs.NormalExpression);\r
Orientation = getResourceOrNull(graph, URIs.Orientation);\r
ParameterExpression = getResourceOrNull(graph, URIs.ParameterExpression);\r
PlaybackExperiment = getResourceOrNull(graph, URIs.PlaybackExperiment);\r
+ ProbabilityDistribution = getResourceOrNull(graph, URIs.ProbabilityDistribution);\r
Profiles = getResourceOrNull(graph, URIs.Profiles);\r
Profiles_IssueWarnings = getResourceOrNull(graph, URIs.Profiles_IssueWarnings);\r
Profiles_ShadowVisualizations = getResourceOrNull(graph, URIs.Profiles_ShadowVisualizations);\r
Right = getResourceOrNull(graph, URIs.Right);\r
SelectedSharedFunctionLibraries = getResourceOrNull(graph, URIs.SelectedSharedFunctionLibraries);\r
SensitivityAnalysisExperiment = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment);\r
- SensitivityAnalysisExperiment_maxValue = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_maxValue);\r
- SensitivityAnalysisExperiment_maxValue_Inverse = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_maxValue_Inverse);\r
- SensitivityAnalysisExperiment_mean = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_mean);\r
- SensitivityAnalysisExperiment_mean_Inverse = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_mean_Inverse);\r
- SensitivityAnalysisExperiment_minValue = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_minValue);\r
- SensitivityAnalysisExperiment_minValue_Inverse = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_minValue_Inverse);\r
- SensitivityAnalysisExperiment_numValues = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_numValues);\r
- SensitivityAnalysisExperiment_numValues_Inverse = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_numValues_Inverse);\r
- SensitivityAnalysisExperiment_propabilityDistribution = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_propabilityDistribution);\r
- SensitivityAnalysisExperiment_propabilityDistribution_Inverse = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_propabilityDistribution_Inverse);\r
- SensitivityAnalysisExperiment_stdDeviation = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_stdDeviation);\r
- SensitivityAnalysisExperiment_stdDeviation_Inverse = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_stdDeviation_Inverse);\r
- SensitivityAnalysisExperiment_variedParameter = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_variedParameter);\r
- SensitivityAnalysisExperiment_variedParameter_Inverse = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_variedParameter_Inverse);\r
+ SensitivityAnalysisExperiment_Parameter = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_Parameter);\r
+ SensitivityAnalysisExperiment_ParameterActionContext = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_ParameterActionContext);\r
+ SensitivityAnalysisExperiment_ParameterActionContext_Actions = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_ParameterActionContext_Actions);\r
+ SensitivityAnalysisExperiment_ParameterBrowseContext = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_ParameterBrowseContext);\r
+ SensitivityAnalysisExperiment_ParameterBrowseContext_ParameterChildRule = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_ParameterBrowseContext_ParameterChildRule);\r
+ SensitivityAnalysisExperiment_ParameterBrowseContext_ParameterLabelRule = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_ParameterBrowseContext_ParameterLabelRule);\r
+ SensitivityAnalysisExperiment_Parameter_indexes = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_Parameter_indexes);\r
+ SensitivityAnalysisExperiment_Parameter_indexes_Inverse = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_Parameter_indexes_Inverse);\r
+ SensitivityAnalysisExperiment_Parameter_numberOfValues = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_Parameter_numberOfValues);\r
+ SensitivityAnalysisExperiment_Parameter_numberOfValues_Inverse = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_Parameter_numberOfValues_Inverse);\r
+ SensitivityAnalysisExperiment_Parameter_propabilityDistribution = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_Parameter_propabilityDistribution);\r
+ SensitivityAnalysisExperiment_Parameter_propabilityDistribution_Inverse = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_Parameter_propabilityDistribution_Inverse);\r
+ SensitivityAnalysisExperiment_Parameter_variable = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_Parameter_variable);\r
+ SensitivityAnalysisExperiment_Parameter_variable_Inverse = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_Parameter_variable_Inverse);\r
+ SensitivityAnalysisExperiment_parameterList = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_parameterList);\r
+ SensitivityAnalysisExperiment_parameterList_Inverse = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_parameterList_Inverse);\r
+ SensitivityAnalysisExperiment_randomSeed = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_randomSeed);\r
+ SensitivityAnalysisExperiment_randomSeed_Inverse = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_randomSeed_Inverse);\r
+ SensitivityAnalysisExperiment_resultRefreshRate = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_resultRefreshRate);\r
+ SensitivityAnalysisExperiment_resultRefreshRate_Inverse = getResourceOrNull(graph, URIs.SensitivityAnalysisExperiment_resultRefreshRate_Inverse);\r
Shadow = getResourceOrNull(graph, URIs.Shadow);\r
ShadowStyle = getResourceOrNull(graph, URIs.ShadowStyle);\r
ShadowSymbol = getResourceOrNull(graph, URIs.ShadowSymbol);\r
SysdynOperationBrowser = getResourceOrNull(graph, URIs.SysdynOperationBrowser);\r
SysdynTerminal = getResourceOrNull(graph, URIs.SysdynTerminal);\r
Top = getResourceOrNull(graph, URIs.Top);\r
+ UniformDistribution = getResourceOrNull(graph, URIs.UniformDistribution);\r
+ UniformDistribution_maxValue = getResourceOrNull(graph, URIs.UniformDistribution_maxValue);\r
+ UniformDistribution_maxValue_Inverse = getResourceOrNull(graph, URIs.UniformDistribution_maxValue_Inverse);\r
+ UniformDistribution_minValue = getResourceOrNull(graph, URIs.UniformDistribution_minValue);\r
+ UniformDistribution_minValue_Inverse = getResourceOrNull(graph, URIs.UniformDistribution_minValue_Inverse);\r
UsedVariableIndexes = getResourceOrNull(graph, URIs.UsedVariableIndexes);\r
Validations = getResourceOrNull(graph, URIs.Validations);\r
Validations_Dependencies = getResourceOrNull(graph, URIs.Validations_Dependencies);\r
VTT Technical Research Centre of Finland - initial API and implementation\r
-->\r
-<adapters>\r\r <target interface="org.simantics.db.layer0.adapter.Realization">\r <type uri="http://www.simantics.org/Sysdyn-0.0/Module"\r class="org.simantics.structural2.realization.StructuralRealization">\r <this />\r </type>\r </target>\r\r <target interface="org.simantics.layer0.utils.triggers.ITrigger">\r <type uri = "http://www.simantics.org/Sysdyn-0.0/DiagramToCompositeMapping"\r class = "org.simantics.sysdyn.ui.editor.DiagramToCompositeMapping3">\r <graph/>\r <this />\r </type>\r </target>\r \r <target interface="org.simantics.structural.ui.modelBrowser.nodes.AbstractNode">\r <type uri="http://www.simantics.org/Sysdyn-0.0/SysdynModel"\r class="org.simantics.structural.ui.modelBrowser.nodes.ModelNode">\r <this />\r </type>\r </target> \r \r\r <target\r interface="org.simantics.browsing.ui.common.node.AbstractNode">\r <type\r uri="http://www.simantics.org/Sysdyn-0.0/SysdynModel"\r class="org.simantics.sysdyn.ui.browser.nodes.ModelNode">\r <this />\r </type>\r\r <resource\r uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.browser.nodes.SymbolNode">\r <this />\r </resource>\r\r <type\r uri="http://www.simantics.org/Simulation-0.0/Experiment"\r class="org.simantics.sysdyn.ui.browser.nodes.ExperimentNode">\r <this />\r </type>\r \r <type\r uri="http://www.simantics.org/Sysdyn-0.0/Result"\r class="org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode">\r <this />\r </type>\r \r </target>\r\r <!-- Inject default connection routing algorithm for sysdyn diagrams -->\r <target interface="org.simantics.g2d.diagram.DiagramClass">\r <adapter uri="http://www.simantics.org/Sysdyn-0.0/ConfigurationDiagram"\r adapterClass="org.simantics.sysdyn.ui.elements.ConfigurationDiagramClassAdapter" />\r </target>\r\r <!-- Sysdyn symbols -->\r <target interface="org.simantics.diagram.adapter.ElementFactory">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/StockSymbol"\r class="org.simantics.sysdyn.ui.elements.StockFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.elements.ModuleFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ValveSymbol"\r class="org.simantics.sysdyn.ui.elements.ValveFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/AuxiliarySymbol"\r class="org.simantics.sysdyn.ui.elements.AuxiliaryFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/CloudSymbol"\r class="org.simantics.sysdyn.ui.elements.CloudFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/InputSymbol"\r class="org.simantics.sysdyn.ui.elements.InputFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ShadowSymbol"\r class="org.simantics.sysdyn.ui.elements.ShadowFactory" /> \r\r <type uri="http://www.simantics.org/Sysdyn-0.0/StockSymbol"\r class="org.simantics.sysdyn.ui.elements.StockFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.elements.ModuleFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/ValveSymbol"\r class="org.simantics.sysdyn.ui.elements.ValveFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/AuxiliarySymbol"\r class="org.simantics.sysdyn.ui.elements.AuxiliaryFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/CloudSymbol"\r class="org.simantics.sysdyn.ui.elements.CloudFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/InputSymbol"\r class="org.simantics.sysdyn.ui.elements.InputFactory" /> \r <type uri="http://www.simantics.org/Sysdyn-0.0/ShadowSymbol"\r class="org.simantics.sysdyn.ui.elements.ShadowFactory" /> \r </target>\r \r <!-- Additional symbols -->\r <target interface="org.simantics.diagram.adapter.ElementFactory">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/AdditionalSymbols/MultilineText"\r class="org.simantics.sysdyn.ui.elements.MultilineTextElementFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/AdditionalSymbols/MultilineText"\r class="org.simantics.sysdyn.ui.elements.MultilineTextElementFactory" /> \r </target> \r \r <!-- Sysdyn connections -->\r <target interface="org.simantics.diagram.adapter.ElementFactory">\r <!-- Edges --> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements.connections.RouteFlowEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements.connections.RouteFlowEdgeFactory" /> \r <type uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements.connections.RouteFlowConnectionFactory">\r <graph/>\r </type> \r \r <resource uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements.connections.DependencyEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements.connections.DependencyEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements.connections.DependencyConnectionFactory" />\r </target>\r \r <target interface="org.simantics.g2d.connection.EdgeVisualsConfigurer">\r <baseType uri="http://www.simantics.org/Diagram-0.0/HasConnector" />\r <resource uri="http://www.simantics.org/Diagram-0.0/HasPlainConnector"\r class="org.simantics.diagram.content.ArrowConfigurer">\r <string>none 0</string>\r </resource>\r <resource uri="http://www.simantics.org/Diagram-0.0/HasArrowConnector"\r class="org.simantics.diagram.content.ArrowConfigurer">\r <string>fill 1</string>\r </resource>\r </target>\r \r <!-- ModelBrowser2 -->\r \r <target interface="org.simantics.browsing.ui.model.children.ChildRule">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/ModuleTypeChildRule"\r class="org.simantics.sysdyn.ui.browser.childrules.ModuleTypeChildRule"/>\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/ModuleContentChildRule"\r class="org.simantics.sysdyn.ui.browser.childrules.ModuleContentChildRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/VariableChildRule"\r class="org.simantics.sysdyn.ui.browser.childrules.VariableChildRule"/> \r \r <resource uri="http://www.simantics.org/Sysdyn-0.0/HistoryDataset/HistoryDatasetVariablesBrowseContext/VariableChildRule"\r class="org.simantics.sysdyn.ui.properties.widgets.historyDataset.VariableChildRule"/> \r <resource uri=" http://www.simantics.org/Sysdyn-0.0/Module/ParameterOverrideBrowseContext/ParameterChildRule"\r class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterChildRule"/> \r </target>\r \r <target interface="org.simantics.browsing.ui.model.visuals.VisualsRule">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/ModuleTypeLabelRule"\r class="org.simantics.sysdyn.ui.browser.labelrules.ModuleTypeLabelRule"/>\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/VariableNameLabelRule"\r class="org.simantics.sysdyn.ui.browser.labelrules.VariableNameLabelRule"/>\r\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/VariableImageRule"\r class="org.simantics.sysdyn.ui.browser.imagerules.VariableImageRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/ChartImageRule"\r class="org.simantics.sysdyn.ui.browser.imagerules.ChartImageRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/ResultImageRule"\r class="org.simantics.sysdyn.ui.browser.imagerules.ResultImageRule"/> \r \r \r <resource uri="http://www.simantics.org/Sysdyn-0.0/HistoryDataset/HistoryDatasetVariablesBrowseContext/VariableLabelRule"\r class="org.simantics.sysdyn.ui.properties.widgets.historyDataset.VariableLabelRule"/> \r\r \r <resource uri=" http://www.simantics.org/Sysdyn-0.0/Module/ParameterOverrideBrowseContext/ParameterLabelRule"\r class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterLabelRule"/> \r <resource uri=" http://www.simantics.org/Sysdyn-0.0/Module/ParameterOverrideBrowseContext/ParameterLabelDecorationRule"\r class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterLabelDecorationRule"/> \r <resource uri=" http://www.simantics.org/Sysdyn-0.0/Module/ParameterOverrideBrowseContext/ParameterModifierRule"\r class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterModifierRule"/> \r <resource uri=" http://www.simantics.org/Sysdyn-0.0/Module/ParameterOverrideBrowseContext/ParameterSorterRule"\r class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterSorterRule"/> \r </target> \r \r <target interface="org.simantics.db.layer0.adapter.ActionFactory">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewModuleType"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewModuleTypeAction" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewEnumeration"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewEnumerationAction" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewFunction"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewFunctionAction" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewFunctionLibrary"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewFunctionLibraryAction" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewSharedFunctionLibrary"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewSharedFunctionLibraryAction" /> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewExperiment"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewExperimentAction" /> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewSimulationPlaybackExperiment"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewSimulationPlaybackExperimentAction" /> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewLineChart"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewLineChartAction" /> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewBarChart"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewBarChartAction" /> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewPieChart"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewPieChartAction" /> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewSheet"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewSheetAction" /> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewHistoryData"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewHistoryDataAction" /> \r </target> \r \r <target interface="org.simantics.db.layer0.adapter.DropActionFactory">\r <resource\r uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/FunctionDropAction"\r class="org.simantics.sysdyn.ui.browser.actions.drop.FunctionDropAction" />\r <resource\r uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/ChartDropAction"\r class="org.simantics.sysdyn.ui.browser.actions.drop.ChartDropAction" /> \r \r \r </target> \r \r <target interface="org.simantics.db.layer0.adapter.Remover">\r <type uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/ModuleSymbol"\r class="org.simantics.sysdyn.ui.browser.actions.remove.ModuleTypeRemover">\r <graph />\r <this />\r </type>\r <type uri="http://www.simantics.org/Sysdyn-0.0/Variable"\r class="org.simantics.sysdyn.ui.actions.SysdynVariableRemover">\r <this />\r </type>\r </target>\r \r \r <target interface="org.simantics.browsing.ui.model.nodetypes.NodeType">\r <baseType uri="http://www.simantics.org/Layer0-0.0/Entity" />\r <type\r uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/ModuleSymbolNodeType"\r class="org.simantics.sysdyn.ui.browser.nodeTypes.ModuleSymbolNodeType"\r constructor="create">\r <this/>\r </type> \r </target>\r \r <!-- PROFILES -->\r <target interface="org.simantics.scenegraph.profile.Style">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/SimulationPlaybackStyle"\r class="org.simantics.sysdyn.ui.elements.profiles.SimulationPlaybackStyle">\r </resource>\r <resource uri="http://www.simantics.org/Sysdyn-0.0/IssueStyle"\r class="org.simantics.sysdyn.ui.elements.profiles.IssueDecorationStyle">\r </resource>\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ShadowStyle"\r class="org.simantics.sysdyn.ui.elements.profiles.ShadowStyle">\r </resource> \r </target>\r \r \r <!-- TODO: currently maps jfree concepts directly to Sysdyn implementations. Sysdyn needs tool specific types for the datasets. -->\r <!-- TODO: AllVariablesOfModel query is run on random Resources; listing all possible types explicitly is cumbersome, we need a better implementation. -->\r <target interface="org.simantics.jfreechart.chart.properties.IAllVariablesOfModel"> \r <type uri="http://www.simantics.org/Sysdyn-1.1/SysdynModel"\r class="org.simantics.sysdyn.ui.trend.AllVariablesOfModel">\r <this />\r </type> \r <type uri="http://www.simantics.org/JFreeChart-1.0/NumberAxis"\r class="org.simantics.sysdyn.ui.trend.AllVariablesOfModel">\r <this />\r </type> \r <type uri="http://www.simantics.org/JFreeChart-1.0/Series"\r class="org.simantics.sysdyn.ui.trend.AllVariablesOfModel">\r <this />\r </type> \r </target> \r \r <target interface="org.simantics.jfreechart.chart.properties.RangeHandlerFactory"> \r <type uri="http://www.simantics.org/JFreeChart-1.0/Series"\r class="org.simantics.sysdyn.ui.trend.SysdynRangeHandlerFactory">\r </type> \r </target> \r \r <!-- TODO: currently maps jfree concepts directly to Sysdyn implementations. Sysdyn needs tool specific types for the datasets. -->\r <target interface="org.simantics.jfreechart.chart.IDataset">\r <type uri="http://www.simantics.org/JFreeChart-0.0/XYDataset"\r class="org.simantics.sysdyn.ui.trend.XYDataset">\r <graph />\r <this />\r </type>\r <type uri="http://www.simantics.org/JFreeChart-0.0/CategoryDataset"\r class="org.simantics.sysdyn.ui.trend.CategoryDataset">\r <graph />\r <this />\r </type> \r <type uri="http://www.simantics.org/JFreeChart-0.0/PieDataset"\r class="org.simantics.sysdyn.ui.trend.PieDataset">\r <graph />\r <this />\r </type> \r <type uri="http://www.simantics.org/Sysdyn-0.0/Charts/SensitivityDataset"\r class="org.simantics.sysdyn.ui.trend.SensitivityDataset">\r <graph />\r <this />\r </type>\r </target>\r
+<adapters>\r\r <target interface="org.simantics.db.layer0.adapter.Realization">\r <type uri="http://www.simantics.org/Sysdyn-0.0/Module"\r class="org.simantics.structural2.realization.StructuralRealization">\r <this />\r </type>\r </target>\r\r <target interface="org.simantics.layer0.utils.triggers.ITrigger">\r <type uri = "http://www.simantics.org/Sysdyn-0.0/DiagramToCompositeMapping"\r class = "org.simantics.sysdyn.ui.editor.DiagramToCompositeMapping3">\r <graph/>\r <this />\r </type>\r </target>\r \r <target interface="org.simantics.structural.ui.modelBrowser.nodes.AbstractNode">\r <type uri="http://www.simantics.org/Sysdyn-0.0/SysdynModel"\r class="org.simantics.structural.ui.modelBrowser.nodes.ModelNode">\r <this />\r </type>\r </target> \r \r\r <target\r interface="org.simantics.browsing.ui.common.node.AbstractNode">\r <type\r uri="http://www.simantics.org/Sysdyn-0.0/SysdynModel"\r class="org.simantics.sysdyn.ui.browser.nodes.ModelNode">\r <this />\r </type>\r\r <resource\r uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.browser.nodes.SymbolNode">\r <this />\r </resource>\r\r <type\r uri="http://www.simantics.org/Simulation-0.0/Experiment"\r class="org.simantics.sysdyn.ui.browser.nodes.ExperimentNode">\r <this />\r </type>\r \r <type\r uri="http://www.simantics.org/Sysdyn-0.0/Result"\r class="org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode">\r <this />\r </type>\r \r </target>\r\r <!-- Inject default connection routing algorithm for sysdyn diagrams -->\r <target interface="org.simantics.g2d.diagram.DiagramClass">\r <adapter uri="http://www.simantics.org/Sysdyn-0.0/ConfigurationDiagram"\r adapterClass="org.simantics.sysdyn.ui.elements.ConfigurationDiagramClassAdapter" />\r </target>\r\r <!-- Sysdyn symbols -->\r <target interface="org.simantics.diagram.adapter.ElementFactory">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/StockSymbol"\r class="org.simantics.sysdyn.ui.elements.StockFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.elements.ModuleFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ValveSymbol"\r class="org.simantics.sysdyn.ui.elements.ValveFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/AuxiliarySymbol"\r class="org.simantics.sysdyn.ui.elements.AuxiliaryFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/CloudSymbol"\r class="org.simantics.sysdyn.ui.elements.CloudFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/InputSymbol"\r class="org.simantics.sysdyn.ui.elements.InputFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ShadowSymbol"\r class="org.simantics.sysdyn.ui.elements.ShadowFactory" /> \r\r <type uri="http://www.simantics.org/Sysdyn-0.0/StockSymbol"\r class="org.simantics.sysdyn.ui.elements.StockFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.elements.ModuleFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/ValveSymbol"\r class="org.simantics.sysdyn.ui.elements.ValveFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/AuxiliarySymbol"\r class="org.simantics.sysdyn.ui.elements.AuxiliaryFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/CloudSymbol"\r class="org.simantics.sysdyn.ui.elements.CloudFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/InputSymbol"\r class="org.simantics.sysdyn.ui.elements.InputFactory" /> \r <type uri="http://www.simantics.org/Sysdyn-0.0/ShadowSymbol"\r class="org.simantics.sysdyn.ui.elements.ShadowFactory" /> \r </target>\r \r <!-- Additional symbols -->\r <target interface="org.simantics.diagram.adapter.ElementFactory">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/AdditionalSymbols/MultilineText"\r class="org.simantics.sysdyn.ui.elements.MultilineTextElementFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/AdditionalSymbols/MultilineText"\r class="org.simantics.sysdyn.ui.elements.MultilineTextElementFactory" /> \r </target> \r \r <!-- Sysdyn connections -->\r <target interface="org.simantics.diagram.adapter.ElementFactory">\r <!-- Edges --> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements.connections.RouteFlowEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements.connections.RouteFlowEdgeFactory" /> \r <type uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements.connections.RouteFlowConnectionFactory">\r <graph/>\r </type> \r \r <resource uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements.connections.DependencyEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements.connections.DependencyEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements.connections.DependencyConnectionFactory" />\r </target>\r \r <target interface="org.simantics.g2d.connection.EdgeVisualsConfigurer">\r <baseType uri="http://www.simantics.org/Diagram-0.0/HasConnector" />\r <resource uri="http://www.simantics.org/Diagram-0.0/HasPlainConnector"\r class="org.simantics.diagram.content.ArrowConfigurer">\r <string>none 0</string>\r </resource>\r <resource uri="http://www.simantics.org/Diagram-0.0/HasArrowConnector"\r class="org.simantics.diagram.content.ArrowConfigurer">\r <string>fill 1</string>\r </resource>\r </target>\r \r <!-- ModelBrowser2 -->\r \r <target interface="org.simantics.browsing.ui.model.children.ChildRule">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/ModuleTypeChildRule"\r class="org.simantics.sysdyn.ui.browser.childrules.ModuleTypeChildRule"/>\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/ModuleContentChildRule"\r class="org.simantics.sysdyn.ui.browser.childrules.ModuleContentChildRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/VariableChildRule"\r class="org.simantics.sysdyn.ui.browser.childrules.VariableChildRule"/> \r \r <resource uri="http://www.simantics.org/Sysdyn-0.0/HistoryDataset/HistoryDatasetVariablesBrowseContext/VariableChildRule"\r class="org.simantics.sysdyn.ui.properties.widgets.historyDataset.VariableChildRule"/> \r <resource uri=" http://www.simantics.org/Sysdyn-0.0/Module/ParameterOverrideBrowseContext/ParameterChildRule"\r class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterChildRule"/> \r \r \r <!-- Sensitivity analysis -->\r <resource uri="http://www.simantics.org/Sysdyn-0.0/SensitivityAnalysisExperiment/ParameterBrowseContext/ParameterChildRule"\r class="org.simantics.sysdyn.ui.properties.widgets.sensitivity.ParameterChildRule"/> \r </target>\r \r <target interface="org.simantics.browsing.ui.model.visuals.VisualsRule">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/ModuleTypeLabelRule"\r class="org.simantics.sysdyn.ui.browser.labelrules.ModuleTypeLabelRule"/>\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/VariableNameLabelRule"\r class="org.simantics.sysdyn.ui.browser.labelrules.VariableNameLabelRule"/>\r\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/VariableImageRule"\r class="org.simantics.sysdyn.ui.browser.imagerules.VariableImageRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/ChartImageRule"\r class="org.simantics.sysdyn.ui.browser.imagerules.ChartImageRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/ResultImageRule"\r class="org.simantics.sysdyn.ui.browser.imagerules.ResultImageRule"/> \r \r \r <resource uri="http://www.simantics.org/Sysdyn-0.0/HistoryDataset/HistoryDatasetVariablesBrowseContext/VariableLabelRule"\r class="org.simantics.sysdyn.ui.properties.widgets.historyDataset.VariableLabelRule"/> \r\r \r <resource uri="http://www.simantics.org/Sysdyn-0.0/Module/ParameterOverrideBrowseContext/ParameterLabelRule"\r class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterLabelRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/Module/ParameterOverrideBrowseContext/ParameterLabelDecorationRule"\r class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterLabelDecorationRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/Module/ParameterOverrideBrowseContext/ParameterModifierRule"\r class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterModifierRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/Module/ParameterOverrideBrowseContext/ParameterSorterRule"\r class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterSorterRule"/> \r \r <!-- Sensitivity analysis -->\r <resource uri="http://www.simantics.org/Sysdyn-0.0/SensitivityAnalysisExperiment/ParameterBrowseContext/ParameterLabelRule"\r class="org.simantics.sysdyn.ui.properties.widgets.sensitivity.ParameterLabelRule"/>\r\r </target> \r \r <target interface="org.simantics.db.layer0.adapter.ActionFactory">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewModuleType"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewModuleTypeAction" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewEnumeration"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewEnumerationAction" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewFunction"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewFunctionAction" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewFunctionLibrary"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewFunctionLibraryAction" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewSharedFunctionLibrary"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewSharedFunctionLibraryAction" /> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewExperiment"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewExperimentAction" /> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewSimulationPlaybackExperiment"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewSimulationPlaybackExperimentAction" /> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewLineChart"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewLineChartAction" /> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewBarChart"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewBarChartAction" /> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewPieChart"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewPieChartAction" /> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewSheet"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewSheetAction" /> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewHistoryData"\r class="org.simantics.sysdyn.ui.browser.actions.newActions.NewHistoryDataAction" /> \r </target> \r \r <target interface="org.simantics.db.layer0.adapter.DropActionFactory">\r <resource\r uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/FunctionDropAction"\r class="org.simantics.sysdyn.ui.browser.actions.drop.FunctionDropAction" />\r <resource\r uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/ChartDropAction"\r class="org.simantics.sysdyn.ui.browser.actions.drop.ChartDropAction" /> \r \r \r </target> \r \r <target interface="org.simantics.db.layer0.adapter.Remover">\r <type uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/ModuleSymbol"\r class="org.simantics.sysdyn.ui.browser.actions.remove.ModuleTypeRemover">\r <graph />\r <this />\r </type>\r <type uri="http://www.simantics.org/Sysdyn-0.0/Variable"\r class="org.simantics.sysdyn.ui.actions.SysdynVariableRemover">\r <this />\r </type>\r </target>\r \r \r <target interface="org.simantics.browsing.ui.model.nodetypes.NodeType">\r <baseType uri="http://www.simantics.org/Layer0-0.0/Entity" />\r <type\r uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/ModuleSymbolNodeType"\r class="org.simantics.sysdyn.ui.browser.nodeTypes.ModuleSymbolNodeType"\r constructor="create">\r <this/>\r </type> \r </target>\r \r <!-- PROFILES -->\r <target interface="org.simantics.scenegraph.profile.Style">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/SimulationPlaybackStyle"\r class="org.simantics.sysdyn.ui.elements.profiles.SimulationPlaybackStyle">\r </resource>\r <resource uri="http://www.simantics.org/Sysdyn-0.0/IssueStyle"\r class="org.simantics.sysdyn.ui.elements.profiles.IssueDecorationStyle">\r </resource>\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ShadowStyle"\r class="org.simantics.sysdyn.ui.elements.profiles.ShadowStyle">\r </resource> \r </target>\r \r \r <!-- TODO: currently maps jfree concepts directly to Sysdyn implementations. Sysdyn needs tool specific types for the datasets. -->\r <!-- TODO: AllVariablesOfModel query is run on random Resources; listing all possible types explicitly is cumbersome, we need a better implementation. -->\r <target interface="org.simantics.jfreechart.chart.properties.IAllVariablesOfModel"> \r <type uri="http://www.simantics.org/Sysdyn-1.1/SysdynModel"\r class="org.simantics.sysdyn.ui.trend.AllVariablesOfModel">\r <this />\r </type> \r <type uri="http://www.simantics.org/JFreeChart-1.0/NumberAxis"\r class="org.simantics.sysdyn.ui.trend.AllVariablesOfModel">\r <this />\r </type> \r <type uri="http://www.simantics.org/JFreeChart-1.0/Series"\r class="org.simantics.sysdyn.ui.trend.AllVariablesOfModel">\r <this />\r </type> \r <type uri="http://www.simantics.org/Sysdyn-0.0/SensitivityAnalysisExperiment/Parameter"\r class="org.simantics.sysdyn.ui.trend.AllVariablesOfModel">\r <this />\r </type>\r </target> \r \r <target interface="org.simantics.jfreechart.chart.properties.RangeHandlerFactory"> \r <type uri="http://www.simantics.org/JFreeChart-1.0/Series"\r class="org.simantics.sysdyn.ui.trend.SysdynRangeHandlerFactory">\r </type> \r <type uri="http://www.simantics.org/Sysdyn-0.0/SensitivityAnalysisExperiment/Parameter"\r class="org.simantics.sysdyn.ui.properties.widgets.sensitivity.SensitivityRangeHandlerFactory">\r </type>\r </target> \r \r <!-- TODO: currently maps jfree concepts directly to Sysdyn implementations. Sysdyn needs tool specific types for the datasets. -->\r <target interface="org.simantics.jfreechart.chart.IDataset">\r <type uri="http://www.simantics.org/JFreeChart-0.0/XYDataset"\r class="org.simantics.sysdyn.ui.trend.XYDataset">\r <graph />\r <this />\r </type>\r <type uri="http://www.simantics.org/JFreeChart-0.0/CategoryDataset"\r class="org.simantics.sysdyn.ui.trend.CategoryDataset">\r <graph />\r <this />\r </type> \r <type uri="http://www.simantics.org/JFreeChart-0.0/PieDataset"\r class="org.simantics.sysdyn.ui.trend.PieDataset">\r <graph />\r <this />\r </type> \r <type uri="http://www.simantics.org/Sysdyn-0.0/Charts/SensitivityDataset"\r class="org.simantics.sysdyn.ui.trend.SensitivityDataset">\r <graph />\r <this />\r </type>\r </target>\r \r <!-- Sensitivity analysis -->\r <target\r interface="org.simantics.sysdyn.ui.properties.widgets.sensitivity.IDistributionProperties">\r <type\r uri="http://www.simantics.org/Sysdyn-0.0/NormalDistribution"\r class="org.simantics.sysdyn.ui.properties.widgets.sensitivity.NormalDistributionProperties">\r <this />\r </type> \r <type\r uri="http://www.simantics.org/Sysdyn-0.0/UniformDistribution"\r class="org.simantics.sysdyn.ui.properties.widgets.sensitivity.UniformDistributionProperties">\r <this />\r </type> \r <type\r uri="http://www.simantics.org/Sysdyn-0.0/Interval"\r class="org.simantics.sysdyn.ui.properties.widgets.sensitivity.IntervalProperties">\r <this />\r </type>\r </target>\r \r
</adapters>
\ No newline at end of file
*******************************************************************************/\r
package org.simantics.sysdyn.ui.handlers.newComponents;\r
\r
+import java.util.ArrayList;\r
+\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.utils.ListUtils;\r
import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.layer0.utils.direct.GraphUtils;\r
import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.manager.SysdynSensitivityAnalysisExperiment;\r
\r
/**\r
* Creates a new sensitivity analysis experiment.\r
@Override\r
protected void configureExperiment(WriteGraph graph, Resource experiment) throws DatabaseException {\r
SysdynResource sr = SysdynResource.getInstance(graph);\r
- graph.claimLiteral(experiment, sr.SensitivityAnalysisExperiment_minValue, SysdynSensitivityAnalysisExperiment.DEFAULT_MIN_VALUE);\r
- graph.claimLiteral(experiment, sr.SensitivityAnalysisExperiment_maxValue, SysdynSensitivityAnalysisExperiment.DEFAULT_MAX_VALUE);\r
- graph.claimLiteral(experiment, sr.SensitivityAnalysisExperiment_numValues, SysdynSensitivityAnalysisExperiment.DEFAULT_NUM_VALUES);\r
- graph.claimLiteral(experiment, sr.SensitivityAnalysisExperiment_mean, SysdynSensitivityAnalysisExperiment.DEFAULT_MEAN);\r
- graph.claimLiteral(experiment, sr.SensitivityAnalysisExperiment_stdDeviation, SysdynSensitivityAnalysisExperiment.DEFAULT_STD_DEVIATION);\r
- graph.claimLiteral(experiment, sr.SensitivityAnalysisExperiment_propabilityDistribution, "uniform");\r
+ Layer0 L0 = Layer0.getInstance(graph);\r
+ \r
+ Resource distribution = GraphUtils.create2(graph, sr.UniformDistribution,\r
+ sr.UniformDistribution_minValue, 0.0,\r
+ sr.UniformDistribution_maxValue, 10.0);\r
+ \r
+ Resource parameter = GraphUtils.create2(graph, sr.SensitivityAnalysisExperiment_Parameter,\r
+ sr.SensitivityAnalysisExperiment_Parameter_propabilityDistribution, distribution,\r
+ sr.SensitivityAnalysisExperiment_Parameter_variable, "",\r
+ sr.SensitivityAnalysisExperiment_Parameter_numberOfValues, 10,\r
+ L0.PartOf, experiment);\r
+ \r
+ ArrayList<Resource> parameterList = new ArrayList<Resource>();\r
+ parameterList.add(parameter);\r
+ \r
+ graph.claim(experiment, sr.SensitivityAnalysisExperiment_parameterList, ListUtils.create(graph, parameterList));\r
}\r
\r
@Override\r
package org.simantics.sysdyn.ui.properties;\r
\r
+import java.util.Collection;\r
+import java.util.Collections;\r
+import java.util.HashMap;\r
+import java.util.Map;\r
+\r
import org.eclipse.jface.layout.GridDataFactory;\r
import org.eclipse.jface.layout.GridLayoutFactory;\r
import org.eclipse.jface.resource.JFaceResources;\r
import org.eclipse.jface.resource.LocalResourceManager;\r
+import org.eclipse.jface.viewers.ISelectionProvider;\r
+import org.eclipse.jface.viewers.IStructuredSelection;\r
import org.eclipse.swt.SWT;\r
import org.eclipse.swt.custom.ScrolledComposite;\r
+import org.eclipse.swt.events.DisposeEvent;\r
+import org.eclipse.swt.events.DisposeListener;\r
+import org.eclipse.swt.events.SelectionAdapter;\r
+import org.eclipse.swt.events.SelectionEvent;\r
+import org.eclipse.swt.graphics.Point;\r
import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Group;\r
import org.eclipse.swt.widgets.Label;\r
+import org.eclipse.swt.widgets.Tree;\r
import org.eclipse.ui.IWorkbenchSite;\r
+import org.simantics.browsing.ui.swt.SingleSelectionInputSource;\r
+import org.simantics.browsing.ui.swt.widgets.Button;\r
+import org.simantics.browsing.ui.swt.widgets.GraphExplorerComposite;\r
import org.simantics.browsing.ui.swt.widgets.StringPropertyFactory;\r
import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier;\r
+import org.simantics.browsing.ui.swt.widgets.TrackedCombo;\r
import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
+import org.simantics.browsing.ui.swt.widgets.impl.ComboModifyListenerImpl;\r
+import org.simantics.browsing.ui.swt.widgets.impl.ReadFactoryImpl;\r
+import org.simantics.browsing.ui.swt.widgets.impl.SelectionListenerImpl;\r
+import org.simantics.browsing.ui.swt.widgets.impl.TextModifyListener;\r
+import org.simantics.browsing.ui.swt.widgets.impl.TrackedModifyEvent;\r
+import org.simantics.browsing.ui.swt.widgets.impl.Widget;\r
import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
+import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupportImpl;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.procedure.adapter.DisposableListener;\r
+import org.simantics.db.common.utils.ListUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.management.ISessionContext;\r
+import org.simantics.db.request.Read;\r
+import org.simantics.jfreechart.chart.properties.RangeComposite;\r
+import org.simantics.jfreechart.chart.properties.VariableExistsValidator;\r
+import org.simantics.jfreechart.chart.properties.xyline.AxisAndVariablesExplorerComposite;\r
import org.simantics.layer0.Layer0;\r
+import org.simantics.layer0.utils.direct.GraphUtils;\r
import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.ui.properties.widgets.factories.DoublePropertyFactory;\r
-import org.simantics.sysdyn.ui.properties.widgets.factories.DoublePropertyModifier;\r
import org.simantics.sysdyn.ui.properties.widgets.factories.IntegerPropertyFactory;\r
import org.simantics.sysdyn.ui.properties.widgets.factories.IntegerPropertyModifier;\r
-import org.simantics.utils.ui.validators.DoubleValidator;\r
+import org.simantics.sysdyn.ui.properties.widgets.sensitivity.DistributionPropertyWidget;\r
+import org.simantics.sysdyn.ui.properties.widgets.sensitivity.ParameterChildRule;\r
+import org.simantics.sysdyn.ui.properties.widgets.sensitivity.VariableNameModifier;\r
+import org.simantics.ui.SimanticsUI;\r
+import org.simantics.utils.RunnableWithObject;\r
+import org.simantics.utils.datastructures.ArrayMap;\r
+import org.simantics.utils.ui.AdaptionUtils;\r
import org.simantics.utils.ui.validators.IntegerValidator;\r
\r
/**\r
* @author Tuomas Miettinen\r
*\r
*/\r
-public class SensitivityAnalysisExperimentTab extends LabelPropertyTabContributor {\r
+public class SensitivityAnalysisExperimentTab extends LabelPropertyTabContributor implements Widget {\r
\r
- @Override\r
- public void createControls(Composite body, IWorkbenchSite site,\r
- ISessionContext context, WidgetSupport support) {\r
- \r
- ScrolledComposite sc = new ScrolledComposite(body, SWT.H_SCROLL | SWT.V_SCROLL);\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(sc);\r
- GridLayoutFactory.fillDefaults().applyTo(sc);\r
- \r
- Composite composite = new RemoveFocusBeforeExperimentComposite(sc, SWT.NONE);\r
+ private GraphExplorerComposite explorer;\r
+ private WidgetSupportImpl parameterSupport = new WidgetSupportImpl();\r
+ private ScrolledComposite propertyContainer;\r
+ private Composite parameterProperties;\r
+ private Composite content;\r
+ private Button remove;\r
+ private Resource experiment;\r
+ \r
+ private boolean dirty = false;\r
+ \r
+ private DisposableListener<Collection<Resource>> contentListener;\r
+\r
+ @Override\r
+ public void createControls(Composite body, IWorkbenchSite site,\r
+ final ISessionContext context, WidgetSupport support) {\r
+ support.register(this);\r
+\r
+ Composite composite = new RemoveFocusBeforeExperimentComposite(body, SWT.NONE);\r
GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
- GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).applyTo(composite);\r
+ \r
+ // Scrolled composite for displaying properties of a selection in explorer\r
+ propertyContainer = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(propertyContainer);\r
+ GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
+ propertyContainer.setExpandHorizontal(true);\r
+ propertyContainer.setExpandVertical(true);\r
\r
+ content = new Composite(propertyContainer, SWT.NONE);\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(content);\r
+ GridLayoutFactory.fillDefaults().numColumns(2).applyTo(content);\r
+\r
// Label\r
- Label label = new Label(composite, SWT.NONE);\r
+ Composite labelComposite = new Composite(content, SWT.NONE);\r
+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(labelComposite);\r
+ GridLayoutFactory.fillDefaults().numColumns(4).applyTo(labelComposite);\r
+ Label label = new Label(labelComposite, SWT.NONE);\r
label.setText("Name");\r
- \r
- TrackedText name = new TrackedText(composite, support, SWT.BORDER);\r
+\r
+ TrackedText name = new TrackedText(labelComposite, support, SWT.BORDER);\r
name.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel));\r
name.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel));\r
name.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasName));\r
name.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), name.getWidget())));\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(name.getWidget());\r
+ \r
+ label = new Label(labelComposite, SWT.NONE);\r
+ label.setText("Seed");\r
+ \r
+ TrackedText seed = new TrackedText(labelComposite, support, SWT.BORDER);\r
+ seed.setTextFactory(new IntegerPropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_randomSeed));\r
+ seed.addModifyListener(new IntegerPropertyModifier(context, SysdynResource.URIs.SensitivityAnalysisExperiment_randomSeed));\r
+ seed.setInputValidator(new IntegerValidator());\r
+ seed.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), seed.getWidget())));\r
+ GridDataFactory.fillDefaults().hint(80, SWT.DEFAULT).applyTo(seed.getWidget());\r
+\r
+\r
+ // (Ontology-based) GraphExplorer displaying range axis and variables mapped to those axis\r
+ explorer = new AxisAndVariablesExplorerComposite(ArrayMap.keys(\r
+ "displaySelectors", "displayFilter").values(false, false), site, content, support, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE);\r
+ explorer.setBrowseContexts(SysdynResource.URIs.SensitivityAnalysisExperiment_ParameterBrowseContext);\r
+ explorer.setInputSource(new SingleSelectionInputSource(\r
+ Resource.class));\r
+ explorer.getExplorer().setAutoExpandLevel(2); // Expand everything in the beginning\r
+ explorer.finish();\r
+\r
+ ((Tree)explorer.getExplorerControl()).addSelectionListener(new SelectionAdapter() {\r
+ public void widgetSelected(SelectionEvent e) {\r
+ updateSelection(context);\r
+ }\r
+ });\r
+ \r
+\r
+ \r
+ explorer.addDisposeListener(new DisposeListener() {\r
+ \r
+ @Override\r
+ public void widgetDisposed(DisposeEvent e) {\r
+ if(contentListener != null)\r
+ contentListener.dispose(); \r
+ }\r
+ });\r
+ \r
+ \r
+ GridDataFactory.fillDefaults().hint(250, SWT.DEFAULT).grab(false, true).applyTo(explorer);\r
\r
- // The propability distribution\r
- label = new Label(composite, SWT.NONE);\r
- label.setText("Propability distribution");\r
- \r
- TrackedText propabilityDistributionName = new TrackedText(composite, support, SWT.BORDER);\r
- propabilityDistributionName.setTextFactory(new StringPropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_propabilityDistribution));\r
- propabilityDistributionName.addModifyListener(new StringPropertyModifier(context, SysdynResource.URIs.SensitivityAnalysisExperiment_propabilityDistribution));\r
- //parameterName.setInputValidator(new DoubleValidator());\r
- propabilityDistributionName.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), propabilityDistributionName.getWidget())));\r
- \r
- // Parameter the value of which is varied \r
- label = new Label(composite, SWT.NONE);\r
- label.setText("Varied parameter name");\r
- \r
- TrackedText parameterName = new TrackedText(composite, support, SWT.BORDER);\r
- parameterName.setTextFactory(new StringPropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_variedParameter));\r
- parameterName.addModifyListener(new StringPropertyModifier(context, SysdynResource.URIs.SensitivityAnalysisExperiment_variedParameter));\r
- //parameterName.setInputValidator(new DoubleValidator());\r
- parameterName.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), parameterName.getWidget())));\r
- \r
- // minValue\r
- label = new Label(composite, SWT.NONE);\r
- label.setText("Min value");\r
- \r
- TrackedText minValue = new TrackedText(composite, support, SWT.BORDER);\r
- minValue.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_minValue));\r
- minValue.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.SensitivityAnalysisExperiment_minValue));\r
- minValue.setInputValidator(new DoubleValidator());\r
- minValue.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), minValue.getWidget())));\r
- GridDataFactory.fillDefaults().hint(300, SWT.DEFAULT).applyTo(name.getWidget());\r
-\r
- // maxValue\r
- label = new Label(composite, SWT.NONE);\r
- label.setText("Max value");\r
- \r
- TrackedText maxValue = new TrackedText(composite, support, SWT.BORDER);\r
- maxValue.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_maxValue));\r
- maxValue.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.SensitivityAnalysisExperiment_maxValue));\r
- maxValue.setInputValidator(new DoubleValidator());\r
- maxValue.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), maxValue.getWidget())));\r
- \r
- // number of values\r
- label = new Label(composite, SWT.NONE);\r
- label.setText("Number of values");\r
- \r
- TrackedText numValues = new TrackedText(composite, support, SWT.BORDER);\r
- numValues.setTextFactory(new IntegerPropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_numValues));\r
- numValues.addModifyListener(new IntegerPropertyModifier(context, SysdynResource.URIs.SensitivityAnalysisExperiment_numValues));\r
+ Group parameterPropertyGroup = new Group(content, SWT.NONE);\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(parameterPropertyGroup);\r
+ GridLayoutFactory.fillDefaults().applyTo(parameterPropertyGroup);\r
+ \r
+ parameterProperties = new Composite(parameterPropertyGroup, SWT.NONE);\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(parameterProperties);\r
+ GridLayoutFactory.fillDefaults().numColumns(2).applyTo(parameterProperties);\r
+\r
+ // Label\r
+ label = new Label(parameterProperties, SWT.NONE);\r
+ label.setText("Variable:");\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+\r
+ TrackedText variable = new TrackedText(parameterProperties, parameterSupport, SWT.BORDER);\r
+ variable.setTextFactory(new StringPropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_Parameter_variable));\r
+ variable.addModifyListener(new VariableNameModifier(variable.getWidget(), parameterSupport, SysdynResource.URIs.SensitivityAnalysisExperiment_Parameter_variable, SysdynResource.URIs.SensitivityAnalysisExperiment_Parameter_indexes));\r
+ variable.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), variable.getWidget())));\r
+ variable.setInputValidator(new VariableExistsValidator(parameterSupport, variable));\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(variable.getWidget());\r
+ \r
+ label = new Label(parameterProperties, SWT.NONE);\r
+ label.setText("Range:");\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+ \r
+ RangeComposite rangeComposite = new RangeComposite(parameterProperties, context, parameterSupport, SWT.NONE) {\r
+ @Override\r
+ protected Resource getIndexRelation(ReadGraph graph) {\r
+ return SysdynResource.getInstance(graph).SensitivityAnalysisExperiment_Parameter_indexes;\r
+ }\r
+ };\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeComposite);\r
+ \r
+// TrackedText variable = new TrackedText(parameterProperties, parameterSupport, SWT.BORDER);\r
+// variable.setTextFactory(new StringPropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_Parameter_variable));\r
+// variable.addModifyListener(new StringPropertyModifier(context, SysdynResource.URIs.SensitivityAnalysisExperiment_Parameter_variable));\r
+// variable.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), variable.getWidget())));\r
+// GridDataFactory.fillDefaults().grab(true, false).applyTo(variable.getWidget());\r
+\r
+ label = new Label(parameterProperties, SWT.NONE);\r
+ label.setText("Number of values:");\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+\r
+\r
+ TrackedText numValues = new TrackedText(parameterProperties, parameterSupport, SWT.BORDER);\r
+ numValues.setTextFactory(new IntegerPropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_Parameter_numberOfValues));\r
+ numValues.addModifyListener(new IntegerPropertyModifier(context, SysdynResource.URIs.SensitivityAnalysisExperiment_Parameter_numberOfValues));\r
numValues.setInputValidator(new IntegerValidator());\r
numValues.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), numValues.getWidget())));\r
+ GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).hint(80, SWT.DEFAULT).applyTo(numValues.getWidget());\r
+ \r
+ label = new Label(parameterProperties, SWT.NONE);\r
+ label.setText("Distribution:");\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+\r
+ TrackedCombo distributionSelector = new TrackedCombo(parameterProperties, parameterSupport, SWT.DROP_DOWN);\r
+ distributionSelector.setItemFactory(new ReadFactoryImpl<Resource, Map<String,Object>>() {\r
+\r
+ @Override\r
+ public Map<String, Object> perform(ReadGraph graph, Resource input) throws DatabaseException {\r
+ SysdynResource SR = SysdynResource.getInstance(graph);\r
+ Map<String, Object> items = new HashMap<String, Object>();\r
+\r
+ items.put("Normal", SR.NormalDistribution);\r
+ items.put("Uniform", SR.UniformDistribution);\r
+ items.put("Interval", SR.Interval);\r
+\r
+ return items;\r
+ }\r
+\r
+ });\r
+\r
+ distributionSelector.setSelectionFactory(new ReadFactoryImpl<Resource, String>() {\r
+\r
+ @Override\r
+ public String perform(ReadGraph graph, Resource parameter) throws DatabaseException {\r
+ SysdynResource SR = SysdynResource.getInstance(graph);\r
+ Resource distribution = graph.getPossibleObject(parameter, SR.SensitivityAnalysisExperiment_Parameter_propabilityDistribution);\r
+ if(distribution == null)\r
+ return null;\r
+ \r
+ if(graph.isInstanceOf(distribution, SR.UniformDistribution))\r
+ return "Uniform";\r
+ else if(graph.isInstanceOf(distribution, SR.NormalDistribution))\r
+ return "Normal";\r
+ else if(graph.isInstanceOf(distribution, SR.Interval))\r
+ return "Interval";\r
+ else\r
+ return "";\r
+\r
+ }\r
+ });\r
+\r
+ distributionSelector.addModifyListener(new ComboModifyListenerImpl<Resource>() {\r
+\r
+ @Override\r
+ public void applyText(WriteGraph graph, Resource input, String text)\r
+ throws DatabaseException {\r
+ if(text == null || text.isEmpty())\r
+ return;\r
+\r
+ SysdynResource SR = SysdynResource.getInstance(graph);\r
+\r
+ Resource type = SR.UniformDistribution;\r
+\r
+ if("Normal".equals(text))\r
+ type = SR.NormalDistribution;\r
+ else if("Interval".equals(text))\r
+ type = SR.Interval; \r
+\r
+ graph.deny(input, SR.SensitivityAnalysisExperiment_Parameter_propabilityDistribution);\r
+\r
+ GraphUtils.create2(graph, type,\r
+ SR.SensitivityAnalysisExperiment_Parameter_propabilityDistribution_Inverse, input);\r
+\r
+ dirty = true;\r
+ }\r
+ });\r
+\r
+ distributionSelector.addModifyListener(new TextModifyListener() {\r
+\r
+ @Override\r
+ public void modifyText(TrackedModifyEvent e) {\r
+ if(dirty) {\r
+ parameterSupport.update();\r
+ dirty = false;\r
+ propertyContainer.setContent(content);\r
+ Point size = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
+ propertyContainer.setMinSize(size);\r
+ }\r
+ }\r
+ });\r
+\r
+ label = new Label(parameterProperties, SWT.NONE);\r
+ \r
+ DistributionPropertyWidget dpw = new DistributionPropertyWidget(parameterProperties, context, parameterSupport, SWT.NONE);\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(dpw);\r
+\r
+ \r
+ Composite buttonComposite = new Composite(content, SWT.NONE);\r
+ GridDataFactory.fillDefaults().applyTo(buttonComposite);\r
+ GridLayoutFactory.fillDefaults().numColumns(3).applyTo(buttonComposite);\r
+ \r
+ \r
+ Button addVariable = new Button(buttonComposite, support, SWT.NONE);\r
+ addVariable.setText("Add parameter");\r
+ addVariable.addSelectionListener(new SelectionListenerImpl<Resource>(context) {\r
+\r
+ @Override\r
+ public void apply(WriteGraph graph, Resource input) throws DatabaseException {\r
+ SysdynResource sr = SysdynResource.getInstance(graph);\r
+ Layer0 L0 = Layer0.getInstance(graph);\r
+ \r
+ Resource distribution = GraphUtils.create2(graph, sr.UniformDistribution,\r
+ sr.UniformDistribution_minValue, 0.0,\r
+ sr.UniformDistribution_maxValue, 10.0);\r
+ \r
+ Resource parameter = GraphUtils.create2(graph, sr.SensitivityAnalysisExperiment_Parameter,\r
+ sr.SensitivityAnalysisExperiment_Parameter_propabilityDistribution, distribution,\r
+ sr.SensitivityAnalysisExperiment_Parameter_variable, "",\r
+ sr.SensitivityAnalysisExperiment_Parameter_numberOfValues, 10,\r
+ L0.PartOf, input);\r
+ \r
+ Resource parameterList = graph.getPossibleObject(input, sr.SensitivityAnalysisExperiment_parameterList);\r
+ ListUtils.insertBack(graph, parameterList, Collections.singleton(parameter));\r
+ }\r
+ });\r
+\r
+ remove = new Button(buttonComposite, parameterSupport, SWT.NONE);\r
+ remove.setText("Remove");\r
+ remove.addSelectionListener(new SelectionListenerImpl<Resource>(context) {\r
+\r
+ @Override\r
+ public void apply(WriteGraph graph, Resource input) throws DatabaseException {\r
+ if(input == null)\r
+ return;\r
+ \r
+ SysdynResource sr = SysdynResource.getInstance(graph);\r
+ Layer0 L0 = Layer0.getInstance(graph);\r
+ \r
+ Resource experiment = graph.getPossibleObject(input, L0.PartOf);\r
+ Resource parameterList = graph.getPossibleObject(experiment, sr.SensitivityAnalysisExperiment_parameterList);\r
+ \r
+ if(ListUtils.toList(graph, parameterList).size() > 1)\r
+ ListUtils.removeElement(graph, parameterList, input);\r
+ \r
+ }\r
+ \r
+ });\r
+ \r
+\r
+ propertyContainer.setContent(content);\r
+ Point size = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
+ propertyContainer.setMinSize(size);\r
+\r
+ }\r
+\r
+\r
+ /**\r
+ * Updates the content of propertyContainer \r
+ * @param context\r
+ */\r
+ private void updateSelection(ISessionContext context) {\r
+ ISelectionProvider selectionProvider = (ISelectionProvider)explorer.getAdapter(ISelectionProvider.class);\r
+ IStructuredSelection selection = (IStructuredSelection)selectionProvider.getSelection();\r
+ parameterSupport.fireInput(context, selection);\r
+\r
+ propertyContainer.setContent(content);\r
+ Point size = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
+ propertyContainer.setMinSize(size);\r
+ }\r
+\r
+\r
+ @Override\r
+ public void setInput(ISessionContext context, Object input) {\r
+ experiment = AdaptionUtils.adaptToSingle(input, Resource.class);\r
+ if(contentListener == null) {\r
+ contentListener = new DisposableListener<Collection<Resource>>() {\r
+\r
+ @Override\r
+ public void execute(Collection<Resource> result) {\r
+ if(remove != null && !remove.getWidget().isDisposed() && result != null) {\r
+ remove.getWidget().getDisplay().asyncExec(new RunnableWithObject(result) {\r
+ @Override\r
+ public void run() {\r
+ if(!remove.getWidget().isDisposed()) {\r
+ @SuppressWarnings("unchecked")\r
+ Collection<Resource> result = (Collection<Resource>) getObject();\r
+ if(result.size() > 1)\r
+ remove.getWidget().setEnabled(true);\r
+ else\r
+ remove.getWidget().setEnabled(false);\r
+ }\r
+ }\r
+ });\r
+\r
+ }\r
+ }\r
+\r
+ @Override\r
+ public void exception(Throwable t) {\r
+ t.printStackTrace();\r
+ }\r
+ };\r
+\r
+ SimanticsUI.getSession().asyncRequest(new Read<Collection<Resource>> () {\r
+\r
+ @SuppressWarnings("unchecked")\r
+ @Override\r
+ public Collection<Resource> perform(ReadGraph graph) throws DatabaseException {\r
+ return (Collection<Resource>) new ParameterChildRule().getChildren(graph, experiment);\r
+ }\r
+\r
+ }, contentListener);\r
+ }\r
+\r
\r
- // mean\r
- label = new Label(composite, SWT.NONE);\r
- label.setText("Mean");\r
- \r
- TrackedText mean = new TrackedText(composite, support, SWT.BORDER);\r
- mean.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_mean));\r
- mean.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.SensitivityAnalysisExperiment_mean));\r
- mean.setInputValidator(new DoubleValidator());\r
- mean.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), mean.getWidget())));\r
- \r
- // standard deviation\r
- label = new Label(composite, SWT.NONE);\r
- label.setText("Standard deviation");\r
- \r
- TrackedText stdDeviation = new TrackedText(composite, support, SWT.BORDER);\r
- stdDeviation.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_stdDeviation));\r
- stdDeviation.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.SensitivityAnalysisExperiment_stdDeviation));\r
- stdDeviation.setInputValidator(new DoubleValidator());\r
- stdDeviation.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), stdDeviation.getWidget())));\r
- \r
- // Scrolled composite settings\r
- sc.setContent(composite);\r
- sc.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));\r
- sc.setExpandHorizontal(true);\r
- sc.setExpandVertical(true);\r
- \r
- }\r
+ }\r
\r
}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2013 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * Semantum Oy - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.properties.widgets.sensitivity;\r
+\r
+import java.util.HashMap;\r
+\r
+import org.eclipse.jface.layout.GridLayoutFactory;\r
+import org.eclipse.jface.viewers.StructuredSelection;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Control;\r
+import org.simantics.browsing.ui.swt.widgets.impl.Widget;\r
+import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
+import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupportImpl;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.WriteRequest;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.management.ISessionContext;\r
+import org.simantics.db.request.Read;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.ui.SimanticsUI;\r
+import org.simantics.utils.ui.AdaptionUtils;\r
+\r
+public class DistributionPropertyWidget extends Composite implements Widget {\r
+ \r
+ private IDistributionProperties distributionProperties = null;\r
+ private WidgetSupportImpl distributionSupport = new WidgetSupportImpl();\r
+ private HashMap<String, String> cache = new HashMap<String, String>();\r
+ private Resource oldInput;\r
+\r
+ public DistributionPropertyWidget(Composite parent, ISessionContext context, WidgetSupport support, int style) {\r
+ super(parent, style);\r
+ GridLayoutFactory.fillDefaults().applyTo(this);\r
+ support.register(this);\r
+ }\r
+\r
+ @Override\r
+ public void setInput(ISessionContext context, Object input) {\r
+ final Resource resource = AdaptionUtils.adaptToSingle(input, Resource.class);\r
+ if(resource == null)\r
+ return;\r
+\r
+ IDistributionProperties newProperties = null;\r
+ Resource distribution = null;\r
+ try {\r
+ distribution = SimanticsUI.getSession().syncRequest(new Read<Resource>() {\r
+\r
+ @Override\r
+ public Resource perform(ReadGraph graph) throws DatabaseException {\r
+ Resource distribution = graph.getPossibleObject(\r
+ resource, \r
+ SysdynResource.getInstance(graph).SensitivityAnalysisExperiment_Parameter_propabilityDistribution\r
+ );\r
+ \r
+ return distribution;\r
+ }\r
+\r
+ });\r
+ \r
+ newProperties = SimanticsUI.getSession().syncRequest(new Read<IDistributionProperties>() {\r
+\r
+ @Override\r
+ public IDistributionProperties perform(ReadGraph graph) throws DatabaseException {\r
+ Resource distribution = graph.getPossibleObject(\r
+ resource, \r
+ SysdynResource.getInstance(graph).SensitivityAnalysisExperiment_Parameter_propabilityDistribution\r
+ );\r
+ \r
+ return graph.adapt(distribution, IDistributionProperties.class);\r
+ }\r
+\r
+ });\r
+ \r
+ // Create a PropertyComposite for the selected node\r
+ if(newProperties != null) {\r
+\r
+ if(distributionProperties != null)\r
+ distributionProperties.getCachedValues(cache);\r
+ \r
+ if(oldInput != null && !oldInput.equals(resource))\r
+ cache.clear();\r
+ \r
+ oldInput = resource;\r
+ \r
+ for(Control child : this.getChildren()) {\r
+ child.dispose();\r
+ }\r
+ \r
+ newProperties.createContent(this, context, distributionSupport);\r
+ distributionProperties = newProperties;\r
+ \r
+ SimanticsUI.getSession().syncRequest(new WriteRequest() {\r
+ \r
+ @Override\r
+ public void perform(WriteGraph graph) throws DatabaseException {\r
+ distributionProperties.applyCache(graph, cache);\r
+ \r
+ }\r
+ });\r
+ \r
+ distributionSupport.fireInput(context, new StructuredSelection(distribution));\r
+ }\r
+ \r
+ } catch (DatabaseException e) {\r
+ e.printStackTrace();\r
+ }\r
+ }\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2013 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * Semantum Oy - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.properties.widgets.sensitivity;\r
+\r
+import java.util.HashMap;\r
+\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.management.ISessionContext;\r
+\r
+public interface IDistributionProperties {\r
+ \r
+ public Composite createContent(Composite parent, ISessionContext context, WidgetSupport support);\r
+ \r
+ public void getCachedValues(HashMap<String, String> cachedValues);\r
+ \r
+ public void applyCache(WriteGraph graph, HashMap<String, String> cachedValues) throws DatabaseException;\r
+\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2013 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * Semantum Oy - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.properties.widgets.sensitivity;\r
+\r
+import java.util.HashMap;\r
+\r
+import org.eclipse.jface.layout.GridDataFactory;\r
+import org.eclipse.jface.layout.GridLayoutFactory;\r
+import org.eclipse.jface.resource.JFaceResources;\r
+import org.eclipse.jface.resource.LocalResourceManager;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Label;\r
+import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
+import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.management.ISessionContext;\r
+import org.simantics.jfreechart.chart.properties.DoubleValidator;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.ui.properties.SysdynBasicColorProvider;\r
+import org.simantics.sysdyn.ui.properties.widgets.factories.DoublePropertyFactory;\r
+import org.simantics.sysdyn.ui.properties.widgets.factories.DoublePropertyModifier;\r
+\r
+public class IntervalProperties implements IDistributionProperties {\r
+\r
+ private Resource resource;\r
+ private TrackedText minValue; \r
+ private TrackedText maxValue;\r
+ \r
+ public IntervalProperties(Resource resource) {\r
+ this.resource = resource;\r
+ }\r
+ \r
+ @Override\r
+ public Composite createContent(Composite parent, ISessionContext context, WidgetSupport support) {\r
+ Composite composite = new Composite(parent, SWT.NONE);\r
+ GridLayoutFactory.fillDefaults().numColumns(2).applyTo(composite);\r
+ \r
+ // minValue\r
+ Label label = new Label(composite, SWT.NONE);\r
+ label.setText("Min value");\r
+ GridDataFactory.fillDefaults().applyTo(label);\r
+ \r
+ minValue = new TrackedText(composite, support, SWT.BORDER);\r
+ minValue.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.Interval_minValue));\r
+ minValue.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.Interval_minValue));\r
+ minValue.setInputValidator(new DoubleValidator(false));\r
+ minValue.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), minValue.getWidget())));\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(minValue.getWidget());\r
+\r
+ // maxValue\r
+ label = new Label(composite, SWT.NONE);\r
+ label.setText("Max value");\r
+ GridDataFactory.fillDefaults().applyTo(label);\r
+ \r
+ maxValue = new TrackedText(composite, support, SWT.BORDER);\r
+ maxValue.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.Interval_maxValue));\r
+ maxValue.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.Interval_maxValue));\r
+ maxValue.setInputValidator(new DoubleValidator(false));\r
+ maxValue.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), maxValue.getWidget())));\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(maxValue.getWidget());\r
+ \r
+ return composite;\r
+ }\r
+ \r
+\r
+ @Override\r
+ public void getCachedValues(HashMap<String, String> cahcedValues) {\r
+ if(!minValue.isDisposed())\r
+ cahcedValues.put(SensitivityDistributionKeys.MIN, minValue.getText());\r
+ if(!maxValue.isDisposed())\r
+ cahcedValues.put(SensitivityDistributionKeys.MAX, maxValue.getText());\r
+ }\r
+\r
+\r
+\r
+ @Override\r
+ public void applyCache(WriteGraph graph, HashMap<String, String> cachedValues) throws DatabaseException {\r
+ if(resource == null)\r
+ return;\r
+ \r
+ SysdynResource SR = SysdynResource.getInstance(graph);\r
+ \r
+ String min = cachedValues.get(SensitivityDistributionKeys.MIN);\r
+ if(min != null) {\r
+ try {\r
+ Double d = Double.parseDouble(min);\r
+ graph.claimLiteral(resource, SR.Interval_minValue, d, Bindings.DOUBLE);\r
+ } catch (NumberFormatException e) {}\r
+ }\r
+ \r
+ String max = cachedValues.get(SensitivityDistributionKeys.MAX);\r
+ if(max != null) {\r
+ try {\r
+ Double d = Double.parseDouble(max);\r
+ graph.claimLiteral(resource, SR.Interval_maxValue, d, Bindings.DOUBLE);\r
+ } catch (NumberFormatException e) {}\r
+ }\r
+ }\r
+\r
+\r
+\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2013 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * Semantum Oy - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.properties.widgets.sensitivity;\r
+\r
+import java.util.HashMap;\r
+\r
+import org.eclipse.jface.layout.GridDataFactory;\r
+import org.eclipse.jface.layout.GridLayoutFactory;\r
+import org.eclipse.jface.resource.JFaceResources;\r
+import org.eclipse.jface.resource.LocalResourceManager;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Label;\r
+import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
+import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.management.ISessionContext;\r
+import org.simantics.jfreechart.chart.properties.DoubleValidator;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.ui.properties.SysdynBasicColorProvider;\r
+import org.simantics.sysdyn.ui.properties.widgets.factories.DoublePropertyFactory;\r
+import org.simantics.sysdyn.ui.properties.widgets.factories.DoublePropertyModifier;\r
+\r
+public class NormalDistributionProperties implements IDistributionProperties {\r
+\r
+ private TrackedText minValue; \r
+ private TrackedText maxValue;\r
+ private TrackedText mean;\r
+ private TrackedText stdDeviation;\r
+ private Resource resource;\r
+ \r
+ public NormalDistributionProperties(Resource resource) {\r
+ this.resource = resource;\r
+ }\r
+ \r
+ @Override\r
+ public Composite createContent(Composite parent, ISessionContext context, WidgetSupport support) {\r
+ Composite composite = new Composite(parent, SWT.NONE);\r
+ GridLayoutFactory.fillDefaults().numColumns(2).applyTo(composite);\r
+ \r
+ // minValue\r
+ Label label = new Label(composite, SWT.NONE);\r
+ label.setText("Min value");\r
+ GridDataFactory.fillDefaults().applyTo(label);\r
+ \r
+ minValue = new TrackedText(composite, support, SWT.BORDER);\r
+ minValue.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.NormalDistribution_minValue));\r
+ minValue.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.NormalDistribution_minValue));\r
+ minValue.setInputValidator(new DoubleValidator(true));\r
+ minValue.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), minValue.getWidget())));\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(minValue.getWidget());\r
+\r
+ // maxValue\r
+ label = new Label(composite, SWT.NONE);\r
+ label.setText("Max value");\r
+ GridDataFactory.fillDefaults().applyTo(label);\r
+ \r
+ maxValue = new TrackedText(composite, support, SWT.BORDER);\r
+ maxValue.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.NormalDistribution_maxValue));\r
+ maxValue.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.NormalDistribution_maxValue));\r
+ maxValue.setInputValidator(new DoubleValidator(true));\r
+ maxValue.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), maxValue.getWidget())));\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(maxValue.getWidget());\r
+ \r
+ // mean\r
+ label = new Label(composite, SWT.NONE);\r
+ label.setText("Mean");\r
+ GridDataFactory.fillDefaults().applyTo(label);\r
+ \r
+ mean = new TrackedText(composite, support, SWT.BORDER);\r
+ mean.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.NormalDistribution_mean));\r
+ mean.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.NormalDistribution_mean));\r
+ mean.setInputValidator(new DoubleValidator(true));\r
+ mean.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), mean.getWidget())));\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(mean.getWidget());\r
+ \r
+ // stdDeviation\r
+ label = new Label(composite, SWT.NONE);\r
+ label.setText("Standard deviation");\r
+ GridDataFactory.fillDefaults().applyTo(label);\r
+ \r
+ stdDeviation = new TrackedText(composite, support, SWT.BORDER);\r
+ stdDeviation.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.NormalDistribution_stdDeviation));\r
+ stdDeviation.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.NormalDistribution_stdDeviation));\r
+ stdDeviation.setInputValidator(new DoubleValidator(true));\r
+ stdDeviation.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), stdDeviation.getWidget())));\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(stdDeviation.getWidget());\r
+ \r
+ return composite;\r
+ }\r
+\r
+ @Override\r
+ public void getCachedValues(HashMap<String, String> cahcedValues) {\r
+ if(!minValue.isDisposed())\r
+ cahcedValues.put(SensitivityDistributionKeys.MIN, minValue.getText());\r
+ if(!maxValue.isDisposed())\r
+ cahcedValues.put(SensitivityDistributionKeys.MAX, maxValue.getText());\r
+ if(!mean.isDisposed())\r
+ cahcedValues.put(SensitivityDistributionKeys.MEAN, mean.getText());\r
+ if(!stdDeviation.isDisposed())\r
+ cahcedValues.put(SensitivityDistributionKeys.STD_DEVIATION, stdDeviation.getText());\r
+ }\r
+\r
+\r
+\r
+ @Override\r
+ public void applyCache(WriteGraph graph, HashMap<String, String> cachedValues) throws DatabaseException {\r
+ if(resource == null)\r
+ return;\r
+ \r
+ SysdynResource SR = SysdynResource.getInstance(graph);\r
+ \r
+ String min = cachedValues.get(SensitivityDistributionKeys.MIN);\r
+ if(min != null) {\r
+ try {\r
+ Double d = Double.parseDouble(min);\r
+ graph.claimLiteral(resource, SR.NormalDistribution_minValue, d, Bindings.DOUBLE);\r
+ } catch (NumberFormatException e) {}\r
+ }\r
+ \r
+ String max = cachedValues.get(SensitivityDistributionKeys.MAX);\r
+ if(max != null) {\r
+ try {\r
+ Double d = Double.parseDouble(max);\r
+ graph.claimLiteral(resource, SR.NormalDistribution_maxValue, d, Bindings.DOUBLE);\r
+ } catch (NumberFormatException e) {}\r
+ }\r
+ \r
+ String mean = cachedValues.get(SensitivityDistributionKeys.MEAN);\r
+ if(mean != null) {\r
+ try {\r
+ Double d = Double.parseDouble(mean);\r
+ graph.claimLiteral(resource, SR.NormalDistribution_mean, d, Bindings.DOUBLE);\r
+ } catch (NumberFormatException e) {}\r
+ }\r
+ \r
+ String stdDeviation = cachedValues.get(SensitivityDistributionKeys.STD_DEVIATION);\r
+ if(stdDeviation != null) {\r
+ try {\r
+ Double d = Double.parseDouble(stdDeviation);\r
+ graph.claimLiteral(resource, SR.NormalDistribution_stdDeviation, d, Bindings.DOUBLE);\r
+ } catch (NumberFormatException e) {}\r
+ }\r
+ }\r
+\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2013 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * Semantum Oy - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.properties.widgets.sensitivity;\r
+\r
+import java.util.Collection;\r
+import java.util.Collections;\r
+\r
+import org.simantics.browsing.ui.model.children.ChildRule;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.common.utils.ListUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.sysdyn.SysdynResource;\r
+\r
+public class ParameterChildRule implements ChildRule {\r
+\r
+ @Override\r
+ public boolean isCompatible(Class<?> contentType) {\r
+ return contentType.equals(Resource.class);\r
+ }\r
+\r
+ @Override\r
+ public Collection<?> getChildren(ReadGraph graph, Object parent) throws DatabaseException {\r
+ SysdynResource SR = SysdynResource.getInstance(graph);\r
+ \r
+ Resource experiment = (Resource) parent;\r
+ Resource parameterList = graph.getPossibleObject(experiment, SR.SensitivityAnalysisExperiment_parameterList);\r
+ \r
+ if(parameterList != null)\r
+ return ListUtils.toList(graph, parameterList);\r
+ else\r
+ return Collections.emptyList();\r
+ }\r
+\r
+ @Override\r
+ public Collection<?> getParents(ReadGraph graph, Object child) throws DatabaseException {\r
+ return Collections.emptyList();\r
+ }\r
+\r
+\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2013 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * Semantum Oy - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.properties.widgets.sensitivity;\r
+\r
+import java.util.HashMap;\r
+import java.util.Map;\r
+\r
+import org.simantics.browsing.ui.common.ColumnKeys;\r
+import org.simantics.browsing.ui.model.labels.LabelRule;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.sysdyn.SysdynResource;\r
+\r
+public class ParameterLabelRule implements LabelRule {\r
+\r
+ @Override\r
+ public boolean isCompatible(Class<?> contentType) {\r
+ return contentType.equals(Resource.class);\r
+ }\r
+\r
+ @Override\r
+ public Map<String, String> getLabel(ReadGraph graph, Object content) throws DatabaseException {\r
+ HashMap<String, String> result = new HashMap<String, String>();\r
+ \r
+ String variable = graph.getPossibleRelatedValue((Resource)content, SysdynResource.getInstance(graph).SensitivityAnalysisExperiment_Parameter_variable);\r
+ Integer n = graph.getPossibleRelatedValue((Resource)content, SysdynResource.getInstance(graph).SensitivityAnalysisExperiment_Parameter_numberOfValues);\r
+ \r
+ StringBuilder sb = new StringBuilder();\r
+ \r
+ if(variable != null)\r
+ sb.append(variable);\r
+ else\r
+ sb.append("No variable");\r
+ \r
+ sb.append(" (n=");\r
+ \r
+ if(n != null)\r
+ sb.append(n);\r
+ else\r
+ sb.append("undefined");\r
+ \r
+ sb.append(")");\r
+ \r
+ result.put(ColumnKeys.SINGLE, sb.toString()) ;\r
+ \r
+ return result;\r
+ }\r
+\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2013 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * Semantum Oy - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.properties.widgets.sensitivity;\r
+\r
+public class ParameterProposalProvider {\r
+\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2013 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * Semantum Oy - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.properties.widgets.sensitivity;\r
+\r
+public class SensitivityDistributionKeys {\r
+ \r
+ public static String MAX = "MAX";\r
+ public static String MIN = "MIN";\r
+ public static String STD_DEVIATION = "STD_DEVIATION";\r
+ public static String MEAN = "MEAN";\r
+\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2013 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * Semantum Oy - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.properties.widgets.sensitivity;\r
+\r
+import java.util.Map;\r
+\r
+import org.simantics.browsing.ui.swt.widgets.impl.ReadFactoryImpl;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.ui.trend.SysdynRangeHandlerFactory;\r
+\r
+public class SensitivityRangeHandlerFactory extends SysdynRangeHandlerFactory {\r
+\r
+ @Override\r
+ protected Resource getRVIRelation(ReadGraph graph) {\r
+ return SysdynResource.getInstance(graph).SensitivityAnalysisExperiment_Parameter_variable;\r
+ }\r
+ \r
+ @Override\r
+ public ReadFactoryImpl<Resource, Map<String, Object>> getRangeItemFactory(int index, Resource res) {\r
+ return new RangeItemFactory(index, res, false);\r
+ }\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2013 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * Semantum Oy - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.properties.widgets.sensitivity;\r
+\r
+import java.util.HashMap;\r
+\r
+import org.eclipse.jface.layout.GridDataFactory;\r
+import org.eclipse.jface.layout.GridLayoutFactory;\r
+import org.eclipse.jface.resource.JFaceResources;\r
+import org.eclipse.jface.resource.LocalResourceManager;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Label;\r
+import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
+import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.management.ISessionContext;\r
+import org.simantics.jfreechart.chart.properties.DoubleValidator;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.ui.properties.SysdynBasicColorProvider;\r
+import org.simantics.sysdyn.ui.properties.widgets.factories.DoublePropertyFactory;\r
+import org.simantics.sysdyn.ui.properties.widgets.factories.DoublePropertyModifier;\r
+\r
+public class UniformDistributionProperties implements IDistributionProperties{\r
+\r
+ private TrackedText minValue; \r
+ private TrackedText maxValue;\r
+ private Resource resource;\r
+ \r
+ public UniformDistributionProperties(Resource resource) {\r
+ this.resource = resource;\r
+ }\r
+ \r
+ @Override\r
+ public Composite createContent(Composite parent, ISessionContext context, WidgetSupport support) {\r
+ Composite composite = new Composite(parent, SWT.NONE);\r
+ GridLayoutFactory.fillDefaults().numColumns(2).applyTo(composite);\r
+ \r
+ // minValue\r
+ Label label = new Label(composite, SWT.NONE);\r
+ label.setText("Min value");\r
+ GridDataFactory.fillDefaults().applyTo(label);\r
+ \r
+ minValue = new TrackedText(composite, support, SWT.BORDER);\r
+ minValue.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.UniformDistribution_minValue));\r
+ minValue.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.UniformDistribution_minValue));\r
+ minValue.setInputValidator(new DoubleValidator(false));\r
+ minValue.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), minValue.getWidget())));\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(minValue.getWidget());\r
+\r
+ // maxValue\r
+ label = new Label(composite, SWT.NONE);\r
+ label.setText("Max value");\r
+ GridDataFactory.fillDefaults().applyTo(label);\r
+ \r
+ maxValue = new TrackedText(composite, support, SWT.BORDER);\r
+ maxValue.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.UniformDistribution_maxValue));\r
+ maxValue.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.UniformDistribution_maxValue));\r
+ maxValue.setInputValidator(new DoubleValidator(false));\r
+ maxValue.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), maxValue.getWidget())));\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(maxValue.getWidget());\r
+ \r
+ return composite;\r
+ }\r
+\r
+ @Override\r
+ public void getCachedValues(HashMap<String, String> cahcedValues) {\r
+ cahcedValues.put(SensitivityDistributionKeys.MIN, minValue.getText());\r
+ cahcedValues.put(SensitivityDistributionKeys.MAX, maxValue.getText());\r
+ }\r
+\r
+\r
+\r
+ @Override\r
+ public void applyCache(WriteGraph graph, HashMap<String, String> cachedValues) throws DatabaseException {\r
+ if(resource == null)\r
+ return;\r
+ \r
+ SysdynResource SR = SysdynResource.getInstance(graph);\r
+ \r
+ String min = cachedValues.get(SensitivityDistributionKeys.MIN);\r
+ if(min != null) {\r
+ try {\r
+ Double d = Double.parseDouble(min);\r
+ graph.claimLiteral(resource, SR.UniformDistribution_minValue, d, Bindings.DOUBLE);\r
+ } catch (NumberFormatException e) {}\r
+ }\r
+ \r
+ String max = cachedValues.get(SensitivityDistributionKeys.MAX);\r
+ if(max != null) {\r
+ try {\r
+ Double d = Double.parseDouble(max);\r
+ graph.claimLiteral(resource, SR.UniformDistribution_maxValue, d, Bindings.DOUBLE);\r
+ } catch (NumberFormatException e) {}\r
+ }\r
+ }\r
+\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2013 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * Semantum Oy - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.properties.widgets.sensitivity;\r
+\r
+import org.eclipse.jface.bindings.keys.KeyStroke;\r
+import org.eclipse.jface.bindings.keys.ParseException;\r
+import org.eclipse.jface.fieldassist.ContentProposalAdapter;\r
+import org.eclipse.jface.fieldassist.IContentProposal;\r
+import org.eclipse.jface.fieldassist.IContentProposalListener;\r
+import org.eclipse.jface.fieldassist.IContentProposalListener2;\r
+import org.eclipse.jface.fieldassist.TextContentAdapter;\r
+import org.eclipse.swt.widgets.Control;\r
+import org.simantics.browsing.ui.swt.widgets.impl.TextModifyListenerImpl;\r
+import org.simantics.browsing.ui.swt.widgets.impl.TrackedModifyEvent;\r
+import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.jfreechart.chart.properties.VariableProposalProvider;\r
+\r
+public class VariableNameModifier extends TextModifyListenerImpl<Resource> {\r
+\r
+ private boolean active;\r
+ private Control control;\r
+ private String variableNameRelationUri;\r
+ private String indexUri;\r
+ \r
+ private char[] alphaNumericCharacters = {\r
+ 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','å','ä','ö',\r
+ 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','Å','Ä','Ö',\r
+ '1','2','3','4','5','6','7','8','9','0','.','_'};\r
+ \r
+ \r
+ public VariableNameModifier(Control control, WidgetSupport support, String variableNameRelationUri, String indexUri) {\r
+ this.variableNameRelationUri = variableNameRelationUri;\r
+ this.indexUri = indexUri;\r
+ \r
+ this.control = control;\r
+ this.active = true;\r
+ \r
+ KeyStroke keyStroke = null;\r
+ try {\r
+ keyStroke = KeyStroke.getInstance("Ctrl+Space");\r
+ } catch (ParseException e1) {\r
+ e1.printStackTrace();\r
+ }\r
+ \r
+ //SimpleContentProposalProvider scpp = new VariableProposalProvider(control, support);\r
+ VariableProposalProvider scpp = new VariableProposalProvider(control, support);\r
+ scpp.setFiltering(true);\r
+\r
+ ContentProposalAdapter adapter = new ContentProposalAdapter(\r
+ control, new TextContentAdapter(), scpp, keyStroke, alphaNumericCharacters);\r
+ adapter.setAutoActivationDelay(0);\r
+ adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);\r
+ adapter.addContentProposalListener(new IContentProposalListener2() {\r
+\r
+ @Override\r
+ public void proposalPopupOpened(ContentProposalAdapter adapter) {\r
+ if(VariableNameModifier.this != null)\r
+ VariableNameModifier.this.deactivate();\r
+ }\r
+\r
+ @Override\r
+ public void proposalPopupClosed(ContentProposalAdapter adapter) {\r
+ if(VariableNameModifier.this != null)\r
+ VariableNameModifier.this.activate();\r
+ }\r
+ });\r
+\r
+ adapter.addContentProposalListener(new IContentProposalListener() {\r
+\r
+ @Override\r
+ public void proposalAccepted(IContentProposal proposal) {\r
+ if(VariableNameModifier.this.control != null && !VariableNameModifier.this.control.isDisposed())\r
+ VariableNameModifier.this.modifyText(new TrackedModifyEvent(VariableNameModifier.this.control, proposal.getContent()));\r
+ }\r
+ });\r
+ \r
+ \r
+ }\r
+ \r
+\r
+ @Override\r
+ public void applyText(WriteGraph graph, Resource resource, String text) throws DatabaseException {\r
+ if(active) {\r
+ graph.claimLiteral(resource, getVariableNameRelation(graph), text, Bindings.STRING);\r
+ graph.deny(resource, getIndexRelation(graph));\r
+ } else {\r
+ System.out.println("NÄHÄÄ");\r
+ }\r
+ }\r
+ \r
+ private Resource getVariableNameRelation(ReadGraph graph) throws DatabaseException {\r
+ return graph.getResource(variableNameRelationUri);\r
+ }\r
+ \r
+ private Resource getIndexRelation(ReadGraph graph) throws DatabaseException {\r
+ return graph.getResource(indexUri);\r
+ }\r
+\r
+ public void deactivate() {\r
+ active = false;\r
+ }\r
+\r
+ public void activate() {\r
+ active = true;\r
+ }\r
+\r
+}\r
public void apply(WriteGraph graph, Resource series) throws DatabaseException {\r
SysdynResource SR = SysdynResource.getInstance(graph);\r
Resource dataset = graph.getPossibleObject(series, Layer0.getInstance(graph).PartOf);\r
- if(dataset != null)\r
+ if(dataset == null)\r
return;\r
\r
Boolean result = graph.getPossibleRelatedValue(dataset, SR.Charts_SensitivityDataset_median, Bindings.BOOLEAN);\r
import org.simantics.utils.datastructures.Quad;\r
\r
public class SysdynRangeHandlerFactory implements RangeHandlerFactory {\r
+ \r
+ protected Resource getRVIRelation(ReadGraph graph) {\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+ return jfree.variableRVI;\r
+ }\r
\r
@Override\r
public Read<LinkedHashMap<String, Resource>> getRequest(final Resource series) {\r
\r
@Override\r
public LinkedHashMap<String, Resource> perform(ReadGraph graph) throws DatabaseException {\r
- JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
SysdynResource sr = SysdynResource.getInstance(graph);\r
\r
String realizationURI = ChartUtils.getCurrentRealizationURI(graph, series);\r
- String rvi = graph.getPossibleRelatedValue(series, jfree.variableRVI);\r
+ String rvi = graph.getPossibleRelatedValue(series, getRVIRelation(graph));\r
if(rvi == null)\r
return null;\r
\r
+ rvi = rvi.replace(".", "/");\r
+ \r
+ if(!rvi.startsWith("/"))\r
+ rvi = "/" + rvi;\r
+ \r
try {\r
// Find the variable for the current variableRVI\r
Variable v = Variables.getVariable(graph, realizationURI + rvi.trim());\r
* @author Teemu Lempinen\r
*\r
*/\r
- private class RangeItemFactory extends ReadFactoryImpl<Resource, Map<String, Object>> {\r
+ public class RangeItemFactory extends ReadFactoryImpl<Resource, Map<String, Object>> {\r
\r
private int index;\r
private Resource enumeration;\r
+ private boolean addCollections;\r
\r
+ \r
/**\r
* \r
* @param index Index of the enumeration in the variable\r
* @param enumeration The enumeration\r
*/\r
public RangeItemFactory(int index, Resource enumeration) {\r
+ this(index, enumeration, true);\r
+ }\r
+ \r
+ /**\r
+ * \r
+ * @param index Index of the enumeration in the variable\r
+ * @param enumeration The enumeration\r
+ * @param addCollections add "Sum" and "All"\r
+ */\r
+ public RangeItemFactory(int index, Resource enumeration, boolean addCollections) {\r
this.index = index;\r
this.enumeration = enumeration;\r
+ this.addCollections = addCollections;\r
}\r
\r
public Object getIdentity(Object inputContents) {\r
LinkedHashMap<String, Object> result = new LinkedHashMap<String, Object>();\r
Resource enumerationIndexes = graph.getPossibleObject(enumeration, sr.Enumeration_enumerationIndexList);\r
List<Resource> indexes = ListUtils.toList(graph, enumerationIndexes);\r
- // First add "All" and "Sum", then all of the enumeration indexes in order\r
- result.put("All", "All");\r
- result.put("Sum", "Sum");\r
+ if(addCollections) {\r
+ // First add "All" and "Sum", then all of the enumeration indexes in order\r
+ result.put("All", "All");\r
+ result.put("Sum", "Sum");\r
+ }\r
for(Resource index : indexes) {\r
String name = NameUtils.getSafeName(graph, index);\r
result.put(name, name);\r
}\r
+ \r
return result;\r
}\r
}\r
</type>\r
</target>\r
\r
+ <target\r
+ interface="org.simantics.sysdyn.adapter.distribution.IDistribution">\r
+ <type\r
+ uri="http://www.simantics.org/Sysdyn-0.0/NormalDistribution"\r
+ class="org.simantics.sysdyn.adapter.distribution.NormalDistribution">\r
+ <graph/> \r
+ <this />\r
+ </type>\r
+ <type\r
+ uri="http://www.simantics.org/Sysdyn-0.0/UniformDistribution"\r
+ class="org.simantics.sysdyn.adapter.distribution.UniformDistribution">\r
+ <graph/> \r
+ <this />\r
+ </type> \r
+ <type\r
+ uri="http://www.simantics.org/Sysdyn-0.0/Interval"\r
+ class="org.simantics.sysdyn.adapter.distribution.Interval">\r
+ <graph/> \r
+ <this />\r
+ </type>\r
+ </target>\r
+ \r
+ <target\r
+ interface="org.simantics.sysdyn.adapter.SensitivityExperimentParameter">\r
+ <type\r
+ uri="http://www.simantics.org/Sysdyn-0.0/SensitivityAnalysisExperiment/Parameter"\r
+ class="org.simantics.sysdyn.adapter.SensitivityExperimentParameter">\r
+ <graph/> \r
+ <this />\r
+ </type>\r
+ </target> \r
+ \r
<!-- <target interface="org.simantics.db.layer0.variable.Variable">\r
<type uri="http://www.simantics.org/Sysdyn-0.0/Configuration"\r
class="org.simantics.sysdyn.adapter.ConfigurationVariable" >\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2013 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * Semantum Oy - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.adapter;\r
+\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.request.PossibleModel;\r
+import org.simantics.simulation.ontology.SimulationResource;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.adapter.distribution.IDistribution;\r
+import org.simantics.sysdyn.manager.SysdynModel;\r
+import org.simantics.sysdyn.manager.SysdynModelManager;\r
+import org.simantics.sysdyn.representation.Enumeration;\r
+import org.simantics.sysdyn.representation.Variable;\r
+import org.simantics.sysdyn.representation.utils.IndexUtils;\r
+import org.simantics.sysdyn.representation.utils.RepresentationUtils;\r
+\r
+public class SensitivityExperimentParameter {\r
+ \r
+ private String variableName;\r
+ private String[] indexes;\r
+ private String fullName;\r
+ private IDistribution distribution;\r
+ \r
+ public SensitivityExperimentParameter(ReadGraph graph, Resource parameter) {\r
+ \r
+ try {\r
+ SysdynResource SR = SysdynResource.getInstance(graph);\r
+ Resource distributionResource = graph.getPossibleObject(parameter, SR.SensitivityAnalysisExperiment_Parameter_propabilityDistribution);\r
+ distribution = graph.adapt(distributionResource, IDistribution.class);\r
+ variableName = graph.getPossibleRelatedValue(parameter, SR.SensitivityAnalysisExperiment_Parameter_variable, Bindings.STRING);\r
+ indexes = graph.getPossibleRelatedValue(parameter, SR.SensitivityAnalysisExperiment_Parameter_indexes, Bindings.STRING_ARRAY);\r
+ \r
+ Resource model = graph.syncRequest(new PossibleModel(parameter));\r
+ SysdynModelManager smm = SysdynModelManager.getInstance(graph.getSession());\r
+ SysdynModel sm = smm.getModel(graph, graph.getPossibleObject(model, SimulationResource.getInstance(graph).HasConfiguration));\r
+ \r
+ Variable variable = RepresentationUtils.getVariable(sm.getConfiguration(), variableName);\r
+ \r
+ if(indexes == null && (variable.getArrayIndexes() != null & variable.getArrayIndexes().size() > 0)) {\r
+ indexes = new String[variable.getArrayIndexes().size()];\r
+ \r
+ for(int i = 0; i < variable.getArrayIndexes().size(); i++) {\r
+ Enumeration e = variable.getArrayIndexes().get(i);\r
+ indexes[i] = e.getEnumerationIndexes().get(0).getName();\r
+ }\r
+ }\r
+ \r
+ if(indexes != null) {\r
+ StringBuilder sb = new StringBuilder();\r
+ sb.append("[");\r
+ for(int i = 0; i < indexes.length; i++) {\r
+ if(i > 0)\r
+ sb.append(",");\r
+\r
+ String index = indexes[i];\r
+ sb.append(index);\r
+ }\r
+ sb.append("]");\r
+ String result = IndexUtils.rangeToIndexes(variable, sb.toString());\r
+ fullName = variableName + result;\r
+ } else {\r
+ fullName = variableName;\r
+ }\r
+ } catch (DatabaseException e) {\r
+\r
+ }\r
+ }\r
+\r
+ public String getVariableName() {\r
+ return variableName;\r
+ }\r
+ \r
+ \r
+\r
+ public String[] getIndexes() {\r
+ return indexes;\r
+ }\r
+\r
+ public String getFullName() {\r
+ return fullName;\r
+ }\r
+\r
+ public IDistribution getDistribution() {\r
+ return distribution;\r
+ }\r
+ \r
+ \r
+\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2013 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * Semantum Oy - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.adapter.distribution;\r
+\r
+public interface IDistribution {\r
+ \r
+ /**\r
+ * Return next value of the distribution\r
+ * @return\r
+ */\r
+ public double next();\r
+ \r
+ /**\r
+ * \r
+ * @return does the distribution have next value;\r
+ */\r
+ public boolean hasNext();\r
+ \r
+ /**\r
+ * Initialize distribution\r
+ */\r
+ public void initialize();\r
+\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2013 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * Semantum Oy - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.adapter.distribution;\r
+\r
+import java.util.Random;\r
+\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.sysdyn.SysdynResource;\r
+\r
+public class Interval implements IDistribution {\r
+ \r
+ private Random random;\r
+ \r
+ private double min = 0;\r
+ private double max = 10;\r
+ private double intervalLength = 1;\r
+ private int numberOfValues = 10;\r
+ private int seed = 123;\r
+ private int index = 0;\r
+ \r
+ public Interval(ReadGraph graph, Resource distribution) {\r
+\r
+ try {\r
+ SysdynResource SR = SysdynResource.getInstance(graph);\r
+\r
+ Double minValue = graph.getPossibleRelatedValue(distribution, SR.Interval_minValue, Bindings.DOUBLE);\r
+ if(minValue != null)\r
+ this.min = minValue;\r
+ \r
+ Double maxValue = graph.getPossibleRelatedValue(distribution, SR.Interval_maxValue, Bindings.DOUBLE);\r
+ if(maxValue != null)\r
+ this.max = maxValue;\r
+ \r
+ \r
+ Resource parameter = graph.getPossibleObject(distribution, SR.SensitivityAnalysisExperiment_Parameter_propabilityDistribution_Inverse);\r
+\r
+ Integer numberOfValues = graph.getPossibleRelatedValue(parameter, SR.SensitivityAnalysisExperiment_Parameter_numberOfValues, Bindings.INTEGER);\r
+ if(numberOfValues != null)\r
+ this.numberOfValues = numberOfValues;\r
+ \r
+ intervalLength = (maxValue - minValue) / (this.numberOfValues - 1);\r
+ \r
+ Resource experiment = graph.getPossibleObject(parameter, Layer0.getInstance(graph).PartOf);\r
+\r
+ Integer seed = graph.getPossibleRelatedValue(experiment, SR.SensitivityAnalysisExperiment_randomSeed, Bindings.INTEGER);\r
+ if(seed != null)\r
+ this.seed = seed;\r
+ \r
+ } catch (DatabaseException e) {\r
+\r
+ }\r
+ \r
+ initialize();\r
+ }\r
+ \r
+ @Override\r
+ public double next() {\r
+ double value = min + (intervalLength * index);\r
+ index++;\r
+ return value;\r
+ }\r
+\r
+ public Random getRandom() {\r
+ return random;\r
+ }\r
+\r
+ public double getMin() {\r
+ return min;\r
+ }\r
+\r
+ public double getMax() {\r
+ return max;\r
+ }\r
+\r
+ public int getNumberOfValues() {\r
+ return numberOfValues;\r
+ }\r
+\r
+ public int getSeed() {\r
+ return seed;\r
+ }\r
+ \r
+ public double getIntervalLength() {\r
+ return intervalLength;\r
+ }\r
+\r
+ @Override\r
+ public void initialize() {\r
+ random = new Random(this.seed);\r
+ index = 0;\r
+ }\r
+\r
+ @Override\r
+ public boolean hasNext() {\r
+ return index < numberOfValues;\r
+ }\r
+ \r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2013 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * Semantum Oy - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.adapter.distribution;\r
+\r
+\r
+import java.util.Random;\r
+\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.sysdyn.SysdynResource;\r
+\r
+public class NormalDistribution implements IDistribution {\r
+ \r
+ private Random random;\r
+ \r
+ private Double min = null;\r
+ private Double max = null;\r
+ private double mean;\r
+ private double stdDeviation; \r
+ private int numberOfValues = 10;\r
+ private int seed = 123;\r
+ private int index = 0;\r
+ \r
+ private static int MAX_TRIES = 100;\r
+\r
+ \r
+ public NormalDistribution(ReadGraph graph, Resource distribution) {\r
+\r
+ try {\r
+ SysdynResource SR = SysdynResource.getInstance(graph);\r
+\r
+ min = graph.getPossibleRelatedValue(distribution, SR.NormalDistribution_minValue, Bindings.DOUBLE);\r
+ max = graph.getPossibleRelatedValue(distribution, SR.NormalDistribution_maxValue, Bindings.DOUBLE);\r
+ stdDeviation = graph.getPossibleRelatedValue(distribution, SR.NormalDistribution_stdDeviation, Bindings.DOUBLE);\r
+ mean = graph.getPossibleRelatedValue(distribution, SR.NormalDistribution_mean, Bindings.DOUBLE);\r
+ \r
+ \r
+ Resource parameter = graph.getPossibleObject(distribution, SR.SensitivityAnalysisExperiment_Parameter_propabilityDistribution_Inverse);\r
+\r
+ Integer numberOfValues = graph.getPossibleRelatedValue(parameter, SR.SensitivityAnalysisExperiment_Parameter_numberOfValues, Bindings.INTEGER);\r
+ if(numberOfValues != null)\r
+ this.numberOfValues = numberOfValues;\r
+ \r
+\r
+ \r
+ Resource experiment = graph.getPossibleObject(parameter, Layer0.getInstance(graph).PartOf);\r
+\r
+ Integer seed = graph.getPossibleRelatedValue(experiment, SR.SensitivityAnalysisExperiment_randomSeed, Bindings.INTEGER);\r
+ if(seed != null)\r
+ this.seed = seed;\r
+ \r
+ \r
+ random = new Random(this.seed);\r
+ \r
+ } catch (DatabaseException e) {\r
+\r
+ }\r
+ }\r
+ \r
+ @Override\r
+ public double next() {\r
+\r
+ /* Try to find value between min and max, if they are defined.\r
+ * If value cannot be found after MAX_TRIES number of tries,\r
+ * return the last try. \r
+ */\r
+ double value = 0;\r
+ for(int i = 0; i < MAX_TRIES; i++) {\r
+ value = random.nextGaussian() * stdDeviation + mean;\r
+ if(accept(value))\r
+ break;\r
+ }\r
+ \r
+ index++;\r
+ return value;\r
+ }\r
+ \r
+ \r
+ private boolean accept(double value) {\r
+ if(min != null) {\r
+ if(value < min)\r
+ return false;\r
+ }\r
+ \r
+ if(max != null) {\r
+ if(value > max)\r
+ return false;\r
+ }\r
+ \r
+ return true;\r
+ }\r
+ \r
+ public Random getRandom() {\r
+ return random;\r
+ }\r
+\r
+ public double getMin() {\r
+ return min;\r
+ }\r
+\r
+ public double getMax() {\r
+ return max;\r
+ }\r
+\r
+ public int getNumberOfValues() {\r
+ return numberOfValues;\r
+ }\r
+\r
+ public int getSeed() {\r
+ return seed;\r
+ }\r
+ \r
+\r
+ @Override\r
+ public void initialize() {\r
+ random = new Random(this.seed);\r
+ index = 0;\r
+ }\r
+\r
+ @Override\r
+ public boolean hasNext() {\r
+ return index < numberOfValues;\r
+ }\r
+\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2013 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * Semantum Oy - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.adapter.distribution;\r
+\r
+import java.util.Random;\r
+\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.sysdyn.SysdynResource;\r
+\r
+public class UniformDistribution implements IDistribution {\r
+ \r
+ \r
+ private Random random;\r
+ \r
+ private double min;\r
+ private double max;\r
+ private int numberOfValues = 10;\r
+ private int seed = 123;\r
+ private int index = 0;\r
+ \r
+ public UniformDistribution(ReadGraph graph, Resource distribution) {\r
+\r
+ try {\r
+ SysdynResource SR = SysdynResource.getInstance(graph);\r
+\r
+ Double minValue = graph.getPossibleRelatedValue(distribution, SR.UniformDistribution_minValue, Bindings.DOUBLE);\r
+ if(minValue != null)\r
+ this.min = minValue;\r
+ \r
+ Double maxValue = graph.getPossibleRelatedValue(distribution, SR.UniformDistribution_maxValue, Bindings.DOUBLE);\r
+ if(maxValue != null)\r
+ this.max = maxValue;\r
+ \r
+ \r
+ Resource parameter = graph.getPossibleObject(distribution, SR.SensitivityAnalysisExperiment_Parameter_propabilityDistribution_Inverse);\r
+\r
+ Integer numberOfValues = graph.getPossibleRelatedValue(parameter, SR.SensitivityAnalysisExperiment_Parameter_numberOfValues, Bindings.INTEGER);\r
+ if(numberOfValues != null)\r
+ this.numberOfValues = numberOfValues;\r
+ \r
+\r
+ \r
+ Resource experiment = graph.getPossibleObject(parameter, Layer0.getInstance(graph).PartOf);\r
+\r
+ Integer seed = graph.getPossibleRelatedValue(experiment, SR.SensitivityAnalysisExperiment_randomSeed, Bindings.INTEGER);\r
+ if(seed != null)\r
+ this.seed = seed;\r
+ \r
+ } catch (DatabaseException e) {\r
+\r
+ }\r
+ initialize();\r
+ }\r
+ \r
+ public Random getRandom() {\r
+ return random;\r
+ }\r
+\r
+ public double getMin() {\r
+ return min;\r
+ }\r
+\r
+ public double getMax() {\r
+ return max;\r
+ }\r
+\r
+ public int getNumberOfValues() {\r
+ return numberOfValues;\r
+ }\r
+\r
+ public int getSeed() {\r
+ return seed;\r
+ }\r
+ \r
+ \r
+\r
+ \r
+ @Override\r
+ public double next() {\r
+ index++;\r
+ double d = min + ((double)random.nextInt(101) / 100.0) * (max-min); \r
+ return d;\r
+ }\r
+ \r
+\r
+ @Override\r
+ public void initialize() {\r
+ random = new Random(this.seed);\r
+ index = 0;\r
+ }\r
+\r
+ @Override\r
+ public boolean hasNext() {\r
+ return index < numberOfValues;\r
+ }\r
+\r
+}\r
* @param structureChanged \r
* @throws IOException\r
*/\r
- protected void runModelica(SimulationLocation simulationLocation, String modelText, IModelicaMonitor monitor, IProgressMonitor progressMonitor, HashMap<String, String> experimentParameters, HashMap<String, String> changes) throws IOException {\r
+ protected void runModelica(SimulationLocation simulationLocation, IModelicaMonitor monitor, IProgressMonitor progressMonitor, HashMap<String, String> experimentParameters, HashMap<String, String> changes) throws IOException {\r
progressMonitor.subTask("Simulate model");\r
process = ModelicaManager.runModelica(\r
simulationLocation,\r
\r
if(simulationLocation != null && !canceled) {\r
// Simulate the model\r
- runModelica(simulationLocation, modelText, monitor, progressMonitor, experimentParameters, changes);\r
+ runModelica(simulationLocation, monitor, progressMonitor, experimentParameters, changes);\r
}\r
\r
if(canceled)\r
import java.util.ArrayList;\r
import java.util.Collection;\r
import java.util.HashMap;\r
-import java.util.Random;\r
-import java.util.concurrent.ScheduledExecutorService;\r
+import java.util.List;\r
\r
import org.eclipse.core.runtime.IProgressMonitor;\r
import org.simantics.databoard.Bindings;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
import org.simantics.db.common.request.ReadRequest;\r
+import org.simantics.db.common.utils.ListUtils;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.request.Read;\r
import org.simantics.modelica.IModelicaMonitor;\r
import org.simantics.modelica.data.MatSimulationResult;\r
import org.simantics.modelica.data.SimulationResult;\r
import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.adapter.SensitivityExperimentParameter;\r
\r
/**\r
* Sensitivity analysis experiment\r
*/\r
public class SysdynSensitivityAnalysisExperiment extends SysdynExperiment {\r
\r
- public enum Distribution {\r
- UNIFORM,\r
- NORMAL\r
- }\r
- \r
- private Distribution propabilityDistribution = DEFAULT_PROPABILITY_DISTRIBUTION;\r
- private double minValue = DEFAULT_MIN_VALUE;\r
- private double maxValue = DEFAULT_MAX_VALUE;\r
- private int numValues = DEFAULT_NUM_VALUES;\r
- private String variedParameter = "Auxiliary1";\r
- private double mean = DEFAULT_MEAN;\r
- public double stdDeviation = DEFAULT_STD_DEVIATION;\r
- \r
\r
- public static Distribution DEFAULT_PROPABILITY_DISTRIBUTION = Distribution.UNIFORM;\r
- public static double DEFAULT_MIN_VALUE = 1.0;\r
- public static double DEFAULT_MAX_VALUE = 3.0;\r
- public static int DEFAULT_NUM_VALUES = 3;\r
- public static double DEFAULT_MEAN = 0.0;\r
- public static double DEFAULT_STD_DEVIATION = 1.0;\r
\r
- ScheduledExecutorService playbackExecutionService;\r
private ArrayList<MemoryResult> results = null;\r
\r
public SysdynSensitivityAnalysisExperiment(Resource experiment, Resource model) {\r
super(experiment, model);\r
}\r
+ \r
+ \r
+ private void findValuesAndRun(List<SensitivityExperimentParameter> parameters, HashMap<String, String> values, HashMap<String, String> experimentParameters) {\r
+ findValuesAndRun(parameters, 0, values, experimentParameters);\r
+ }\r
+ \r
+ private void findValuesAndRun(List<SensitivityExperimentParameter> parameters, int index, HashMap<String, String> values, HashMap<String, String> experimentParameters) {\r
+ SensitivityExperimentParameter p = parameters.get(index);\r
+ \r
+ while(p.getDistribution().hasNext()) {\r
+ values.put(p.getFullName(), Double.toString(p.getDistribution().next()));\r
+ if((index + 1) < parameters.size()) {\r
+ findValuesAndRun(parameters, index + 1, values, experimentParameters);\r
+ } else {\r
+ // Run with values\r
+ runSensitivityRun(values, experimentParameters);\r
+ }\r
+ }\r
+ p.getDistribution().initialize();\r
+ }\r
+ \r
+ private void runSensitivityRun(HashMap<String, String> values, HashMap<String, String> experimentParameters) {\r
+ int indexOfDot = simulationLocation.resFile.toString().lastIndexOf('.');\r
+ if (indexOfDot > 1) {\r
+ String resFile = simulationLocation.resFile.toString();\r
+ String newResFile = resFile.substring(0, indexOfDot) + currentRun + resFile.substring(indexOfDot);\r
+ experimentParameters.put(ModelicaManager.RESULT_FILE_NAME, newResFile);\r
+ } \r
+ // Simulate the model for one parameter set\r
+ progressMonitor.subTask("Simulation iteration " + (currentRun+1) + "/" + numberOfRuns);\r
+\r
+ \r
+ try {\r
+ process = ModelicaManager.runModelica(\r
+ simulationLocation,\r
+ monitor,\r
+ experimentParameters, \r
+ values\r
+ );\r
+ } catch (IOException e) {\r
+ e.printStackTrace();\r
+ }\r
\r
+ ModelicaManager.printProcessOutput(process, monitor);\r
+\r
+ File resFile = new File(experimentParameters.get(ModelicaManager.RESULT_FILE_NAME));\r
+ Thread resultThread = getResultThread(resFile, experimentParameters, monitor, progressMonitor, currentRun % refreshRate == 0);\r
+ resultThread.run();\r
+\r
+ process = null;\r
+ \r
+ progressMonitor.worked(1);\r
+ currentRun++;\r
+\r
+ }\r
+ \r
+ private SimulationLocation simulationLocation;\r
+ private IModelicaMonitor monitor;\r
+ private IProgressMonitor progressMonitor;\r
+// private HashMap<String, String> experimentParameters;\r
+ private int numberOfRuns = 0;\r
+ private int currentRun = 0;\r
+ private int refreshRate = 1;\r
+ private List<SensitivityExperimentParameter> parameters = new ArrayList<SensitivityExperimentParameter>();\r
+ \r
@Override\r
- protected void runModelica(SimulationLocation simulationLocation, String modelText, IModelicaMonitor monitor, IProgressMonitor progressMonitor, HashMap<String, String> experimentParameters, HashMap<String, String> changes) throws IOException {\r
+ protected void runModelica(SimulationLocation simulationLocation, IModelicaMonitor monitor, IProgressMonitor progressMonitor, HashMap<String, String> experimentParameters, HashMap<String, String> changes) throws IOException {\r
results = null;\r
\r
- loadConfiguration();\r
+ this.simulationLocation = simulationLocation;\r
+ this.monitor = monitor;\r
+ this.progressMonitor = progressMonitor;\r
+ \r
if (changes == null) {\r
changes = new HashMap<String, String>();\r
}\r
\r
String version = ModelicaManager.getOMCVersion(simulationLocation.omcHome);\r
experimentParameters.put(ModelicaManager.OMC_VERSION, version);\r
-\r
- for (int i = 0; i < numValues; ++i) {\r
- progressMonitor.subTask("Simulation iteration " + (i+1));\r
-\r
- double value = 0;\r
-\r
- if (propabilityDistribution == Distribution.UNIFORM) {\r
- double intervalLength = (maxValue - minValue) / (numValues - 1);\r
- value = minValue + (intervalLength * i);\r
- } else if (propabilityDistribution == Distribution.NORMAL) {\r
- Random random = new Random();\r
- do {\r
- value = random.nextGaussian() * stdDeviation + mean;\r
- } while (mean > minValue && mean < maxValue && (value < minValue || value > maxValue));\r
- } else {\r
- break;\r
- }\r
-\r
- // TODO: What if changes already include similarly named variable?\r
- /* If the changes is altered, it affects also to the next simulation. So,\r
- * All the parameters that are to be altered need to be defined explicitly\r
- * before each new simulation. \r
- */\r
- changes.put(variedParameter, Double.toString(value));\r
-\r
-\r
- // Specify result file name\r
-\r
- int indexOfDot = simulationLocation.resFile.toString().lastIndexOf('.');\r
- if (indexOfDot > 1) {\r
- String resFile = simulationLocation.resFile.toString();\r
- String newResFile = resFile.substring(0, indexOfDot) + i + resFile.substring(indexOfDot);\r
- experimentParameters.put(ModelicaManager.RESULT_FILE_NAME, newResFile);\r
- } \r
- // Simulate the model for one parameter set\r
- runModelica(simulationLocation, modelText, monitor, progressMonitor, experimentParameters, changes, i);\r
- progressMonitor.worked(1);\r
- }\r
+ \r
+ \r
+ loadConfiguration();\r
+ \r
+ currentRun = 0;\r
+ \r
+ \r
+ findValuesAndRun(parameters, changes, experimentParameters);\r
}\r
\r
private void loadConfiguration(){\r
@Override\r
public void run(ReadGraph graph) throws DatabaseException {\r
\r
- SysdynResource sr = SysdynResource.getInstance(graph);\r
- maxValue = graph.getPossibleRelatedValue(experiment, sr.SensitivityAnalysisExperiment_maxValue, Bindings.DOUBLE);\r
- minValue = graph.getPossibleRelatedValue(experiment, sr.SensitivityAnalysisExperiment_minValue, Bindings.DOUBLE);\r
- numValues = graph.getPossibleRelatedValue(experiment, sr.SensitivityAnalysisExperiment_numValues, Bindings.INTEGER);\r
- variedParameter = graph.getPossibleRelatedValue(experiment, sr.SensitivityAnalysisExperiment_variedParameter, Bindings.STRING);\r
- String propabilityDistributionTemp = graph.getPossibleRelatedValue(experiment, sr.SensitivityAnalysisExperiment_propabilityDistribution, Bindings.STRING);\r
- if (propabilityDistributionTemp.equalsIgnoreCase("uniform"))\r
- propabilityDistribution = Distribution.UNIFORM;\r
- else if (propabilityDistributionTemp.equalsIgnoreCase("normal"))\r
- propabilityDistribution = Distribution.NORMAL;\r
- else\r
- propabilityDistribution = DEFAULT_PROPABILITY_DISTRIBUTION;\r
+ SysdynResource SR = SysdynResource.getInstance(graph);\r
\r
- mean = graph.getPossibleRelatedValue(experiment, sr.SensitivityAnalysisExperiment_mean, Bindings.DOUBLE);\r
- stdDeviation = graph.getPossibleRelatedValue(experiment, sr.SensitivityAnalysisExperiment_stdDeviation, Bindings.DOUBLE);\r
-\r
+ Integer rRate = graph.getPossibleRelatedValue(experiment, SR.SensitivityAnalysisExperiment_resultRefreshRate, Bindings.INTEGER);\r
+ if(rRate != null)\r
+ refreshRate = rRate;\r
+ \r
+ Resource parameterListResource = graph.getPossibleObject(experiment, SR.SensitivityAnalysisExperiment_parameterList);\r
+ List<Resource> parameterResources = ListUtils.toList(graph, parameterListResource);\r
+ \r
+ if(parameters != null) {\r
+ parameters.clear();\r
+ for(Resource p : parameterResources) {\r
+ SensitivityExperimentParameter parameter = graph.adapt(p, SensitivityExperimentParameter.class);\r
+ parameters.add(parameter);\r
+ }\r
+ }\r
}\r
});\r
} catch (DatabaseException e) {\r
}\r
}\r
\r
- protected void runModelica(SimulationLocation simulationLocation, \r
- String modelText, \r
- IModelicaMonitor monitor, \r
- IProgressMonitor progressMonitor, \r
- HashMap<String, String> experimentParameters, \r
- HashMap<String, String> changes, \r
- int resFileIndex) throws IOException {\r
- process = ModelicaManager.runModelica(\r
- simulationLocation,\r
- monitor,\r
- experimentParameters, \r
- changes\r
- );\r
-\r
- ModelicaManager.printProcessOutput(process, monitor);\r
-\r
- File resFile = new File(experimentParameters.get(ModelicaManager.RESULT_FILE_NAME));\r
- Thread resultThread = getResultThread(resFile, experimentParameters, monitor, progressMonitor);\r
- resultThread.run();\r
-\r
- process = null;\r
- }\r
- \r
/**\r
* Get a thread for reading and saving reuslts from a normal simulation\r
* @param simulationLocation\r
* @param inits\r
* @param monitor\r
* @param progressMonitor\r
- * @param resFileIndex \r
* @return\r
*/\r
protected Thread getResultThread(final File resFile, \r
final HashMap<String, String> experimentParameters, \r
final IModelicaMonitor monitor, \r
- final IProgressMonitor progressMonitor) {\r
+ final IProgressMonitor progressMonitor,\r
+ final boolean updateMonitors) {\r
return new Thread() {\r
@Override\r
public void run() {\r
currentResult.setResult(result);\r
currentResult.setResultFile(resFile);\r
\r
- resultsChanged();\r
+ if(updateMonitors)\r
+ resultsChanged();\r
\r
simulate(false);\r
\r
\r
@Override\r
public int numberOfSimulationRunSteps() {\r
- /*\r
- * From normal experiment:\r
- * 1. Write modelica files\r
- * 2. Write other simulation files\r
- * 3. Build model OR update parameters\r
- * \r
- * Sensitivity:\r
- * 4 - n. Number of iterations\r
- */\r
try {\r
Integer numberOfIterations = session.syncRequest(new Read<Integer>() {\r
@Override\r
public Integer perform(ReadGraph graph) throws DatabaseException {\r
- SysdynResource sr = SysdynResource.getInstance(graph);\r
- return graph.getPossibleRelatedValue(experiment, sr.SensitivityAnalysisExperiment_numValues, Bindings.INTEGER);\r
+ SysdynResource SR = SysdynResource.getInstance(graph);\r
+ \r
+ Resource parameterListResource = graph.getPossibleObject(experiment, SR.SensitivityAnalysisExperiment_parameterList);\r
+ List<Resource> parameterResources = ListUtils.toList(graph, parameterListResource);\r
+ \r
+ Integer numberOfIterations = null;\r
+ \r
+ for(Resource parameter : parameterResources) {\r
+ Integer n = graph.getPossibleRelatedValue(parameter, SR.SensitivityAnalysisExperiment_Parameter_numberOfValues, Bindings.INTEGER);\r
+ if(n != null) {\r
+ if(numberOfIterations == null)\r
+ numberOfIterations = n;\r
+ else\r
+ numberOfIterations = numberOfIterations * n;\r
+ } \r
+ }\r
+ \r
+ return numberOfIterations;\r
}\r
});\r
+ \r
+ if(numberOfIterations == null)\r
+ numberOfIterations = 0;\r
+ \r
+ // 3 steps before sensitivity iterations\r
return 3 + numberOfIterations; \r
} catch (DatabaseException e) {\r
e.printStackTrace();\r
import org.simantics.sysdyn.expressionParser.ExpressionParser;\r
import org.simantics.sysdyn.expressionParser.ExpressionParser.ForRange;\r
import org.simantics.sysdyn.expressionParser.ParseException;\r
-import org.simantics.sysdyn.representation.Configuration;\r
import org.simantics.sysdyn.representation.Enumeration;\r
import org.simantics.sysdyn.representation.EnumerationIndex;\r
-import org.simantics.sysdyn.representation.IElement;\r
import org.simantics.sysdyn.representation.Variable;\r
\r
public class IndexUtils {\r
parser.expr();\r
for(ForRange forRange : parser.getForRanges()) {\r
if(forRange.start.equals(forRange.end)) {\r
- Variable v = getVariable(variable.getParentConfiguration(), forRange.start.image);\r
+ Variable v = RepresentationUtils.getVariable(variable.getParentConfiguration(), forRange.start.image);\r
if(v instanceof Enumeration) {\r
equation = equation.replaceAll("in[\\s]*" + forRange.start.image + "($|[^\\.])", "in " + forRange.start.image + ".elements$1");\r
}\r
}\r
range.append("]");\r
\r
- Variable prevVar = getVariable(variable.getParentConfiguration(), prevToken.trim());\r
+ Variable prevVar = RepresentationUtils.getVariable(variable.getParentConfiguration(), prevToken.trim());\r
result.append(rangeToIndexes(prevVar, range.toString()));\r
} else {\r
result.append(nextToken);\r
\r
return equation;\r
}\r
-\r
- private static Variable getVariable(Configuration configuration, String name) {\r
- for(IElement element : configuration.getElements()) {\r
- if(element instanceof Variable) {\r
- Variable variable = (Variable) element;\r
- if(variable.getName().equals(name)) {\r
- return variable;\r
- }\r
- }\r
- }\r
- return null;\r
- }\r
}\r
return null;\r
}\r
\r
+\r
+ public static Variable getVariable(Configuration configuration, String name) {\r
+ Configuration conf = configuration;\r
+ String[] components = name.split("\\.");\r
+ \r
+ for(String component : components) {\r
+ \r
+ Configuration newConf = null;\r
+ \r
+ for(IElement element : conf.getElements()) {\r
+ if(element instanceof Variable) {\r
+ Variable variable = (Variable) element;\r
+ if(variable.getName().equals(component)) {\r
+ return variable;\r
+ }\r
+ } else if(element instanceof Module) {\r
+ Module m = (Module)element;\r
+ if(m.getName().equals(component)) {\r
+ newConf = m.getType().getConfiguration();\r
+ }\r
+ }\r
+ }\r
+ \r
+ // If variable or configuration has not been found, return null\r
+ if(newConf == null)\r
+ return null;\r
+ }\r
+ \r
+ return null;\r
+ }\r
+\r
}\r