org.eclipse.jface.text;bundle-version="3.6.1",
org.simantics.spreadsheet.ontology;bundle-version="1.2.0",
org.simantics.fmu;bundle-version="1.0.0",
- org.simantics.fmu.me.win32;bundle-version="1.0.0",
org.simantics.issues;bundle-version="1.1.0",
org.simantics.issues.common;bundle-version="1.1.0",
org.simantics.jfreechart;bundle-version="1.0.0",
protected HashMap<String, String> rvis;\r
protected String indexes;\r
protected VariableSubscriptionManager subscriptionManager;\r
+ protected Pair<ArrayList<String>,ArrayList<String>> variableNameArrays;\r
\r
public IndexVariable(ReadGraph graph, Variable parent, String indexes) throws DatabaseException {\r
this.parent = parent;\r
}\r
\r
protected void ensureInformationAvailable(ReadGraph graph) throws DatabaseException {\r
- SimulationResource SIMU = SimulationResource.getInstance(graph);\r
- ModelingResources MOD = ModelingResources.getInstance(graph);\r
\r
if(model == null) {\r
+ SimulationResource SIMU = SimulationResource.getInstance(graph);\r
Resource modelResource = Variables.getModel(graph, parent);\r
Resource configuration = graph.getPossibleObject(modelResource, SIMU.HasConfiguration);\r
model = SysdynModelManager.getInstance(graph.getSession()).getModel(graph, configuration);\r
}\r
- \r
- Variable var = parent.getParent(graph);\r
- Resource represents = var.getRepresents(graph);\r
- \r
- Resource activeRun = null;\r
- if(represents != null) {\r
- do {\r
- if(graph.isInstanceOf(represents, SIMU.Run)) {\r
- activeRun = represents;\r
- break;\r
- }\r
- var = var.getParent(graph);\r
- represents = var.getRepresents(graph);\r
- } while(represents != null && !graph.isInstanceOf(represents, MOD.StructuralModel));\r
- }\r
\r
- IProject project = Simantics.peekProject();\r
- if(activeRun != null && project != null) {\r
- IExperimentManager expMan = project.getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER);\r
- IExperiment e = expMan.getExperiment(NameUtils.getSafeName(graph, activeRun));\r
- if(e instanceof SysdynExperiment)\r
- this.experiment = (SysdynExperiment)e;\r
+ if(this.experiment == null || this.subscriptionManager == null) {\r
+ SimulationResource SIMU = SimulationResource.getInstance(graph);\r
+ ModelingResources MOD = ModelingResources.getInstance(graph);\r
+ Variable var = parent.getParent(graph);\r
+ Resource represents = var.getRepresents(graph);\r
+ Resource activeRun = null;\r
+ if(represents != null) {\r
+ do {\r
+ if(graph.isInstanceOf(represents, SIMU.Run)) {\r
+ activeRun = represents;\r
+ break;\r
+ }\r
+ var = var.getParent(graph);\r
+ represents = var.getRepresents(graph);\r
+ } while(represents != null && !graph.isInstanceOf(represents, MOD.StructuralModel));\r
+ }\r
+\r
+ IProject project = Simantics.peekProject();\r
+ if(activeRun != null && project != null) {\r
+ IExperimentManager expMan = project.getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER);\r
+ IExperiment e = expMan.getExperiment(NameUtils.getSafeName(graph, activeRun));\r
+ if(e instanceof SysdynExperiment)\r
+ this.experiment = (SysdynExperiment)e;\r
+ }\r
+ this.subscriptionManager = getSubscriptionManager();\r
}\r
\r
- this.subscriptionManager = getSubscriptionManager();\r
- rvi = Variables.getPossibleRVI(graph, this);\r
+ if(rvi == null)\r
+ rvi = Variables.getPossibleRVI(graph, this);\r
+ \r
if(rvi != null)\r
- rvis = VariableRVIUtils.getActiveRVIs(graph, parent.getParent(graph)); \r
+ rvis = graph.syncRequest(new VariableRVIUtils.GetActiveRVIs(parent.getParent(graph))); //VariableRVIUtils.getActiveRVIs(graph, parent.getParent(graph));\r
+ \r
}\r
\r
private Pair<ArrayList<String>,ArrayList<String>> getVariableNameArrays() {\r
- Pair<ArrayList<String>,ArrayList<String>> result = new Pair<ArrayList<String>,ArrayList<String>>(new ArrayList<String>(), new ArrayList<String>());\r
- if(rvi == null || rvis == null)\r
- return result;\r
\r
- if(rvi.indexOf('#') > 0)\r
- rvi = rvi.substring(0, rvi.indexOf('#'));\r
- \r
- String test = rvi;\r
- if(indexes != null && !indexes.isEmpty()) {\r
- String regexIndexes = indexes.trim().replaceAll(":", "[a-zA-Z0-9_]*"); // Why was there was ".replace('.', ',')" ? - Removed by Teemu 2.9.2012\r
- test = rvi + "\\[" + regexIndexes + "\\]";\r
- } else {\r
- test = rvi + "(\\[.*\\])?";\r
- }\r
- for(String k : rvis.keySet()) {\r
- String value = rvis.get(k);\r
- if(k.matches(test) || value.matches(test)) {\r
- result.first.add(k.substring(1).replace("/", ".").replace("%20", "_"));\r
- result.second.add(value.substring(1).replace("/", ".").replace("%20", " "));\r
- }\r
- }\r
- \r
- return result;\r
+ if(variableNameArrays == null) {\r
+ \r
+ Pair<ArrayList<String>,ArrayList<String>> result = new Pair<ArrayList<String>,ArrayList<String>>(new ArrayList<String>(), new ArrayList<String>());\r
+ if(rvi != null && rvis != null) {\r
+ \r
+ if(rvi.indexOf('#') > 0)\r
+ rvi = rvi.substring(0, rvi.indexOf('#'));\r
+ \r
+ String test = rvi;\r
+ if(indexes != null && !indexes.isEmpty()) {\r
+ String regexIndexes = indexes.trim().replaceAll(":", "[a-zA-Z0-9_]*"); // Why was there was ".replace('.', ',')" ? - Removed by Teemu 2.9.2012\r
+ test = rvi + "\\[" + regexIndexes + "\\]";\r
+ } else {\r
+ test = rvi + "(\\[.*\\])?";\r
+ }\r
+ for(String k : rvis.keySet()) {\r
+ String value = rvis.get(k);\r
+ if(k.matches(test) || value.matches(test)) {\r
+ result.first.add(k.substring(1).replace("/", ".").replace("%20", "_"));\r
+ result.second.add(value.substring(1).replace("/", ".").replace("%20", " "));\r
+ }\r
+ }\r
+ \r
+ variableNameArrays = result;\r
+\r
+ }\r
+ \r
+ }\r
+ \r
+ if(variableNameArrays == null) return new Pair<ArrayList<String>,ArrayList<String>>(new ArrayList<String>(), new ArrayList<String>());\r
+ \r
+ return variableNameArrays;\r
\r
}\r
\r
package org.simantics.sysdyn.adapter;\r
\r
+import org.simantics.databoard.Datatypes;\r
+import org.simantics.databoard.type.Datatype;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.layer0.variable.Variable;\r
}\r
}\r
\r
+ @Override\r
+ public Datatype getDatatype(ReadGraph graph) throws DatabaseException {\r
+ if (scalar) {\r
+ return Datatypes.DOUBLE;\r
+ } else {\r
+ return Datatypes.DOUBLE_ARRAY;\r
+ }\r
+ }\r
+ \r
}\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.manager.SysdynDataSet;\r
import org.simantics.sysdyn.manager.SysdynGameExperimentBase;\r
+import org.simantics.sysdyn.manager.SysdynGameExperimentBase.Subscription;\r
import org.simantics.sysdyn.manager.SysdynResult;\r
import org.simantics.sysdyn.solver.ISolver;\r
\r
public ValueIndexVariableBase(ReadGraph graph, Variable parent, String indexes)\r
throws DatabaseException {\r
super(graph, parent, indexes);\r
+ ensureInformationAvailable(graph);\r
+ if(experiment instanceof SysdynGameExperimentBase) {\r
+ s = ((SysdynGameExperimentBase) experiment).subscribe(getVariableNamesWithIndexNumbers());\r
+ }\r
}\r
\r
public static double[] UNRESOLVED = new double[0];\r
\r
+ public Subscription s;\r
+ \r
public double[] getValueFull() {\r
+ \r
if(experiment == null)\r
return UNRESOLVED;\r
\r
+ if(experiment instanceof SysdynGameExperimentBase) {\r
+ double[] arr = new double[s.indexes.length];\r
+ s.getValues(arr);\r
+ return arr;\r
+ }\r
+\r
+ \r
Collection<SysdynResult> results = experiment.getActiveResults();\r
ArrayList<String> variableNames = getVariableNamesWithIndexNumbers();\r
\r
double[] result = new double[variableNames.size()];\r
for(int i = 0; i < variableNames.size(); i++) {\r
for(SysdynResult r : results) { \r
- if(experiment instanceof SysdynGameExperimentBase) {\r
- Double d = ((SysdynGameExperimentBase)experiment).getCurrentValue(variableNames.get(i)); \r
- result[i] = d != null ? d : 0;\r
- } else {\r
+// if(experiment instanceof SysdynGameExperimentBase) {\r
+// Double d = ((SysdynGameExperimentBase)experiment).getCurrentValue(variableNames.get(i)); \r
+// result[i] = d != null ? d : 0;\r
+// } else {\r
SysdynDataSet ds = r.getDataSet(variableNames.get(i));\r
if(ds != null && ds.values != null && ds.values.length > 0) {\r
result[i] = ds.values[ds.values.length-1];\r
} else {\r
return UNRESOLVED;\r
}\r
- }\r
+// }\r
}\r
}\r
return result;\r
\r
import java.util.Arrays;\r
\r
+import org.simantics.databoard.Datatypes;\r
import org.simantics.databoard.binding.Binding;\r
+import org.simantics.databoard.type.Datatype;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.WriteGraph;\r
import org.simantics.db.exception.DatabaseException;\r
return "$" + index;\r
}\r
\r
+ @Override\r
+ public Datatype getDatatype(ReadGraph graph) throws DatabaseException {\r
+ return Datatypes.DOUBLE;\r
+ }\r
+ \r
}\r
import org.simantics.db.common.request.ObjectsWithType;\r
import org.simantics.db.common.utils.ListUtils;\r
import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.request.VariableRead;\r
import org.simantics.db.layer0.variable.Variable;\r
import org.simantics.db.layer0.variable.Variables;\r
import org.simantics.layer0.Layer0;\r
* @throws DatabaseException\r
*/\r
public static HashMap<String, String> getActiveRVIs(ReadGraph graph, Variable variable) throws DatabaseException {\r
- HashMap<String, String> rvis = new LinkedHashMap<String, String>();\r
-\r
- SysdynResource sr = SysdynResource.getInstance(graph);\r
+ return graph.syncRequest(new GetActiveRVIs(variable));\r
+ }\r
+ \r
+ public static class GetActiveRVIs extends VariableRead<HashMap<String, String>> {\r
\r
- String rvi = Variables.getRVI(graph, variable);\r
+ public GetActiveRVIs(Variable variable) {\r
+ super(variable);\r
+ }\r
\r
- Resource r = variable.getRepresents(graph);\r
+ @Override\r
+ public HashMap<String, String> perform(ReadGraph graph) throws DatabaseException {\r
+ HashMap<String, String> rvis = new LinkedHashMap<String, String>();\r
\r
- Resource arrayIndexes = graph.getPossibleObject(r, sr.Variable_arrayIndexesList);\r
- if(arrayIndexes == null) {\r
- // If variable is single-dimensional, use the same rvi\r
- rvis.put(rvi, rvi);\r
- } else {\r
- // If variable is multidimensional, get all indexes that are active and add them to rvis-map\r
- List<Resource> arrayIndexList = ListUtils.toList(graph, arrayIndexes);\r
- resolveActiveArrayIndexes(graph, variable, arrayIndexList);\r
+ SysdynResource sr = SysdynResource.getInstance(graph);\r
+ String rvi = Variables.getRVI(graph, variable);\r
+ Resource r = variable.getRepresents(graph);\r
\r
- if(arrayIndexList.size() > 0)\r
- traverseIndexes(graph, rvi, rvis, arrayIndexList);\r
- else\r
+ Resource arrayIndexes = graph.getPossibleObject(r, sr.Variable_arrayIndexesList);\r
+ if(arrayIndexes == null) {\r
+ // If variable is single-dimensional, use the same rvi\r
rvis.put(rvi, rvi);\r
- }\r
+ } else {\r
+ // If variable is multidimensional, get all indexes that are active and add them to rvis-map\r
+ List<Resource> arrayIndexList = ListUtils.toList(graph, arrayIndexes);\r
+ resolveActiveArrayIndexes(graph, variable, arrayIndexList);\r
\r
- return rvis;\r
+ if(arrayIndexList.size() > 0)\r
+ traverseIndexes(graph, rvi, rvis, arrayIndexList);\r
+ else\r
+ rvis.put(rvi, rvi);\r
+ }\r
+ return rvis;\r
+ }\r
}\r
\r
\r
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
case 6:\r
case 12:\r
+ case 26:\r
case 31:\r
case 33:\r
case 35:\r
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
case 6:\r
case 12:\r
+ case 26:\r
case 31:\r
case 33:\r
case 35:\r
case STRING:\r
case UNSIGNED_INTEGER:\r
case UNSIGNED_NUMBER:\r
- expression();\r
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
+ case 6:\r
+ case 12:\r
+ case 31:\r
+ case 33:\r
+ case 35:\r
+ case 60:\r
+ case 62:\r
+ case 64:\r
+ case 76:\r
+ case 77:\r
+ case 78:\r
+ case 79:\r
+ case IDENT:\r
+ case QIDENT:\r
+ case STRING:\r
+ case UNSIGNED_INTEGER:\r
+ case UNSIGNED_NUMBER:\r
+ expression();\r
+ break;\r
+ case 26:\r
+ jj_consume_token(26);\r
+ name();\r
+ jj_consume_token(60);\r
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
+ case IDENT:\r
+ case QIDENT:\r
+ named_argument();\r
+ label_8:\r
+ while (true) {\r
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
+ case 69:\r
+ ;\r
+ break;\r
+ default:\r
+ jj_la1[28] = jj_gen;\r
+ break label_8;\r
+ }\r
+ jj_consume_token(69);\r
+ named_argument();\r
+ }\r
+ break;\r
+ default:\r
+ jj_la1[29] = jj_gen;\r
+ ;\r
+ }\r
+ jj_consume_token(61);\r
+ break;\r
+ default:\r
+ jj_la1[30] = jj_gen;\r
+ jj_consume_token(-1);\r
+ throw new ParseException();\r
+ }\r
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
case 21:\r
case 69:\r
for_indices();\r
break;\r
default:\r
- jj_la1[28] = jj_gen;\r
+ jj_la1[31] = jj_gen;\r
jj_consume_token(-1);\r
throw new ParseException();\r
}\r
break;\r
default:\r
- jj_la1[29] = jj_gen;\r
+ jj_la1[32] = jj_gen;\r
;\r
}\r
break;\r
default:\r
- jj_la1[30] = jj_gen;\r
+ jj_la1[33] = jj_gen;\r
jj_consume_token(-1);\r
throw new ParseException();\r
}\r
\r
final public void for_indices() throws ParseException {\r
for_index();\r
- label_8:\r
+ label_9:\r
while (true) {\r
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
case 69:\r
;\r
break;\r
default:\r
- jj_la1[31] = jj_gen;\r
- break label_8;\r
+ jj_la1[34] = jj_gen;\r
+ break label_9;\r
}\r
jj_consume_token(69);\r
for_index();\r
forRanges.add(forRange);\r
break;\r
default:\r
- jj_la1[32] = jj_gen;\r
+ jj_la1[35] = jj_gen;\r
;\r
}\r
forIndex = false;\r
expression();\r
break;\r
default:\r
- jj_la1[33] = jj_gen;\r
+ jj_la1[36] = jj_gen;\r
;\r
}\r
- label_9:\r
+ label_10:\r
while (true) {\r
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
case 69:\r
;\r
break;\r
default:\r
- jj_la1[34] = jj_gen;\r
- break label_9;\r
+ jj_la1[37] = jj_gen;\r
+ break label_10;\r
}\r
jj_consume_token(69);\r
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
expression();\r
break;\r
default:\r
- jj_la1[35] = jj_gen;\r
+ jj_la1[38] = jj_gen;\r
;\r
}\r
}\r
\r
final public void expression_list() throws ParseException {\r
expression();\r
- label_10:\r
+ label_11:\r
while (true) {\r
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
case 69:\r
;\r
break;\r
default:\r
- jj_la1[36] = jj_gen;\r
- break label_10;\r
+ jj_la1[39] = jj_gen;\r
+ break label_11;\r
}\r
jj_consume_token(69);\r
expression();\r
currentRange = new ArrayList<Token>();\r
jj_consume_token(64);\r
subscript(currentRange);\r
- label_11:\r
+ label_12:\r
while (true) {\r
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
case 69:\r
;\r
break;\r
default:\r
- jj_la1[37] = jj_gen;\r
- break label_11;\r
+ jj_la1[40] = jj_gen;\r
+ break label_12;\r
}\r
jj_consume_token(69);\r
subscript(currentRange);\r
currentRange.add(token);\r
break;\r
default:\r
- jj_la1[40] = jj_gen;\r
+ jj_la1[43] = jj_gen;\r
if (jj_2_3(2147483647)) {\r
functionCall = null;\r
name();\r
rangeIndex(rangeToken, false, ":");\r
break;\r
default:\r
- jj_la1[38] = jj_gen;\r
+ jj_la1[41] = jj_gen;\r
;\r
}\r
rangeToken.endColumn = token.endColumn;\r
jj_consume_token(62);\r
rangeToken.image = rangeToken.image + token.image;\r
rangeIndex(rangeToken, true, ",");\r
- label_12:\r
+ label_13:\r
while (true) {\r
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
case 69:\r
;\r
break;\r
default:\r
- jj_la1[39] = jj_gen;\r
- break label_12;\r
+ jj_la1[42] = jj_gen;\r
+ break label_13;\r
}\r
jj_consume_token(69);\r
rangeIndex(rangeToken, false, ",");\r
rangeToken.image = rangeToken.image + token.image;\r
break;\r
default:\r
- jj_la1[41] = jj_gen;\r
+ jj_la1[44] = jj_gen;\r
jj_consume_token(-1);\r
throw new ParseException();\r
}\r
rangeToken.image = rangeToken.image + identToken;\r
break;\r
default:\r
- jj_la1[42] = jj_gen;\r
+ jj_la1[45] = jj_gen;\r
jj_consume_token(-1);\r
throw new ParseException();\r
}\r
finally { jj_save(2, xla); }\r
}\r
\r
- private boolean jj_3R_74() {\r
- if (jj_scan_token(67)) return true;\r
- if (jj_3R_73()) return true;\r
+ private boolean jj_3R_32() {\r
+ if (jj_scan_token(9)) return true;\r
+ if (jj_3R_31()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_35() {\r
- if (jj_3R_39()) return true;\r
+ private boolean jj_3R_36() {\r
+ if (jj_3R_40()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_33() {\r
+ private boolean jj_3R_34() {\r
Token xsp;\r
xsp = jj_scanpos;\r
- if (jj_3R_35()) jj_scanpos = xsp;\r
- if (jj_3R_36()) return true;\r
+ if (jj_3R_36()) jj_scanpos = xsp;\r
+ if (jj_3R_37()) return true;\r
while (true) {\r
xsp = jj_scanpos;\r
- if (jj_3R_37()) { jj_scanpos = xsp; break; }\r
+ if (jj_3R_38()) { jj_scanpos = xsp; break; }\r
}\r
return false;\r
}\r
\r
- private boolean jj_3R_38() {\r
+ private boolean jj_3R_39() {\r
Token xsp;\r
xsp = jj_scanpos;\r
if (jj_scan_token(70)) {\r
return false;\r
}\r
\r
- private boolean jj_3R_16() {\r
- if (jj_scan_token(66)) return true;\r
- if (jj_3R_13()) return true;\r
+ private boolean jj_3R_27() {\r
+ if (jj_scan_token(67)) return true;\r
+ if (jj_3R_26()) return true;\r
+ Token xsp;\r
+ xsp = jj_scanpos;\r
+ if (jj_3R_30()) jj_scanpos = xsp;\r
return false;\r
}\r
\r
- private boolean jj_3R_26() {\r
- if (jj_scan_token(67)) return true;\r
- if (jj_3R_25()) return true;\r
+ private boolean jj_3R_29() {\r
+ if (jj_scan_token(22)) return true;\r
+ if (jj_3R_28()) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_85() {\r
+ if (jj_scan_token(41)) return true;\r
+ if (jj_3R_18()) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_33() {\r
+ if (jj_3R_34()) return true;\r
Token xsp;\r
xsp = jj_scanpos;\r
- if (jj_3R_29()) jj_scanpos = xsp;\r
+ if (jj_3R_35()) jj_scanpos = xsp;\r
return false;\r
}\r
\r
- private boolean jj_3R_79() {\r
- if (jj_3R_15()) return true;\r
+ private boolean jj_3R_31() {\r
+ Token xsp;\r
+ xsp = jj_scanpos;\r
+ if (jj_scan_token(12)) jj_scanpos = xsp;\r
+ if (jj_3R_33()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_28() {\r
- if (jj_scan_token(22)) return true;\r
- if (jj_3R_27()) return true;\r
+ private boolean jj_3R_82() {\r
+ if (jj_scan_token(69)) return true;\r
+ if (jj_3R_81()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_80() {\r
- if (jj_scan_token(41)) return true;\r
- if (jj_3R_17()) return true;\r
+ private boolean jj_3R_28() {\r
+ if (jj_3R_31()) return true;\r
+ Token xsp;\r
+ while (true) {\r
+ xsp = jj_scanpos;\r
+ if (jj_3R_32()) { jj_scanpos = xsp; break; }\r
+ }\r
return false;\r
}\r
\r
- private boolean jj_3R_32() {\r
- if (jj_3R_33()) return true;\r
+ private boolean jj_3R_65() {\r
+ if (jj_scan_token(26)) return true;\r
+ if (jj_3R_14()) return true;\r
+ if (jj_scan_token(60)) return true;\r
Token xsp;\r
xsp = jj_scanpos;\r
- if (jj_3R_34()) jj_scanpos = xsp;\r
+ if (jj_3R_69()) jj_scanpos = xsp;\r
+ if (jj_scan_token(61)) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_78() {\r
- if (jj_scan_token(UNSIGNED_INTEGER)) return true;\r
+ private boolean jj_3R_58() {\r
+ if (jj_scan_token(66)) return true;\r
+ if (jj_3R_52()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_73() {\r
+ private boolean jj_3R_26() {\r
+ if (jj_3R_28()) return true;\r
Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_3R_78()) {\r
- jj_scanpos = xsp;\r
- if (jj_3R_79()) return true;\r
+ while (true) {\r
+ xsp = jj_scanpos;\r
+ if (jj_3R_29()) { jj_scanpos = xsp; break; }\r
}\r
return false;\r
}\r
\r
- private boolean jj_3R_30() {\r
+ private boolean jj_3R_81() {\r
+ if (jj_3R_16()) return true;\r
Token xsp;\r
xsp = jj_scanpos;\r
- if (jj_scan_token(12)) jj_scanpos = xsp;\r
- if (jj_3R_32()) return true;\r
+ if (jj_3R_85()) jj_scanpos = xsp;\r
return false;\r
}\r
\r
- private boolean jj_3R_13() {\r
- if (jj_3R_15()) return true;\r
+ private boolean jj_3R_24() {\r
+ if (jj_3R_26()) return true;\r
Token xsp;\r
xsp = jj_scanpos;\r
- if (jj_3R_16()) jj_scanpos = xsp;\r
+ if (jj_3R_27()) jj_scanpos = xsp;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3_2() {\r
+ if (jj_3R_15()) return true;\r
return false;\r
}\r
\r
private boolean jj_3R_77() {\r
- if (jj_scan_token(69)) return true;\r
- if (jj_3R_76()) return true;\r
+ if (jj_3R_81()) return true;\r
+ Token xsp;\r
+ while (true) {\r
+ xsp = jj_scanpos;\r
+ if (jj_3R_82()) { jj_scanpos = xsp; break; }\r
+ }\r
return false;\r
}\r
\r
- private boolean jj_3R_27() {\r
- if (jj_3R_30()) return true;\r
+ private boolean jj_3R_22() {\r
+ if (jj_scan_token(31)) return true;\r
+ if (jj_3R_18()) return true;\r
+ if (jj_scan_token(28)) return true;\r
+ if (jj_3R_18()) return true;\r
Token xsp;\r
while (true) {\r
xsp = jj_scanpos;\r
- if (jj_3R_31()) { jj_scanpos = xsp; break; }\r
+ if (jj_3R_25()) { jj_scanpos = xsp; break; }\r
}\r
+ if (jj_scan_token(15)) return true;\r
+ if (jj_3R_18()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_66() {\r
- if (jj_scan_token(69)) return true;\r
- if (jj_3R_54()) return true;\r
+ private boolean jj_3R_64() {\r
+ if (jj_3R_18()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_63() {\r
+ private boolean jj_3R_18() {\r
Token xsp;\r
xsp = jj_scanpos;\r
- if (jj_3R_66()) {\r
+ if (jj_3R_21()) {\r
jj_scanpos = xsp;\r
- if (jj_3R_67()) return true;\r
+ if (jj_3R_22()) return true;\r
}\r
return false;\r
}\r
\r
- private boolean jj_3R_57() {\r
- if (jj_scan_token(66)) return true;\r
- if (jj_3R_51()) return true;\r
+ private boolean jj_3R_21() {\r
+ if (jj_3R_24()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_76() {\r
- if (jj_3R_15()) return true;\r
+ private boolean jj_3R_61() {\r
Token xsp;\r
xsp = jj_scanpos;\r
- if (jj_3R_80()) jj_scanpos = xsp;\r
+ if (jj_3R_64()) {\r
+ jj_scanpos = xsp;\r
+ if (jj_3R_65()) return true;\r
+ }\r
+ xsp = jj_scanpos;\r
+ if (jj_3R_66()) jj_scanpos = xsp;\r
return false;\r
}\r
\r
- private boolean jj_3R_25() {\r
- if (jj_3R_27()) return true;\r
+ private boolean jj_3R_55() {\r
Token xsp;\r
- while (true) {\r
- xsp = jj_scanpos;\r
- if (jj_3R_28()) { jj_scanpos = xsp; break; }\r
+ xsp = jj_scanpos;\r
+ if (jj_3R_60()) {\r
+ jj_scanpos = xsp;\r
+ if (jj_3R_61()) return true;\r
}\r
return false;\r
}\r
\r
- private boolean jj_3_2() {\r
- if (jj_3R_14()) return true;\r
+ private boolean jj_3R_60() {\r
+ if (jj_3R_15()) return true;\r
+ Token xsp;\r
+ xsp = jj_scanpos;\r
+ if (jj_3R_63()) jj_scanpos = xsp;\r
return false;\r
}\r
\r
- private boolean jj_3R_23() {\r
- if (jj_3R_25()) return true;\r
+ private boolean jj_3R_56() {\r
+ if (jj_3R_55()) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_51() {\r
+ if (jj_scan_token(60)) return true;\r
Token xsp;\r
xsp = jj_scanpos;\r
- if (jj_3R_26()) jj_scanpos = xsp;\r
+ if (jj_3R_56()) jj_scanpos = xsp;\r
+ if (jj_scan_token(61)) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_19() {\r
- if (jj_scan_token(QIDENT)) return true;\r
+ private boolean jj_3R_57() {\r
+ if (jj_3R_62()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_72() {\r
- if (jj_3R_76()) return true;\r
- Token xsp;\r
- while (true) {\r
- xsp = jj_scanpos;\r
- if (jj_3R_77()) { jj_scanpos = xsp; break; }\r
- }\r
+ private boolean jj_3R_80() {\r
+ if (jj_scan_token(69)) return true;\r
+ if (jj_3R_78()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_71() {\r
- if (jj_scan_token(62)) return true;\r
- if (jj_3R_73()) return true;\r
+ private boolean jj_3R_52() {\r
+ if (jj_3R_16()) return true;\r
Token xsp;\r
- while (true) {\r
- xsp = jj_scanpos;\r
- if (jj_3R_75()) { jj_scanpos = xsp; break; }\r
- }\r
- if (jj_scan_token(63)) return true;\r
+ xsp = jj_scanpos;\r
+ if (jj_3R_57()) jj_scanpos = xsp;\r
+ xsp = jj_scanpos;\r
+ if (jj_3R_58()) jj_scanpos = xsp;\r
return false;\r
}\r
\r
- private boolean jj_3R_53() {\r
- if (jj_scan_token(68)) return true;\r
- if (jj_3R_52()) return true;\r
+ private boolean jj_3R_79() {\r
+ if (jj_scan_token(67)) return true;\r
+ if (jj_3R_78()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_21() {\r
- if (jj_scan_token(31)) return true;\r
- if (jj_3R_17()) return true;\r
- if (jj_scan_token(28)) return true;\r
- if (jj_3R_17()) return true;\r
- Token xsp;\r
- while (true) {\r
- xsp = jj_scanpos;\r
- if (jj_3R_24()) { jj_scanpos = xsp; break; }\r
- }\r
- if (jj_scan_token(15)) return true;\r
- if (jj_3R_17()) return true;\r
+ private boolean jj_3R_17() {\r
+ if (jj_scan_token(66)) return true;\r
+ if (jj_3R_14()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_60() {\r
- if (jj_3R_17()) return true;\r
- Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_3R_63()) jj_scanpos = xsp;\r
+ private boolean jj_3R_84() {\r
+ if (jj_3R_16()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_65() {\r
- if (jj_scan_token(69)) return true;\r
- if (jj_3R_64()) return true;\r
+ private boolean jj_3R_71() {\r
+ if (jj_scan_token(21)) return true;\r
+ if (jj_3R_77()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_20() {\r
- if (jj_3R_23()) return true;\r
+ private boolean jj_3R_83() {\r
+ if (jj_scan_token(UNSIGNED_INTEGER)) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_17() {\r
+ private boolean jj_3R_14() {\r
+ if (jj_3R_16()) return true;\r
Token xsp;\r
xsp = jj_scanpos;\r
- if (jj_3R_20()) {\r
+ if (jj_3R_17()) jj_scanpos = xsp;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_78() {\r
+ Token xsp;\r
+ xsp = jj_scanpos;\r
+ if (jj_3R_83()) {\r
jj_scanpos = xsp;\r
- if (jj_3R_21()) return true;\r
+ if (jj_3R_84()) return true;\r
}\r
return false;\r
}\r
\r
- private boolean jj_3_3() {\r
- if (jj_3R_13()) return true;\r
- if (jj_scan_token(60)) return true;\r
+ private boolean jj_3R_20() {\r
+ if (jj_scan_token(QIDENT)) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_70() {\r
- if (jj_3R_73()) return true;\r
+ private boolean jj_3R_54() {\r
+ if (jj_scan_token(68)) return true;\r
+ if (jj_3R_53()) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_75() {\r
+ if (jj_scan_token(62)) return true;\r
+ if (jj_3R_78()) return true;\r
Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_3R_74()) jj_scanpos = xsp;\r
+ while (true) {\r
+ xsp = jj_scanpos;\r
+ if (jj_3R_80()) { jj_scanpos = xsp; break; }\r
+ }\r
+ if (jj_scan_token(63)) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_59() {\r
+ private boolean jj_3_3() {\r
if (jj_3R_14()) return true;\r
- Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_3R_62()) jj_scanpos = xsp;\r
+ if (jj_scan_token(60)) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_54() {\r
+ private boolean jj_3R_66() {\r
Token xsp;\r
xsp = jj_scanpos;\r
- if (jj_3R_59()) {\r
+ if (jj_3R_70()) {\r
jj_scanpos = xsp;\r
- if (jj_3R_60()) return true;\r
+ if (jj_3R_71()) return true;\r
}\r
return false;\r
}\r
\r
- private boolean jj_3R_55() {\r
- if (jj_3R_54()) return true;\r
+ private boolean jj_3R_68() {\r
+ if (jj_scan_token(69)) return true;\r
+ if (jj_3R_67()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_22() {\r
- if (jj_3R_15()) return true;\r
+ private boolean jj_3R_70() {\r
+ if (jj_scan_token(69)) return true;\r
+ if (jj_3R_55()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_69() {\r
- if (jj_3R_13()) return true;\r
- if (jj_3R_50()) return true;\r
+ private boolean jj_3R_74() {\r
+ if (jj_3R_78()) return true;\r
+ Token xsp;\r
+ xsp = jj_scanpos;\r
+ if (jj_3R_79()) jj_scanpos = xsp;\r
return false;\r
}\r
\r
- private boolean jj_3R_18() {\r
- if (jj_scan_token(IDENT)) return true;\r
- Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_3R_22()) jj_scanpos = xsp;\r
+ private boolean jj_3R_23() {\r
+ if (jj_3R_16()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_15() {\r
+ private boolean jj_3R_73() {\r
+ if (jj_3R_14()) return true;\r
+ if (jj_3R_51()) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_16() {\r
Token xsp;\r
xsp = jj_scanpos;\r
- if (jj_3R_18()) {\r
+ if (jj_3R_19()) {\r
jj_scanpos = xsp;\r
- if (jj_3R_19()) return true;\r
+ if (jj_3R_20()) return true;\r
}\r
return false;\r
}\r
\r
- private boolean jj_3R_50() {\r
- if (jj_scan_token(60)) return true;\r
+ private boolean jj_3R_19() {\r
+ if (jj_scan_token(IDENT)) return true;\r
Token xsp;\r
xsp = jj_scanpos;\r
- if (jj_3R_55()) jj_scanpos = xsp;\r
- if (jj_scan_token(61)) return true;\r
+ if (jj_3R_23()) jj_scanpos = xsp;\r
return false;\r
}\r
\r
- private boolean jj_3R_56() {\r
- if (jj_3R_61()) return true;\r
+ private boolean jj_3_1() {\r
+ if (jj_3R_14()) return true;\r
+ if (jj_scan_token(60)) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_68() {\r
- if (jj_scan_token(67)) return true;\r
+ private boolean jj_3R_50() {\r
+ if (jj_scan_token(62)) return true;\r
+ if (jj_3R_55()) return true;\r
+ if (jj_scan_token(63)) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_64() {\r
+ private boolean jj_3R_67() {\r
Token xsp;\r
xsp = jj_scanpos;\r
- if (jj_3R_68()) {\r
+ if (jj_3R_72()) {\r
jj_scanpos = xsp;\r
- if (jj_3R_69()) {\r
+ if (jj_3R_73()) {\r
jj_scanpos = xsp;\r
- if (jj_3R_70()) {\r
+ if (jj_3R_74()) {\r
jj_scanpos = xsp;\r
- if (jj_3R_71()) return true;\r
+ if (jj_3R_75()) return true;\r
}\r
}\r
}\r
return false;\r
}\r
\r
- private boolean jj_3_1() {\r
- if (jj_3R_13()) return true;\r
- if (jj_scan_token(60)) return true;\r
+ private boolean jj_3R_72() {\r
+ if (jj_scan_token(67)) return true;\r
return false;\r
}\r
\r
private boolean jj_3R_49() {\r
- if (jj_scan_token(62)) return true;\r
- if (jj_3R_54()) return true;\r
- if (jj_scan_token(63)) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_48() {\r
if (jj_scan_token(64)) return true;\r
- if (jj_3R_52()) return true;\r
+ if (jj_3R_53()) return true;\r
Token xsp;\r
while (true) {\r
xsp = jj_scanpos;\r
- if (jj_3R_53()) { jj_scanpos = xsp; break; }\r
+ if (jj_3R_54()) { jj_scanpos = xsp; break; }\r
}\r
if (jj_scan_token(65)) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_47() {\r
+ private boolean jj_3R_48() {\r
if (jj_scan_token(60)) return true;\r
- if (jj_3R_17()) return true;\r
+ if (jj_3R_18()) return true;\r
if (jj_scan_token(61)) return true;\r
return false;\r
}\r
\r
+ private boolean jj_3R_47() {\r
+ if (jj_3R_52()) return true;\r
+ return false;\r
+ }\r
+\r
private boolean jj_3R_46() {\r
+ if (jj_3R_14()) return true;\r
if (jj_3R_51()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_58() {\r
+ private boolean jj_3R_59() {\r
if (jj_scan_token(69)) return true;\r
- if (jj_3R_17()) return true;\r
+ if (jj_3R_18()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_61() {\r
- if (jj_scan_token(64)) return true;\r
- if (jj_3R_64()) return true;\r
+ private boolean jj_3R_44() {\r
Token xsp;\r
- while (true) {\r
- xsp = jj_scanpos;\r
- if (jj_3R_65()) { jj_scanpos = xsp; break; }\r
+ xsp = jj_scanpos;\r
+ if (jj_scan_token(84)) {\r
+ jj_scanpos = xsp;\r
+ if (jj_scan_token(85)) return true;\r
}\r
- if (jj_scan_token(65)) return true;\r
+ if (jj_3R_43()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_45() {\r
- if (jj_3R_13()) return true;\r
- if (jj_3R_50()) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_43() {\r
+ private boolean jj_3R_62() {\r
+ if (jj_scan_token(64)) return true;\r
+ if (jj_3R_67()) return true;\r
Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_scan_token(84)) {\r
- jj_scanpos = xsp;\r
- if (jj_scan_token(85)) return true;\r
+ while (true) {\r
+ xsp = jj_scanpos;\r
+ if (jj_3R_68()) { jj_scanpos = xsp; break; }\r
}\r
- if (jj_3R_42()) return true;\r
+ if (jj_scan_token(65)) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_42() {\r
+ private boolean jj_3R_43() {\r
Token xsp;\r
xsp = jj_scanpos;\r
if (jj_scan_token(92)) {\r
jj_scanpos = xsp;\r
if (jj_scan_token(33)) {\r
jj_scanpos = xsp;\r
- if (jj_3R_45()) {\r
- jj_scanpos = xsp;\r
if (jj_3R_46()) {\r
jj_scanpos = xsp;\r
if (jj_3R_47()) {\r
jj_scanpos = xsp;\r
if (jj_3R_49()) {\r
jj_scanpos = xsp;\r
+ if (jj_3R_50()) {\r
+ jj_scanpos = xsp;\r
if (jj_scan_token(35)) return true;\r
}\r
}\r
return false;\r
}\r
\r
- private boolean jj_3R_29() {\r
- if (jj_scan_token(67)) return true;\r
- if (jj_3R_25()) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_41() {\r
- if (jj_3R_44()) return true;\r
- if (jj_3R_40()) return true;\r
+ private boolean jj_3R_76() {\r
+ if (jj_scan_token(69)) return true;\r
+ if (jj_3R_15()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_34() {\r
- if (jj_3R_38()) return true;\r
- if (jj_3R_33()) return true;\r
+ private boolean jj_3R_30() {\r
+ if (jj_scan_token(67)) return true;\r
+ if (jj_3R_26()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_37() {\r
- if (jj_3R_39()) return true;\r
- if (jj_3R_36()) return true;\r
+ private boolean jj_3R_42() {\r
+ if (jj_3R_45()) return true;\r
+ if (jj_3R_41()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_44() {\r
+ private boolean jj_3R_45() {\r
Token xsp;\r
xsp = jj_scanpos;\r
if (jj_scan_token(80)) {\r
return false;\r
}\r
\r
- private boolean jj_3R_40() {\r
- if (jj_3R_42()) return true;\r
+ private boolean jj_3R_38() {\r
+ if (jj_3R_40()) return true;\r
+ if (jj_3R_37()) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_35() {\r
+ if (jj_3R_39()) return true;\r
+ if (jj_3R_34()) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_41() {\r
+ if (jj_3R_43()) return true;\r
Token xsp;\r
xsp = jj_scanpos;\r
- if (jj_3R_43()) jj_scanpos = xsp;\r
+ if (jj_3R_44()) jj_scanpos = xsp;\r
return false;\r
}\r
\r
- private boolean jj_3R_52() {\r
- if (jj_3R_17()) return true;\r
+ private boolean jj_3R_53() {\r
+ if (jj_3R_18()) return true;\r
Token xsp;\r
while (true) {\r
xsp = jj_scanpos;\r
- if (jj_3R_58()) { jj_scanpos = xsp; break; }\r
+ if (jj_3R_59()) { jj_scanpos = xsp; break; }\r
}\r
return false;\r
}\r
\r
- private boolean jj_3R_75() {\r
- if (jj_scan_token(69)) return true;\r
- if (jj_3R_73()) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_62() {\r
+ private boolean jj_3R_63() {\r
if (jj_scan_token(69)) return true;\r
- if (jj_3R_54()) return true;\r
+ if (jj_3R_55()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_14() {\r
- if (jj_3R_15()) return true;\r
- if (jj_scan_token(86)) return true;\r
- if (jj_3R_17()) return true;\r
+ private boolean jj_3R_37() {\r
+ if (jj_3R_41()) return true;\r
+ Token xsp;\r
+ while (true) {\r
+ xsp = jj_scanpos;\r
+ if (jj_3R_42()) { jj_scanpos = xsp; break; }\r
+ }\r
return false;\r
}\r
\r
- private boolean jj_3R_67() {\r
- if (jj_scan_token(21)) return true;\r
- if (jj_3R_72()) return true;\r
+ private boolean jj_3R_25() {\r
+ if (jj_scan_token(20)) return true;\r
+ if (jj_3R_18()) return true;\r
+ if (jj_scan_token(28)) return true;\r
+ if (jj_3R_18()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_24() {\r
- if (jj_scan_token(20)) return true;\r
- if (jj_3R_17()) return true;\r
- if (jj_scan_token(28)) return true;\r
- if (jj_3R_17()) return true;\r
+ private boolean jj_3R_15() {\r
+ if (jj_3R_16()) return true;\r
+ if (jj_scan_token(86)) return true;\r
+ if (jj_3R_18()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_36() {\r
- if (jj_3R_40()) return true;\r
+ private boolean jj_3R_69() {\r
+ if (jj_3R_15()) return true;\r
Token xsp;\r
while (true) {\r
xsp = jj_scanpos;\r
- if (jj_3R_41()) { jj_scanpos = xsp; break; }\r
+ if (jj_3R_76()) { jj_scanpos = xsp; break; }\r
}\r
return false;\r
}\r
\r
- private boolean jj_3R_39() {\r
+ private boolean jj_3R_40() {\r
Token xsp;\r
xsp = jj_scanpos;\r
if (jj_scan_token(76)) {\r
return false;\r
}\r
\r
- private boolean jj_3R_51() {\r
- if (jj_3R_15()) return true;\r
- Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_3R_56()) jj_scanpos = xsp;\r
- xsp = jj_scanpos;\r
- if (jj_3R_57()) jj_scanpos = xsp;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_31() {\r
- if (jj_scan_token(9)) return true;\r
- if (jj_3R_30()) return true;\r
- return false;\r
- }\r
-\r
/** Generated Token Manager. */\r
public ExpressionParserTokenManager token_source;\r
SimpleCharStream jj_input_stream;\r
private Token jj_scanpos, jj_lastpos;\r
private int jj_la;\r
private int jj_gen;\r
- final private int[] jj_la1 = new int[43];\r
+ final private int[] jj_la1 = new int[46];\r
static private int[] jj_la1_0;\r
static private int[] jj_la1_1;\r
static private int[] jj_la1_2;\r
jj_la1_init_2();\r
}\r
private static void jj_la1_init_0() {\r
- jj_la1_0 = new int[] {0x100000,0x80001040,0x100000,0x80001040,0x0,0x0,0x400000,0x200,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x80001040,0x0,0x200000,0x200000,0x80001040,0x0,0x0,0x80001040,0x0,0x80001040,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};\r
+ jj_la1_0 = new int[] {0x100000,0x80001040,0x100000,0x80001040,0x0,0x0,0x400000,0x200,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x84001040,0x0,0x0,0x0,0x84001040,0x200000,0x200000,0x84001040,0x0,0x0,0x80001040,0x0,0x80001040,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};\r
}\r
private static void jj_la1_init_1() {\r
- jj_la1_1 = new int[] {0x0,0x5000000a,0x0,0x5000000a,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x50000008,0x0,0x0,0x0,0x0,0x0,0x5000000a,0x0,0x0,0x0,0x5000000a,0x0,0x200,0x5000000a,0x0,0x5000000a,0x0,0x0,0x0,0x0,0x0,0x40000000,0x0,};\r
+ jj_la1_1 = new int[] {0x0,0x5000000a,0x0,0x5000000a,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x50000008,0x0,0x0,0x0,0x0,0x0,0x5000000a,0x0,0x0,0x0,0x5000000a,0x0,0x0,0x5000000a,0x0,0x200,0x5000000a,0x0,0x5000000a,0x0,0x0,0x0,0x0,0x0,0x40000000,0x0,};\r
}\r
private static void jj_la1_init_2() {\r
- jj_la1_2 = new int[] {0x0,0x1f00f001,0x0,0x1f00f001,0x8,0x8,0x0,0x0,0x0,0xfc0,0xfc0,0xf000,0xf000,0xf000,0xf0000,0x300000,0x300000,0xf0000,0x10,0x1c000000,0x3000001,0x3000000,0x3000000,0x4,0x1,0x4,0x1f00f001,0x20,0x20,0x20,0x1f00f001,0x20,0x0,0x1f00f001,0x20,0x1f00f001,0x20,0x20,0x8,0x20,0x8,0xb000000,0xb000000,};\r
+ jj_la1_2 = new int[] {0x0,0x1f00f001,0x0,0x1f00f001,0x8,0x8,0x0,0x0,0x0,0xfc0,0xfc0,0xf000,0xf000,0xf000,0xf0000,0x300000,0x300000,0xf0000,0x10,0x1c000000,0x3000001,0x3000000,0x3000000,0x4,0x1,0x4,0x1f00f001,0x20,0x20,0x3000000,0x1f00f001,0x20,0x20,0x1f00f001,0x20,0x0,0x1f00f001,0x20,0x1f00f001,0x20,0x20,0x8,0x20,0x8,0xb000000,0xb000000,};\r
}\r
final private JJCalls[] jj_2_rtns = new JJCalls[3];\r
private boolean jj_rescan = false;\r
token = new Token();\r
jj_ntk = -1;\r
jj_gen = 0;\r
- for (int i = 0; i < 43; i++) jj_la1[i] = -1;\r
+ for (int i = 0; i < 46; i++) jj_la1[i] = -1;\r
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();\r
}\r
\r
token = new Token();\r
jj_ntk = -1;\r
jj_gen = 0;\r
- for (int i = 0; i < 43; i++) jj_la1[i] = -1;\r
+ for (int i = 0; i < 46; i++) jj_la1[i] = -1;\r
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();\r
}\r
\r
token = new Token();\r
jj_ntk = -1;\r
jj_gen = 0;\r
- for (int i = 0; i < 43; i++) jj_la1[i] = -1;\r
+ for (int i = 0; i < 46; i++) jj_la1[i] = -1;\r
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();\r
}\r
\r
token = new Token();\r
jj_ntk = -1;\r
jj_gen = 0;\r
- for (int i = 0; i < 43; i++) jj_la1[i] = -1;\r
+ for (int i = 0; i < 46; i++) jj_la1[i] = -1;\r
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();\r
}\r
\r
token = new Token();\r
jj_ntk = -1;\r
jj_gen = 0;\r
- for (int i = 0; i < 43; i++) jj_la1[i] = -1;\r
+ for (int i = 0; i < 46; i++) jj_la1[i] = -1;\r
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();\r
}\r
\r
token = new Token();\r
jj_ntk = -1;\r
jj_gen = 0;\r
- for (int i = 0; i < 43; i++) jj_la1[i] = -1;\r
+ for (int i = 0; i < 46; i++) jj_la1[i] = -1;\r
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();\r
}\r
\r
la1tokens[jj_kind] = true;\r
jj_kind = -1;\r
}\r
- for (int i = 0; i < 43; i++) {\r
+ for (int i = 0; i < 46; i++) {\r
if (jj_la1[i] == jj_gen) {\r
for (int j = 0; j < 32; j++) {\r
if ((jj_la1_0[i] & (1<<j)) != 0) {\r
//expression [ "," function_arguments | for for_indices ]\r
//| named_arguments\r
LOOKAHEAD(named_argument()) named_argument() ( "," function_arguments() )?\r
- | expression() ( "," function_arguments() | "for" for_indices() )?\r
+ | (expression() | "function" name() "(" ( named_argument() ( "," named_argument() )* )? ")" ) ( "," function_arguments() | "for" for_indices() )?\r
\r
}\r
\r
/*******************************************************************************\r
- * Copyright (c) 2010, 2013 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2013, 2014 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
import org.simantics.db.common.utils.Logger;\r
import org.simantics.db.common.utils.NameUtils;\r
import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.request.Read;\r
import org.simantics.db.service.VirtualGraphSupport;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.modelica.IModelicaMonitor;\r
import org.simantics.simulation.experiment.IExperimentListener;\r
import org.simantics.simulation.ontology.SimulationResource;\r
import org.simantics.sysdyn.Activator;\r
+import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.adapter.VariableValueSubscription;\r
import org.simantics.sysdyn.modelica.ModelicaWriter;\r
import org.simantics.sysdyn.representation.Configuration;\r
import org.simantics.sysdyn.representation.Model;\r
import org.simantics.sysdyn.simulation.SimulationScheduler;\r
+import org.simantics.ui.SimanticsUI;\r
\r
public class OldSysdynExperiment extends SysdynExperiment {\r
\r
* @return\r
*/\r
protected String getAdditionalScripts() {\r
- StringBuilder functionscript = new StringBuilder();\r
- for(String path : FunctionUtils.getLibraryPathsForModelica(this)) {\r
+ StringBuilder functionscript = new StringBuilder();\r
+ \r
+ boolean useModelicaLibraries = false;\r
+ try {\r
+ useModelicaLibraries = SimanticsUI.getSession().syncRequest(new Read<Boolean>() {\r
+\r
+ @Override\r
+ public Boolean perform(ReadGraph graph) throws DatabaseException {\r
+ SysdynResource SR = SysdynResource.getInstance(graph);\r
+ SimulationResource SIM = SimulationResource.getInstance(graph);\r
+ Resource configuration = graph.getPossibleObject(OldSysdynExperiment.this.model, SIM.HasConfiguration);\r
+ return graph.hasStatement(configuration, SR.SysdynModel_useModelicaLibraries);\r
+ }\r
+ });\r
+ } catch (DatabaseException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ if (useModelicaLibraries)\r
+ functionscript.append("loadModel(Modelica);\n");\r
+ \r
+ for(String path : FunctionUtils.getLibraryPathsForModelica(this)) {\r
functionscript.append("loadFile(\"" + path + "\");\n");\r
}\r
return functionscript.toString();\r
public void resultsChanged() {\r
resultsChanged(false);\r
}\r
+\r
+ protected void onPublishResults() {\r
+ resultsChanged(true);\r
+ }\r
\r
public void setPublishResults(boolean value) {\r
publishResults = value;\r
- if(publishResults) resultsChanged(true);\r
+ if(publishResults) {\r
+ onPublishResults();\r
+ }\r
}\r
\r
public void resultsChanged(boolean force) {\r
}\r
}\r
\r
+ final static private SimpleDateFormat hhmmss = new SimpleDateFormat("hh:mm:ss");\r
+ \r
@Override\r
public void message(String message) {\r
- message(message, "hh:mm:ss");\r
+ message(message, hhmmss);\r
+ }\r
+\r
+ public void message(String message, String timeStampFormat) {\r
+ message(message, new SimpleDateFormat(timeStampFormat));\r
}\r
\r
+ final static Calendar cal = Calendar.getInstance();\r
+\r
/**\r
* Print message to a console with a specified time stamp format\r
* \r
* @param message the message to be printed\r
* @param timeStampFormat simpledateformat timestamp format. null if no timestamp wanted\r
*/\r
- public void message(String message, String timeStampFormat) {\r
- Calendar cal = Calendar.getInstance();\r
- SimpleDateFormat sdf = new SimpleDateFormat(timeStampFormat);\r
+ public void message(String message, SimpleDateFormat sdf) {\r
String time = sdf.format(cal.getTime());\r
\r
MessageConsoleStream out = this.console.newMessageStream();\r
import org.simantics.db.Resource;\r
import org.simantics.db.WriteGraph;\r
import org.simantics.db.common.request.ObjectsWithType;\r
+import org.simantics.db.common.request.WriteRequest;\r
+import org.simantics.db.common.utils.NameUtils;\r
import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.adapter.impl.DefaultCopyHandler;\r
+import org.simantics.db.layer0.adapter.impl.DefaultPasteHandler;\r
import org.simantics.db.layer0.util.Layer0Utils;\r
import org.simantics.db.layer0.util.RemoverUtil;\r
import org.simantics.db.layer0.variable.RVI;\r
import org.simantics.db.layer0.variable.Variable;\r
import org.simantics.db.layer0.variable.Variables;\r
+import org.simantics.db.service.VirtualGraphSupport;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.modeling.ModelingResources;\r
import org.simantics.modeling.PartialIC;\r
import org.simantics.simulation.model.ExperimentLoadingFailed;\r
import org.simantics.simulation.project.IExperimentActivationListener;\r
import org.simantics.simulation.project.IExperimentManager;\r
+import org.simantics.structural.stubs.StructuralResource2;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.utils.DataContainer;\r
\r
}\r
\r
private static void processChild(ReadGraph graph, Variable child, PartialIC IC) throws DatabaseException {\r
+<<<<<<< .working\r
\r
+=======\r
+ \r
+ StructuralResource2 STR = StructuralResource2.getInstance(graph);\r
+ \r
+>>>>>>> .merge-right.r30389\r
for(Variable c : child.getChildren(graph)) {\r
- processChild(graph, c, IC);\r
+ Resource type = c.getPossibleType(graph);\r
+ if(type == null) continue;\r
+ if(graph.isInheritedFrom(type, STR.Component))\r
+ processChild(graph, c, IC);\r
}\r
Variable values = child.getPossibleProperty(graph, "values");\r
if(values == null) return;\r
SysdynResource SYSDYN = SysdynResource.getInstance(graph);\r
\r
Collection<Resource> exprs = graph.syncRequest(new ObjectsWithType(represents, L0.ConsistsOf, SYSDYN.ParameterExpression));\r
- if(exprs.size() == 0) return;\r
+ if(exprs.size() == 0) {\r
+ if(graph.hasStatement(represents, SYSDYN.Variable_isHeadOf)) return;\r
+ }\r
\r
Variable v = values.getPossibleProperty(graph, "");\r
if(v == null) return;\r
if(target != null && ds.length > 0) {\r
RVI rvi = target.getRVI(graph);\r
double initial = ds[0];\r
- System.err.println("rvi=" + rvi + " value=" + initial);\r
+// System.err.println("rvi=" + rvi + " value=" + initial);\r
IC.add(rvi, Variant.ofInstance(initial));\r
}\r
}\r
}\r
+ \r
+ public static Resource saveIC(WriteGraph graph, Variable input) throws DatabaseException {\r
+ Layer0 L0 = Layer0.getInstance(graph);\r
+ Resource model = Variables.getModel(graph, input);\r
+ String name = NameUtils.findFreshName(graph, "IC", model, L0.ConsistsOf);\r
+ return saveIC(graph, input, name);\r
+ }\r
\r
public static Resource saveIC(WriteGraph graph, Variable input, String name) throws DatabaseException {\r
graph.markUndoPoint();\r
\r
PartialIC IC = new PartialIC();\r
processChild(graph, input, IC);\r
-\r
+ \r
Layer0 L0 = Layer0.getInstance(graph);\r
ModelingResources MOD = ModelingResources.getInstance(graph);\r
Resource ic = graph.newResource();\r
graph.addLiteral(ic, L0.HasName, L0.NameOf, L0.String, name, Bindings.STRING);\r
graph.addLiteral(ic, SYSDYN.InitialCondition_HasInitialValues, SYSDYN.InitialCondition_HasInitialValues_Inverse, MOD.PartialIC, IC, PartialIC.BINDING);\r
graph.claim(model, L0.ConsistsOf, ic);\r
+\r
+ Resource represents = input.getPossibleRepresents(graph);\r
+ if(represents != null) {\r
+ Resource state = Layer0Utils.getPossibleChild(graph, represents, "__simupedia__"); \r
+ Layer0Utils.copyTo(graph, ic, state, null, new DefaultCopyHandler(state) {\r
+ \r
+ @Override\r
+ protected boolean ignoreVirtualResources() {\r
+ return false;\r
+ }\r
+ \r
+ }, new DefaultPasteHandler(ic));\r
+ }\r
\r
Layer0Utils.addCommentMetadata(graph, "Saved new Initial Condition " + name + " " + ic);\r
return ic;\r
\r
public static void assignIC(WriteGraph graph, Variable experiment, String name) throws DatabaseException {\r
graph.markUndoPoint();\r
- System.err.println("assignIC " + experiment.getURI(graph));\r
\r
Layer0 L0 = Layer0.getInstance(graph);\r
SysdynResource SYSDYN = SysdynResource.getInstance(graph);\r
\r
- Resource run = experiment.getPossibleRepresents(graph);\r
+ final Resource run = experiment.getPossibleRepresents(graph);\r
if(run == null) return;\r
Resource exp = graph.getPossibleObject(run, L0.PartOf);\r
if(exp == null) return;\r
graph.deny(exp, SYSDYN.Experiment_ic);\r
graph.claim(exp, SYSDYN.Experiment_ic, ic);\r
Layer0Utils.addCommentMetadata(graph, "Assigned Initial Condition " + graph.getRelatedValue2(ic, L0.HasName, Bindings.STRING) + " to experiment " + graph.getRelatedValue2(exp, L0.HasName, Bindings.STRING));\r
+ \r
+ Resource oldState = Layer0Utils.getPossibleChild(graph, run, "__simupedia__");\r
+ if(oldState != null) {\r
+ graph.deny(run, L0.ConsistsOf, oldState);\r
+ }\r
+ \r
+ final Resource storedState = Layer0Utils.getPossibleChild(graph, ic, "__simupedia__");\r
+ if(storedState != null) {\r
+ VirtualGraphSupport vgs = graph.getService(VirtualGraphSupport.class);\r
+ graph.syncRequest(new WriteRequest(vgs.getMemoryPersistent("experiments")) {\r
+\r
+ @Override\r
+ public void perform(WriteGraph graph) throws DatabaseException {\r
+ Layer0Utils.copyTo(graph, run, storedState, null, new DefaultCopyHandler(storedState), new DefaultPasteHandler(run));\r
+ }\r
+ \r
+ });\r
+ }\r
+ \r
}\r
\r
public static void deassignIC(WriteGraph graph, Variable experiment) throws DatabaseException {\r
\r
- System.err.println("deassignIC " + experiment.getURI(graph));\r
-\r
Layer0 L0 = Layer0.getInstance(graph);\r
SysdynResource SYSDYN = SysdynResource.getInstance(graph);\r
\r
\r
public static void applyIC(WriteGraph graph, Variable experiment, String name) throws DatabaseException {\r
\r
- System.err.println("applyIC " + experiment.getURI(graph));\r
-\r
Layer0 L0 = Layer0.getInstance(graph);\r
SysdynResource SYSDYN = SysdynResource.getInstance(graph);\r
\r
\r
Variable base = Variables.getVariable(graph, run);\r
\r
+ SysdynExperiments.setPublishResults(graph, base, false);\r
+ \r
PartialIC data = graph.getPossibleRelatedValue(ic, SYSDYN.InitialCondition_HasInitialValues, PartialIC.BINDING);\r
data.apply(graph, base);\r
+ \r
+ SysdynExperiments.setPublishResults(graph, base, true);\r
+\r
\r
}\r
\r
import gnu.trove.list.array.TDoubleArrayList;\r
import gnu.trove.map.hash.THashMap;\r
\r
+import java.util.Collection;\r
import java.util.HashMap;\r
\r
import org.eclipse.core.runtime.IProgressMonitor;\r
+import org.eclipse.core.runtime.NullProgressMonitor;\r
import org.eclipse.core.runtime.jobs.Job;\r
import org.simantics.db.AsyncReadGraph;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
+import org.simantics.db.common.utils.Logger;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.procedure.AsyncListener;\r
import org.simantics.db.request.Read;\r
\r
THashMap<String, TDoubleArrayList> results;\r
\r
- protected String[] subscription;\r
+ public String[] subscription;\r
\r
public static double DEFAULT_STEP_DURATION = 1.0;\r
public static double DEFAULT_STEP_LENGTH = 0.1;\r
this.savePer = interval;\r
}\r
\r
+ public static class Subscription {\r
+ public SysdynGameExperimentBase exp;\r
+ public int[] indexes;\r
+ public void getValues(double[] data) {\r
+ for(int i=0;i<indexes.length;i++) data[i] = exp.currentValues[indexes[i]];\r
+ }\r
+ }\r
+ \r
+ public Subscription subscribe(Collection<String> names) {\r
+ Subscription result = new Subscription();\r
+ int[] indexes = new int[names.size()];\r
+ int index = 0;\r
+ for(String name : names)\r
+ indexes[index++] = subscriptionIndexes.get(name);\r
+ result.exp = this;\r
+ result.indexes = indexes;\r
+ return result;\r
+ }\r
+ \r
public Double getCurrentValue(String name) {\r
if(subscriptionIndexes != null && name != null) {\r
Integer index = subscriptionIndexes.get(name);\r
}\r
\r
}\r
+\r
+ @Override\r
+ protected void onPublishResults() {\r
+ try {\r
+ setSubscribedResults(new NullProgressMonitor(), getSolver().getTime());\r
+ } catch (FMUJNIException e) {\r
+ Logger.defaultLogError(e);\r
+ }\r
+ ((MemoryResult)getCurrentResult()).setResult(new GameResult(this, this.results, this.subscription));\r
+ super.onPublishResults();\r
+ }\r
\r
}\r
@Override\r
public void refresh() {\r
try {\r
- setSubscribedResults(new NullProgressMonitor(), solver.getTime());\r
- \r
- ((MemoryResult)getCurrentResult()).setResult(new GameResult(this, this.results, this.subscription));\r
+ \r
+ if(publishResults) {\r
+ setSubscribedResults(new NullProgressMonitor(), solver.getTime());\r
+ ((MemoryResult)getCurrentResult()).setResult(new GameResult(this, this.results, this.subscription));\r
+ }\r
\r
resultsChanged(true);\r
} catch (Exception e) {\r
/*******************************************************************************\r
- * Copyright (c) 2010, 2013 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2013, 2014 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
import java.util.concurrent.CopyOnWriteArrayList;\r
\r
import org.simantics.Simantics;\r
+import org.simantics.databoard.Bindings;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
import org.simantics.db.Session;\r
+import org.simantics.db.WriteGraph;\r
import org.simantics.db.common.utils.NameUtils;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.exception.ManyObjectsForFunctionalRelationException;\r
import org.simantics.db.request.Read;\r
import org.simantics.db.service.VirtualGraphSupport;\r
import org.simantics.layer0.Layer0;\r
+import org.simantics.modeling.ModelingResources;\r
import org.simantics.objmap.IMapping;\r
import org.simantics.objmap.IMappingListener;\r
import org.simantics.objmap.MappingException;\r
import org.simantics.objmap.Mappings;\r
import org.simantics.project.IProject;\r
+import org.simantics.scl.runtime.function.Function2;\r
+import org.simantics.scl.runtime.function.FunctionImpl2;\r
import org.simantics.simulation.experiment.IExperiment;\r
import org.simantics.simulation.model.IModel;\r
import org.simantics.simulation.ontology.SimulationResource;\r
\r
/**\r
* Maintains a Java representation of system dynamic model.\r
- * @author Hannu Niemistö, Teemu Lempinen\r
+ * @author Hannu Niemistö, Teemu Lempinen, Tuomas Miettinen\r
*/\r
public class SysdynModel implements IModel, IMappingListener, VariableSubscriptionManager {\r
\r
\r
exp.init(g);\r
\r
+ Function2<WriteGraph, Resource, Object> scl = new FunctionImpl2<WriteGraph, Resource, Object>() {\r
+\r
+ @Override\r
+ public Object apply(WriteGraph graph, Resource run) {\r
+ try {\r
+ Layer0 L0 = Layer0.getInstance(graph);\r
+ ModelingResources MOD = ModelingResources.getInstance(graph);\r
+ Resource session = graph.newResource();\r
+ graph.claim(session, L0.InstanceOf, MOD.SCLCommandSession);\r
+ graph.addLiteral(session, L0.HasName, L0.NameOf, L0.String, "__scl__", Bindings.STRING);\r
+ graph.claim(run, L0.ConsistsOf, session);\r
+ } catch (DatabaseException e) {\r
+ e.printStackTrace();\r
+ }\r
+ return null;\r
+ }\r
+ \r
+ };\r
+ \r
VirtualGraphSupport support = g.getSession().getService(VirtualGraphSupport.class);\r
- ExperimentRuns.createRun(g.getSession(), support.getWorkspacePersistent("experiments"), experiment, exp, SysdynResource.URIs.Experiment_Run, listener, null);\r
+ ExperimentRuns.createRun(g.getSession(), support.getWorkspacePersistent("experiments"), experiment, exp, SysdynResource.URIs.Experiment_Run, listener, scl, null);\r
if(listener != null)\r
listener.onExperimentActivated(exp);\r
return exp;\r
if (element instanceof Module) {\r
Module module = (Module) element;\r
Configuration conf = module.getType().getConfiguration();\r
- String prfx = prefix + module.getName() + ".";\r
+ String prfx = prefix + module.getModelicaName() + ".";\r
inits.putAll(getInits(conf, prfx));\r
for(ParameterOverride po : module.getParameterOverrides()) {\r
inits.put(prfx + po.getVariable().getName(), po.getExpression());\r
--- /dev/null
+package org.simantics.sysdyn.modelImport;\r
+\r
+import java.io.File;\r
+\r
+import org.simantics.sysdyn.modelImport.model.Model;\r
+\r
+public interface IModelParser {\r
+ public Model parse(File file) throws Exception; \r
+}\r
import org.simantics.sysdyn.modelImport.mdl.Declaration;\r
import org.simantics.sysdyn.modelImport.mdl.Lookup;\r
import org.simantics.sysdyn.modelImport.mdl.MdlModel;\r
+import org.simantics.sysdyn.modelImport.mdl.MdlVariable;\r
import org.simantics.sysdyn.modelImport.mdl.Sketch;\r
import org.simantics.sysdyn.modelImport.mdl.SketchComment;\r
import org.simantics.sysdyn.modelImport.mdl.SketchConnection;\r
import org.simantics.sysdyn.modelImport.mdl.SketchVariable;\r
import org.simantics.sysdyn.modelImport.mdl.Subscript;\r
import org.simantics.sysdyn.modelImport.mdl.SubscriptVariable;\r
-import org.simantics.sysdyn.modelImport.mdl.MdlVariable;\r
import org.simantics.sysdyn.modelImport.model.Comment;\r
import org.simantics.sysdyn.modelImport.model.Connection;\r
import org.simantics.sysdyn.modelImport.model.Model;\r
import org.simantics.sysdyn.modelImport.model.Symbol;\r
import org.simantics.sysdyn.modelImport.model.Valve;\r
\r
-public class MdlParser {\r
+public class MdlParser implements IModelParser {\r
\r
private static final String UTF_8 = "{UTF-8}";\r
private static final String SKETCH_VERSION = "V300";\r
private static final String PARAMETER_STOP = "FINAL TIME";\r
private static final String PARAMETER_STEP = "TIME STEP";\r
\r
- public static Model parse(File file) throws Exception {\r
+ @Override\r
+ public Model parse(File file) throws Exception {\r
// generate a mdl model based on the contents of the file\r
MdlModel mdl = parseFile(file);\r
\r
\r
private static Range parseRange(String unit) {\r
Matcher matcher = Pattern.compile(\r
- "\\["+MdlUtil.DBL_G+",(\\?|"+MdlUtil.DBL_G+"|"+MdlUtil.DBL_G+","+MdlUtil.DBL_G+")\\]"\r
+ "\\[(\\?|"+MdlUtil.DBL+"),(\\?|"+MdlUtil.DBL+")(,(\\?|"+MdlUtil.DBL+"))?\\]"\r
).matcher(unit);\r
if (matcher.find()) {\r
- Double start, end, step;\r
- start = Double.parseDouble(matcher.group(1));\r
- if (matcher.group(2).equals("?")) {\r
- end = null;\r
- step = null;\r
+ Double start = null;\r
+ if (!matcher.group(1).equals("?")) {\r
+ start = Double.parseDouble(matcher.group(1));\r
}\r
- else if (matcher.group(2).contains(",")){\r
- end = Double.parseDouble(matcher.group(4));\r
- step = Double.parseDouble(matcher.group(5));\r
+ Double end = null;\r
+ if (!matcher.group(2).equals("?")) {\r
+ end = Double.parseDouble(matcher.group(2));\r
}\r
- else {\r
- end = Double.parseDouble(matcher.group(3));\r
- step = null; \r
+ Double step = null;\r
+ if (matcher.group(3) != null && !matcher.group(4).equals("?")) {\r
+ step = Double.parseDouble(matcher.group(4));\r
}\r
return new Range(start, end, step);\r
}\r
// bar[b] = 2\r
// bar[c] = 3\r
\r
+ // remove spaces, should maybe remove all whitespace\r
+ String exprstr = getExpressionString().replaceAll(" ", "");\r
+ \r
valuearray:\r
if (next == null) {\r
// number(,number)*\r
if (enumerations.size() == 1 && \r
- Pattern.matches(MdlUtil.DBL+"(,"+MdlUtil.DBL+")*", getExpressionString())) {\r
+ Pattern.matches(MdlUtil.DBL+"(,"+MdlUtil.DBL+")*", exprstr)) {\r
EnumerationExpression expr = new EnumerationExpression(enumerations);\r
\r
- String[] values = getExpressionString().split(",");\r
+ String[] values = exprstr.split(",");\r
if (enumerations.get(0).getValues().size() != values.length) {\r
// could not find a value for each enumeration index, \r
// attempt to parse the equation normally\r
}\r
// (number(,number)*;)*\r
else if (enumerations.size() == 2 && \r
- Pattern.matches("("+MdlUtil.DBL+"(,"+MdlUtil.DBL+")*;)+", getExpressionString())) {\r
+ Pattern.matches("("+MdlUtil.DBL+"(,"+MdlUtil.DBL+")*;)+", exprstr)) {\r
EnumerationExpression expr = new EnumerationExpression(enumerations);\r
\r
- String[] rows = getExpressionString().split(";");\r
+ String[] rows = exprstr.split(";");\r
if (enumerations.get(0).getValues().size() != rows.length) {\r
// could not find a value for each enumeration index \r
// in the first enumeration, attempt to parse the equation \r
public Collection<Function> getFunctions() {\r
return functions.values();\r
}\r
+ \r
+ public Resource write(WriteGraph graph, Resource project) throws DatabaseException {\r
+ return write(graph, project, new WriteContext());\r
+ }\r
\r
@Override\r
public Resource write(WriteGraph graph, Resource parent, WriteContext context) throws DatabaseException {\r
/*******************************************************************************\r
- * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2012, 2014 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
\r
// find out which delays are used in the model and create the\r
// necessary classes\r
- HashSet<Integer> delays = new HashSet<Integer>();\r
+ List<String> generated = new ArrayList<String>();\r
for (Configuration configuration : configurations) {\r
for (IElement element : configuration.getElements()) {\r
if (element instanceof IndependentVariable) {\r
- for (IExpression expression : ((IndependentVariable)element).getExpressions()) {\r
+ IndependentVariable variable = (IndependentVariable)element;\r
+ for (IExpression expression : variable.getExpressions()) {\r
if (expression instanceof DelayExpression) {\r
- delays.add(((DelayExpression)expression).getOrder());\r
+ DelayExpression delay = (DelayExpression)expression;\r
+ \r
+ int order = delay.getOrder(); \r
+ int[] dimensions = null;\r
+ \r
+ // TODO: is it cool to assume an expression is in the array\r
+ // shorthand form if the expression does not have an array range\r
+ // even though the variable has array indices? (if this \r
+ // assumption does not hold DelayExpression must be updated as well)\r
+ \r
+ if (expression.getArrayRange() == null) {\r
+ dimensions = variable.getDimensionArray();\r
+ }\r
+ \r
+ // create the appropriate delay class if it has not \r
+ // been created already\r
+ \r
+ if (!generated.contains(getDelayName(order, dimensions))) {\r
+ b.append(getDelayClass(order, dimensions));\r
+ b.append("\n");\r
+ generated.add(getDelayName(order, dimensions));\r
+ }\r
}\r
}\r
}\r
}\r
}\r
\r
- for (Integer i : delays) {\r
- b.append(getDelayClass(i));\r
- b.append("\n");\r
- }\r
-\r
HashSet<String> sheetNames = new HashSet<String>();\r
for(Sheet sheet : getSpreadSheets(configurations))\r
sheetNames.add(sheet.getModelicaName());\r
// Module\r
Module m = (Module)element; \r
modules.add(m);\r
- moduleInputs.put(m.getName(), new ArrayList<Input>());\r
+ moduleInputs.put(m.getModelicaName(), new ArrayList<Input>());\r
for(IElement e : m.getType().getConfiguration().getElements())\r
// Inputs inside the module\r
if(e instanceof Input && !((Input)e).isHeadOfDependency()) {\r
- moduleInputs.get(m.getName()).add((Input)e);\r
+ moduleInputs.get(m.getModelicaName()).add((Input)e);\r
}\r
} else if (element instanceof Input) {\r
// Input variables\r
ModuleType mt = configuration.getModuleType();\r
\r
// className == null, if this is a model configuration. model configuration start and end are written in ModelicaWriter.write\r
- String className = mt != null ? (mt.getName().replace(" ", "")) : null;\r
+ String className = mt != null ? (mt.getModelicaName()) : null;\r
\r
if(className != null)\r
b.append("class "+className+"\n");\r
Module module = (Module)dependency.getHead();\r
Input reference = (Input)dependency.refersTo();\r
if(reference != null && reference.getName() != null && (reference.getVariability() == null || reference.getVariability().isEmpty())) {\r
- b.append(" " + module.getName() + "." + reference.getModelicaName() + " = " + variable.getModelicaName() + ";\n");\r
- moduleInputs.get(module.getName()).remove(reference);\r
+ b.append(" " + module.getModelicaName() + "." + reference.getModelicaName() + " = " + variable.getModelicaName() + ";\n");\r
+ moduleInputs.get(module.getModelicaName()).remove(reference);\r
}\r
}\r
\r
if(configuration.isGameConfiguration() && !modules.isEmpty()) {\r
b.append("// Time values for module\n");\r
for(Module m : modules) {\r
- b.append(" " + m.getName() + ".time = time;\n");\r
+ b.append(" " + m.getModelicaName() + ".time = time;\n");\r
}\r
}\r
}\r
String expression;\r
// If reference exists, use reference name. Otherwise, use default value.\r
if(reference != null && reference.getName() != null)\r
- expression = module.getName() + "." + reference.getModelicaName() + ";\n";\r
+ expression = module.getModelicaName() + "." + reference.getModelicaName() + ";\n";\r
\r
else\r
expression = input.getDefaultInputValue() + ";\n";\r
\r
public static final String DELAY_TIME = "delayTime";\r
public static final String DELAY_INITIAL = "initialValue";\r
-\r
- private static String getDelayClass(int order) {\r
+ \r
+ private static String getDelayClass(int order, int...dimensions) {\r
+ boolean array = dimensions != null && dimensions.length > 0;\r
+ \r
StringBuilder buffer = new StringBuilder();\r
\r
- buffer.append("class " + getDelayName(order) + "\n");\r
+ buffer.append("class ").append(getDelayName(order, dimensions)).append("\n");\r
\r
// variable block\r
\r
// (possibly) continuous auxiliary variable\r
- buffer.append("\tReal DL;\n");\r
+ buffer.append('\t')\r
+ .append(getReal("DL")).append(";\n");\r
// (possibly) continuous delay time\r
- buffer.append("\tReal " + DELAY_TIME + ";\n");\r
+ buffer.append('\t')\r
+ .append(getReal(DELAY_TIME)).append(";\n");\r
// (possibly) continuous initial value\r
- buffer.append("\tReal " + DELAY_INITIAL + ";\n");\r
+ buffer.append('\t')\r
+ .append(getReal(DELAY_INITIAL, dimensions)).append(";\n");\r
\r
// first valve\r
- buffer.append("\tReal " + getDelayValve(0) + ";\n");\r
+ buffer.append('\t')\r
+ .append(getReal(getDelayValve(0), dimensions)).append(";\n");\r
\r
// stocks and valves, valves are delayed values of the variable\r
for (int i = 1; i <= order; i++) {\r
- buffer.append("\tReal LV"+i + "(fixed=false);\n");\r
- buffer.append("\tReal "+ getDelayValve(i) + ";\n");\r
+ buffer.append('\t')\r
+ .append(getReal("LV"+i, dimensions)).append(' ')\r
+ .append("(" + (array ? "each " : "") + "fixed=false)").append(";\n");\r
+ buffer.append('\t')\r
+ .append(getReal(getDelayValve(i), dimensions)).append(";\n");\r
}\r
\r
// initial equation block\r
\r
// Each stock gets the same initial value\r
for (int i = 1; i <= order; i++) {\r
- buffer.append("\tLV"+i + " = DL * " + DELAY_INITIAL + ";\n");\r
+ buffer.append('\t')\r
+ .append("LV"+i)\r
+ .append(" = ")\r
+ .append("DL" + (array ? " .* " : " * ") + DELAY_INITIAL)\r
+ .append(";\n");\r
}\r
\r
// equation block\r
buffer.append("equation\n");\r
\r
- buffer.append("\tDL = " + DELAY_TIME + " / "+order+";\n");\r
-\r
+ buffer.append('\t')\r
+ .append("DL")\r
+ .append(" = ")\r
+ .append(DELAY_TIME +" / " + order)\r
+ .append(";\n");\r
+ \r
// valves and stocks\r
for (int i = 1; i <= order; i++) {\r
- buffer.append("\tder(LV"+i + ") = - " + getDelayValve(i) + " + " + getDelayValve(i-1) + ";\n");\r
- buffer.append("\t"+ getDelayValve(i) + " = LV"+i + " / DL;\n");\r
+ buffer.append('\t')\r
+ .append("der(LV"+i + ")")\r
+ .append(" = ")\r
+ .append("-" + getDelayValve(i) + (array ? " .+ " : " + ") + getDelayValve(i-1))\r
+ .append(";\n");\r
+ buffer.append('\t')\r
+ .append(getDelayValve(i))\r
+ .append(" = ")\r
+ .append("LV"+i + (array ? " ./ " : " / ") + "DL")\r
+ .append(";\n");\r
}\r
\r
- buffer.append("end ");\r
- buffer.append(getDelayName(order));\r
- buffer.append(";\n");\r
+ buffer.append("end ").append(getDelayName(order, dimensions)).append(";\n");\r
\r
return buffer.toString();\r
}\r
-\r
- public static String getDelayName(int order) {\r
- return "order_"+order+"_delay";\r
+ \r
+ private static String getReal(String name, int...dims) {\r
+ StringBuilder buffer = new StringBuilder();\r
+ buffer.append("Real ").append(name);\r
+ if (dims != null && dims.length > 0) {\r
+ buffer.append('[');\r
+ for (int i = 0; i < dims.length; i++) {\r
+ if (i > 0) buffer.append(',');\r
+ buffer.append(dims[i]);\r
+ }\r
+ buffer.append(']');\r
+ }\r
+ return buffer.toString();\r
+ }\r
+ \r
+ public static String getDelayName(int order, int...dims) {\r
+ StringBuilder buffer = new StringBuilder();\r
+ buffer.append("o_").append(order).append('_');\r
+ if (dims != null && dims.length > 0) {\r
+ buffer.append("d_");\r
+ for (int dim : dims) buffer.append(dim).append('_');\r
+ }\r
+ buffer.append("delay");\r
+ return buffer.toString();\r
}\r
\r
public static String getDelayValve(int order) {\r
/*******************************************************************************\r
- * Copyright (c) 2010, 2012 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2012, 2014 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
public String getName() {\r
return name;\r
}\r
+ \r
+ /**\r
+ * Get Modelica compliant name\r
+ * @return The name of this variable with spaces (' ') replaced with \r
+ * underscore characters ('_')\r
+ */\r
+ public String getModelicaName() {\r
+ if (this.name == null)\r
+ return null;\r
+ return this.name.replace(' ', '_');\r
+ }\r
\r
public ModuleType getType() {\r
return type;\r
}\r
\r
sb.append(" ");\r
- sb.append(getType().getName());\r
+ sb.append(getType().getModelicaName());\r
sb.append(" ");\r
- sb.append(getName());\r
+ sb.append(getModelicaName());\r
sb.append(redeclarations.toString()); // possible redeclarations\r
sb.append(";\n");\r
return sb.toString();\r
/*******************************************************************************\r
- * Copyright (c) 2010, 2012 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2012, 2014 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
* Representation of a module type\r
* \r
* @author Teemu Lempinen\r
+ * @author Tuomas Miettinen\r
*\r
*/\r
@GraphType(StructuralResource2.URIs.ComponentType)\r
\r
@RelatedElement(Layer0.URIs.PartOf)\r
protected Object parent;\r
-\r
+ \r
+ /**\r
+ * Get Modelica compliant name\r
+ * @return The name of this variable with spaces (' ') replaced with \r
+ * underscore characters ('_')\r
+ */\r
+ public String getModelicaName() {\r
+ if (this.name == null)\r
+ return null;\r
+ return this.name.replace(' ', '_');\r
+ }\r
+ \r
public String getName() {\r
return name;\r
}\r
return this.arrayIndexes;\r
}\r
\r
+ public int[] getDimensionArray() {\r
+ if (arrayIndexes == null)\r
+ return null;\r
+ \r
+ int[] dimensions = new int[arrayIndexes.size()];\r
+ for (int i = 0; i < arrayIndexes.size(); i++) {\r
+ dimensions[i] = arrayIndexes.get(i).getEnumerationIndexes().size();\r
+ }\r
+ return dimensions;\r
+ }\r
+ \r
/**\r
* \r
* @return Expressions of this variable\r
@Override\r
public String getDeclarationAddition() {\r
// instantiate the correct delay class for this expression\r
- return "\t" + ModelicaWriter.getDelayName(order) + " " + instance() + ";\n";\r
+ \r
+ // TODO: this is not necessary correct, see discussion in delay class \r
+ // generation code in ModelicaWriter.java\r
+ int[] dimensions = null;\r
+ if (getArrayRange() == null) {\r
+ dimensions = getParent().getDimensionArray();\r
+ }\r
+ \r
+ return "\t" + ModelicaWriter.getDelayName(order, dimensions) + " " + instance() + ";\n";\r
}\r
\r
@Override\r
\r
@Override\r
public String getArrayRange() {\r
- if(range == null)\r
- return "";\r
- else\r
- return range;\r
+ return range;\r
}\r
\r
@Override\r
\r
@Override\r
public String validateUnits(ReadGraph graph, SysdynModel model) {\r
- return UnitUtils.matchUnits(graph, model, parent.getParentConfiguration(), parent.getUnit(), getExpression());\r
+ return UnitUtils.matchUnits(graph, model, parent.getParentConfiguration(), parent.getUnit(), getExpression());\r
}\r
\r
@Override\r
import org.simantics.sysdyn.representation.Shadow;\r
import org.simantics.sysdyn.representation.Variable;\r
import org.simantics.sysdyn.unitParser.ParseException;\r
+import org.simantics.sysdyn.unitParser.TokenMgrError;\r
import org.simantics.sysdyn.unitParser.UnitCheckingException;\r
import org.simantics.sysdyn.unitParser.UnitCheckingNode;\r
import org.simantics.sysdyn.unitParser.UnitParser;\r
}\r
} catch (ParseException e) {\r
return "Cannot validate units: Syntax error in expression.";\r
+ } catch (TokenMgrError e) {\r
+ return "Cannot validate units: Syntax error in expression.";\r
}\r
return null;\r
}\r
package org.simantics.sysdyn.solver;\r
\r
-import org.eclipse.core.runtime.preferences.ConfigurationScope;\r
-import org.osgi.service.prefs.Preferences;\r
+import org.eclipse.core.runtime.Platform;\r
\r
public class SolverSettings {\r
\r
public static final String SOLVER_TYPE_OPENMODELICA = "OPENMODELICA";\r
\r
public static SolverType getSelectedSolverType() {\r
- Preferences preferences = ConfigurationScope.INSTANCE.getNode(SolverSettings.QUALIFIER);\r
- // default to internal solver\r
- String type = preferences.get(SolverSettings.SOLVER_TYPE, SolverSettings.SOLVER_TYPE_INTERNAL);\r
+ String type = Platform.getPreferencesService().getString(QUALIFIER, SOLVER_TYPE, null, null);\r
\r
+ if (type == null) {\r
+ // solver type is not set, should not happen since the default \r
+ // value should be in plugin_customization.ini\r
+ return SolverType.OPENMODELICA;\r
+ }\r
if (SOLVER_TYPE_INTERNAL.equals(type)) {\r
return SolverType.INTERNAL;\r
}\r
import org.simantics.databoard.util.Base64;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
+import org.simantics.db.common.request.BinaryRead;\r
import org.simantics.db.common.request.ObjectsWithSupertype;\r
import org.simantics.db.common.request.UniqueRead;\r
import org.simantics.db.common.request.WriteRequest;\r
\r
}\r
\r
- public static org.simantics.db.layer0.variable.Variable lastValue2(ReadGraph graph, org.simantics.db.layer0.variable.Variable run, String path) throws DatabaseException {\r
+ public static org.simantics.db.layer0.variable.Variable lastValue2(ReadGraph graph, org.simantics.db.layer0.variable.Variable input, String path) throws DatabaseException {\r
\r
- if(run == null) return null;\r
+ if(input == null) return null;\r
+ \r
+ org.simantics.db.layer0.variable.Variable context = Variables.getPossibleContext(graph, input);\r
+ if(context == null) {\r
+ context = Variables.getConfigurationContext(graph, input);\r
+ if(context == null) return null;\r
+ }\r
\r
- org.simantics.db.layer0.variable.Variable v = run.browsePossible(graph, "/" + path);\r
+ org.simantics.db.layer0.variable.Variable v = context.browsePossible(graph, "/" + path);\r
if(v == null) return null;\r
\r
org.simantics.db.layer0.variable.Variable p = v.browsePossible(graph, "#value#$0");\r
\r
}\r
\r
+ public static org.simantics.db.layer0.variable.Variable currentValue(ReadGraph graph, org.simantics.db.layer0.variable.Variable input, String path) throws DatabaseException {\r
+ \r
+ if(input == null) return null;\r
+ \r
+ org.simantics.db.layer0.variable.Variable context = Variables.getPossibleContext(graph, input);\r
+ if(context == null) {\r
+ context = Variables.getConfigurationContext(graph, input);\r
+ if(context == null) return null;\r
+ }\r
+\r
+ org.simantics.db.layer0.variable.Variable v = context.browsePossible(graph, "/" + path);\r
+ if(v == null) return null;\r
+\r
+ org.simantics.db.layer0.variable.Variable p = v.browsePossible(graph, "#value#$0");\r
+ if(p == null) return null;\r
+ \r
+ return p;\r
+ \r
+ }\r
+ \r
/**\r
* Splits indexed variable reference into name and indices part.\r
* \r
\r
}\r
\r
- public static org.simantics.db.layer0.variable.Variable lastValueIndexed(ReadGraph graph, org.simantics.db.layer0.variable.Variable run, String path) throws DatabaseException {\r
- \r
- if(run == null) return null;\r
+ public static class LastValueIndexed extends BinaryRead<Resource, String, org.simantics.db.layer0.variable.Variable> {\r
\r
- Pair<String, String> nameAndIndices = splitToNameAndIndices(path);\r
+ public LastValueIndexed(Resource resource, String path) {\r
+ super(resource, path);\r
+ }\r
\r
- org.simantics.db.layer0.variable.Variable v = run.browsePossible(graph, "/" + nameAndIndices.first + "#value#" + nameAndIndices.second);\r
- if(v == null) throw new MissingVariableException("No variable for SysDyn reference path: " + path);\r
- \r
- return v;\r
+ @Override\r
+ public org.simantics.db.layer0.variable.Variable perform(ReadGraph graph) throws DatabaseException {\r
+ \r
+ org.simantics.db.layer0.variable.Variable run = Variables.getVariable(graph, parameter);\r
+ Pair<String, String> nameAndIndices = splitToNameAndIndices(parameter2);\r
+ org.simantics.db.layer0.variable.Variable v = run.browsePossible(graph, "/" + nameAndIndices.first + "#value#" + nameAndIndices.second);\r
+ if(v == null) throw new MissingVariableException("No variable for SysDyn reference path: " + parameter2);\r
+ return v;\r
+ }\r
+ }\r
+ \r
+ \r
+ public static org.simantics.db.layer0.variable.Variable lastValueIndexed(ReadGraph graph, org.simantics.db.layer0.variable.Variable run, String path) throws DatabaseException {\r
+ if(run == null) return null;\r
+ return graph.syncRequest(new LastValueIndexed(run.getRepresents(graph), path));\r
} \r
\r
- public static org.simantics.db.layer0.variable.Variable equation(ReadGraph graph, org.simantics.db.layer0.variable.Variable run, String path) throws DatabaseException {\r
+ public static org.simantics.db.layer0.variable.Variable equation(ReadGraph graph, org.simantics.db.layer0.variable.Variable input, String path) throws DatabaseException {\r
\r
- if(run == null) return null;\r
+ if(input == null) return null;\r
+ \r
+ org.simantics.db.layer0.variable.Variable context = Variables.getPossibleContext(graph, input);\r
+ if(context == null) {\r
+ context = Variables.getConfigurationContext(graph, input);\r
+ if(context == null) return null;\r
+ }\r
\r
- org.simantics.db.layer0.variable.Variable v = run.browsePossible(graph, "/" + path);\r
+ org.simantics.db.layer0.variable.Variable v = context.browsePossible(graph, "/" + path);\r
if(v == null) return null;\r
\r
org.simantics.db.layer0.variable.Variable p = v.browsePossible(graph, "#equation");\r
for(ModelDependency dependency : dependenciesBean.dependencies) {\r
Resource existing = session.sync(new PossibleResource(dependency.uri));\r
if(existing == null) {\r
- MigrationUtils.importSharedOntology(session, dependency.tg);\r
+ MigrationUtils.importSharedOntology(session, dependency.tg, false);\r
}\r
}\r
}\r