From a1515a49a63633114bc4240483523c4a4cfed15e Mon Sep 17 00:00:00 2001 From: jsimomaa Date: Thu, 16 Oct 2014 08:06:44 +0000 Subject: [PATCH] Merged trunk@30110, @30126, @30139, @30147, @30190, @30206, @30230, @30233 to branches/sysdyn-1.8 on 2014-10-16 for 1.8.2 release. refs #5178 refs #5197 refs #5227 refs #5261 refs #5278 refs #5275 git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/branches/1.8@30424 ac1ea38d-2e2b-0410-8846-a27921b304fc --- org.simantics.sysdyn/META-INF/MANIFEST.MF | 1 - .../sysdyn/adapter/IndexVariable.java | 112 +-- .../sysdyn/adapter/ValueIndexVariable.java | 11 + .../adapter/ValueIndexVariableBase.java | 25 +- .../sysdyn/adapter/ValueIndexVariableI.java | 7 + .../sysdyn/adapter/VariableRVIUtils.java | 46 +- .../expressionParser/ExpressionParser.java | 674 ++++++++++-------- .../expressionParser/ExpressionParser.jj | 2 +- .../sysdyn/manager/OldSysdynExperiment.java | 37 +- .../sysdyn/manager/SysdynConsole.java | 14 +- .../sysdyn/manager/SysdynExperiments.java | 76 +- .../manager/SysdynGameExperimentBase.java | 35 +- .../manager/SysdynGameExperimentInternal.java | 8 +- .../simantics/sysdyn/manager/SysdynModel.java | 32 +- .../sysdyn/modelImport/IModelParser.java | 9 + .../sysdyn/modelImport/MdlParser.java | 7 +- .../sysdyn/modelImport/mdl/MdlVariable.java | 22 +- .../modelImport/mdl/SubscriptVariable.java | 11 +- .../sysdyn/modelImport/model/Model.java | 4 + .../sysdyn/modelica/ModelicaWriter.java | 133 +++- .../sysdyn/representation/Module.java | 17 +- .../sysdyn/representation/ModuleType.java | 16 +- .../sysdyn/representation/Variable.java | 11 + .../expressions/DelayExpression.java | 10 +- .../expressions/Expression.java | 7 +- .../representation/utils/UnitUtils.java | 3 + .../sysdyn/solver/SolverSettings.java | 12 +- .../sysdyn/utils/DocumentationUtils.java | 72 +- .../sysdyn/utils/imports/ImportUtils.java | 2 +- 29 files changed, 939 insertions(+), 477 deletions(-) create mode 100644 org.simantics.sysdyn/src/org/simantics/sysdyn/modelImport/IModelParser.java diff --git a/org.simantics.sysdyn/META-INF/MANIFEST.MF b/org.simantics.sysdyn/META-INF/MANIFEST.MF index 886074f7..66b45852 100644 --- a/org.simantics.sysdyn/META-INF/MANIFEST.MF +++ b/org.simantics.sysdyn/META-INF/MANIFEST.MF @@ -27,7 +27,6 @@ Require-Bundle: org.simantics.objmap;bundle-version="0.1.0", 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", diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/IndexVariable.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/IndexVariable.java index 606b9f33..bf71e39f 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/IndexVariable.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/IndexVariable.java @@ -38,6 +38,7 @@ public abstract class IndexVariable extends AbstractPropertyVariable { protected HashMap rvis; protected String indexes; protected VariableSubscriptionManager subscriptionManager; + protected Pair,ArrayList> variableNameArrays; public IndexVariable(ReadGraph graph, Variable parent, String indexes) throws DatabaseException { this.parent = parent; @@ -164,68 +165,83 @@ public abstract class IndexVariable extends AbstractPropertyVariable { } protected void ensureInformationAvailable(ReadGraph graph) throws DatabaseException { - SimulationResource SIMU = SimulationResource.getInstance(graph); - ModelingResources MOD = ModelingResources.getInstance(graph); if(model == null) { + SimulationResource SIMU = SimulationResource.getInstance(graph); Resource modelResource = Variables.getModel(graph, parent); Resource configuration = graph.getPossibleObject(modelResource, SIMU.HasConfiguration); model = SysdynModelManager.getInstance(graph.getSession()).getModel(graph, configuration); } - - Variable var = parent.getParent(graph); - Resource represents = var.getRepresents(graph); - - Resource activeRun = null; - if(represents != null) { - do { - if(graph.isInstanceOf(represents, SIMU.Run)) { - activeRun = represents; - break; - } - var = var.getParent(graph); - represents = var.getRepresents(graph); - } while(represents != null && !graph.isInstanceOf(represents, MOD.StructuralModel)); - } - IProject project = Simantics.peekProject(); - if(activeRun != null && project != null) { - IExperimentManager expMan = project.getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER); - IExperiment e = expMan.getExperiment(NameUtils.getSafeName(graph, activeRun)); - if(e instanceof SysdynExperiment) - this.experiment = (SysdynExperiment)e; + if(this.experiment == null || this.subscriptionManager == null) { + SimulationResource SIMU = SimulationResource.getInstance(graph); + ModelingResources MOD = ModelingResources.getInstance(graph); + Variable var = parent.getParent(graph); + Resource represents = var.getRepresents(graph); + Resource activeRun = null; + if(represents != null) { + do { + if(graph.isInstanceOf(represents, SIMU.Run)) { + activeRun = represents; + break; + } + var = var.getParent(graph); + represents = var.getRepresents(graph); + } while(represents != null && !graph.isInstanceOf(represents, MOD.StructuralModel)); + } + + IProject project = Simantics.peekProject(); + if(activeRun != null && project != null) { + IExperimentManager expMan = project.getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER); + IExperiment e = expMan.getExperiment(NameUtils.getSafeName(graph, activeRun)); + if(e instanceof SysdynExperiment) + this.experiment = (SysdynExperiment)e; + } + this.subscriptionManager = getSubscriptionManager(); } - this.subscriptionManager = getSubscriptionManager(); - rvi = Variables.getPossibleRVI(graph, this); + if(rvi == null) + rvi = Variables.getPossibleRVI(graph, this); + if(rvi != null) - rvis = VariableRVIUtils.getActiveRVIs(graph, parent.getParent(graph)); + rvis = graph.syncRequest(new VariableRVIUtils.GetActiveRVIs(parent.getParent(graph))); //VariableRVIUtils.getActiveRVIs(graph, parent.getParent(graph)); + } private Pair,ArrayList> getVariableNameArrays() { - Pair,ArrayList> result = new Pair,ArrayList>(new ArrayList(), new ArrayList()); - if(rvi == null || rvis == null) - return result; - if(rvi.indexOf('#') > 0) - rvi = rvi.substring(0, rvi.indexOf('#')); - - String test = rvi; - if(indexes != null && !indexes.isEmpty()) { - String regexIndexes = indexes.trim().replaceAll(":", "[a-zA-Z0-9_]*"); // Why was there was ".replace('.', ',')" ? - Removed by Teemu 2.9.2012 - test = rvi + "\\[" + regexIndexes + "\\]"; - } else { - test = rvi + "(\\[.*\\])?"; - } - for(String k : rvis.keySet()) { - String value = rvis.get(k); - if(k.matches(test) || value.matches(test)) { - result.first.add(k.substring(1).replace("/", ".").replace("%20", "_")); - result.second.add(value.substring(1).replace("/", ".").replace("%20", " ")); - } - } - - return result; + if(variableNameArrays == null) { + + Pair,ArrayList> result = new Pair,ArrayList>(new ArrayList(), new ArrayList()); + if(rvi != null && rvis != null) { + + if(rvi.indexOf('#') > 0) + rvi = rvi.substring(0, rvi.indexOf('#')); + + String test = rvi; + if(indexes != null && !indexes.isEmpty()) { + String regexIndexes = indexes.trim().replaceAll(":", "[a-zA-Z0-9_]*"); // Why was there was ".replace('.', ',')" ? - Removed by Teemu 2.9.2012 + test = rvi + "\\[" + regexIndexes + "\\]"; + } else { + test = rvi + "(\\[.*\\])?"; + } + for(String k : rvis.keySet()) { + String value = rvis.get(k); + if(k.matches(test) || value.matches(test)) { + result.first.add(k.substring(1).replace("/", ".").replace("%20", "_")); + result.second.add(value.substring(1).replace("/", ".").replace("%20", " ")); + } + } + + variableNameArrays = result; + + } + + } + + if(variableNameArrays == null) return new Pair,ArrayList>(new ArrayList(), new ArrayList()); + + return variableNameArrays; } diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariable.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariable.java index 6fb6f77d..e2ab2e44 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariable.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariable.java @@ -1,5 +1,7 @@ package org.simantics.sysdyn.adapter; +import org.simantics.databoard.Datatypes; +import org.simantics.databoard.type.Datatype; import org.simantics.db.ReadGraph; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.variable.Variable; @@ -28,4 +30,13 @@ public class ValueIndexVariable extends ValueIndexVariableBase { } } + @Override + public Datatype getDatatype(ReadGraph graph) throws DatabaseException { + if (scalar) { + return Datatypes.DOUBLE; + } else { + return Datatypes.DOUBLE_ARRAY; + } + } + } diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableBase.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableBase.java index 0b308f70..cbb948bc 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableBase.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableBase.java @@ -14,6 +14,7 @@ import org.simantics.simulation.experiment.ExperimentState; import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.manager.SysdynDataSet; import org.simantics.sysdyn.manager.SysdynGameExperimentBase; +import org.simantics.sysdyn.manager.SysdynGameExperimentBase.Subscription; import org.simantics.sysdyn.manager.SysdynResult; import org.simantics.sysdyn.solver.ISolver; @@ -22,31 +23,45 @@ abstract public class ValueIndexVariableBase extends IndexVariable { public ValueIndexVariableBase(ReadGraph graph, Variable parent, String indexes) throws DatabaseException { super(graph, parent, indexes); + ensureInformationAvailable(graph); + if(experiment instanceof SysdynGameExperimentBase) { + s = ((SysdynGameExperimentBase) experiment).subscribe(getVariableNamesWithIndexNumbers()); + } } public static double[] UNRESOLVED = new double[0]; + public Subscription s; + public double[] getValueFull() { + if(experiment == null) return UNRESOLVED; + if(experiment instanceof SysdynGameExperimentBase) { + double[] arr = new double[s.indexes.length]; + s.getValues(arr); + return arr; + } + + Collection results = experiment.getActiveResults(); ArrayList variableNames = getVariableNamesWithIndexNumbers(); double[] result = new double[variableNames.size()]; for(int i = 0; i < variableNames.size(); i++) { for(SysdynResult r : results) { - if(experiment instanceof SysdynGameExperimentBase) { - Double d = ((SysdynGameExperimentBase)experiment).getCurrentValue(variableNames.get(i)); - result[i] = d != null ? d : 0; - } else { +// if(experiment instanceof SysdynGameExperimentBase) { +// Double d = ((SysdynGameExperimentBase)experiment).getCurrentValue(variableNames.get(i)); +// result[i] = d != null ? d : 0; +// } else { SysdynDataSet ds = r.getDataSet(variableNames.get(i)); if(ds != null && ds.values != null && ds.values.length > 0) { result[i] = ds.values[ds.values.length-1]; } else { return UNRESOLVED; } - } +// } } } return result; diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableI.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableI.java index c414f3d6..baed93ed 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableI.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableI.java @@ -2,7 +2,9 @@ package org.simantics.sysdyn.adapter; import java.util.Arrays; +import org.simantics.databoard.Datatypes; import org.simantics.databoard.binding.Binding; +import org.simantics.databoard.type.Datatype; import org.simantics.db.ReadGraph; import org.simantics.db.WriteGraph; import org.simantics.db.exception.DatabaseException; @@ -48,4 +50,9 @@ public class ValueIndexVariableI extends ValueIndexVariableBase { return "$" + index; } + @Override + public Datatype getDatatype(ReadGraph graph) throws DatabaseException { + return Datatypes.DOUBLE; + } + } diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/VariableRVIUtils.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/VariableRVIUtils.java index 0f24cc58..7b6a68bc 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/VariableRVIUtils.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/VariableRVIUtils.java @@ -22,6 +22,7 @@ import org.simantics.db.Resource; import org.simantics.db.common.request.ObjectsWithType; import org.simantics.db.common.utils.ListUtils; import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.request.VariableRead; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.Variables; import org.simantics.layer0.Layer0; @@ -158,30 +159,39 @@ public class VariableRVIUtils { * @throws DatabaseException */ public static HashMap getActiveRVIs(ReadGraph graph, Variable variable) throws DatabaseException { - HashMap rvis = new LinkedHashMap(); - - SysdynResource sr = SysdynResource.getInstance(graph); + return graph.syncRequest(new GetActiveRVIs(variable)); + } + + public static class GetActiveRVIs extends VariableRead> { - String rvi = Variables.getRVI(graph, variable); + public GetActiveRVIs(Variable variable) { + super(variable); + } - Resource r = variable.getRepresents(graph); + @Override + public HashMap perform(ReadGraph graph) throws DatabaseException { + HashMap rvis = new LinkedHashMap(); - Resource arrayIndexes = graph.getPossibleObject(r, sr.Variable_arrayIndexesList); - if(arrayIndexes == null) { - // If variable is single-dimensional, use the same rvi - rvis.put(rvi, rvi); - } else { - // If variable is multidimensional, get all indexes that are active and add them to rvis-map - List arrayIndexList = ListUtils.toList(graph, arrayIndexes); - resolveActiveArrayIndexes(graph, variable, arrayIndexList); + SysdynResource sr = SysdynResource.getInstance(graph); + String rvi = Variables.getRVI(graph, variable); + Resource r = variable.getRepresents(graph); - if(arrayIndexList.size() > 0) - traverseIndexes(graph, rvi, rvis, arrayIndexList); - else + Resource arrayIndexes = graph.getPossibleObject(r, sr.Variable_arrayIndexesList); + if(arrayIndexes == null) { + // If variable is single-dimensional, use the same rvi rvis.put(rvi, rvi); - } + } else { + // If variable is multidimensional, get all indexes that are active and add them to rvis-map + List arrayIndexList = ListUtils.toList(graph, arrayIndexes); + resolveActiveArrayIndexes(graph, variable, arrayIndexList); - return rvis; + if(arrayIndexList.size() > 0) + traverseIndexes(graph, rvi, rvis, arrayIndexList); + else + rvis.put(rvi, rvi); + } + return rvis; + } } diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.java index 5b37fb68..88dd5eb5 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.java @@ -598,6 +598,7 @@ public class ExpressionParser implements ExpressionParserConstants { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 6: case 12: + case 26: case 31: case 33: case 35: @@ -642,6 +643,7 @@ public class ExpressionParser implements ExpressionParserConstants { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 6: case 12: + case 26: case 31: case 33: case 35: @@ -657,7 +659,59 @@ public class ExpressionParser implements ExpressionParserConstants { case STRING: case UNSIGNED_INTEGER: case UNSIGNED_NUMBER: - expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 31: + case 33: + case 35: + case 60: + case 62: + case 64: + case 76: + case 77: + case 78: + case 79: + case IDENT: + case QIDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + expression(); + break; + case 26: + jj_consume_token(26); + name(); + jj_consume_token(60); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IDENT: + case QIDENT: + named_argument(); + label_8: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 69: + ; + break; + default: + jj_la1[28] = jj_gen; + break label_8; + } + jj_consume_token(69); + named_argument(); + } + break; + default: + jj_la1[29] = jj_gen; + ; + } + jj_consume_token(61); + break; + default: + jj_la1[30] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 21: case 69: @@ -671,18 +725,18 @@ public class ExpressionParser implements ExpressionParserConstants { for_indices(); break; default: - jj_la1[28] = jj_gen; + jj_la1[31] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: - jj_la1[29] = jj_gen; + jj_la1[32] = jj_gen; ; } break; default: - jj_la1[30] = jj_gen; + jj_la1[33] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -691,15 +745,15 @@ public class ExpressionParser implements ExpressionParserConstants { final public void for_indices() throws ParseException { for_index(); - label_8: + label_9: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 69: ; break; default: - jj_la1[31] = jj_gen; - break label_8; + jj_la1[34] = jj_gen; + break label_9; } jj_consume_token(69); for_index(); @@ -723,7 +777,7 @@ public class ExpressionParser implements ExpressionParserConstants { forRanges.add(forRange); break; default: - jj_la1[32] = jj_gen; + jj_la1[35] = jj_gen; ; } forIndex = false; @@ -763,18 +817,18 @@ void named_arguments() : { expression(); break; default: - jj_la1[33] = jj_gen; + jj_la1[36] = jj_gen; ; } - label_9: + label_10: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 69: ; break; default: - jj_la1[34] = jj_gen; - break label_9; + jj_la1[37] = jj_gen; + break label_10; } jj_consume_token(69); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -798,7 +852,7 @@ void named_arguments() : { expression(); break; default: - jj_la1[35] = jj_gen; + jj_la1[38] = jj_gen; ; } } @@ -806,15 +860,15 @@ void named_arguments() : { final public void expression_list() throws ParseException { expression(); - label_10: + label_11: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 69: ; break; default: - jj_la1[36] = jj_gen; - break label_10; + jj_la1[39] = jj_gen; + break label_11; } jj_consume_token(69); expression(); @@ -829,15 +883,15 @@ void named_arguments() : { currentRange = new ArrayList(); jj_consume_token(64); subscript(currentRange); - label_11: + label_12: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 69: ; break; default: - jj_la1[37] = jj_gen; - break label_11; + jj_la1[40] = jj_gen; + break label_12; } jj_consume_token(69); subscript(currentRange); @@ -856,7 +910,7 @@ void named_arguments() : { currentRange.add(token); break; default: - jj_la1[40] = jj_gen; + jj_la1[43] = jj_gen; if (jj_2_3(2147483647)) { functionCall = null; name(); @@ -878,7 +932,7 @@ void named_arguments() : { rangeIndex(rangeToken, false, ":"); break; default: - jj_la1[38] = jj_gen; + jj_la1[41] = jj_gen; ; } rangeToken.endColumn = token.endColumn; @@ -889,15 +943,15 @@ void named_arguments() : { jj_consume_token(62); rangeToken.image = rangeToken.image + token.image; rangeIndex(rangeToken, true, ","); - label_12: + label_13: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 69: ; break; default: - jj_la1[39] = jj_gen; - break label_12; + jj_la1[42] = jj_gen; + break label_13; } jj_consume_token(69); rangeIndex(rangeToken, false, ","); @@ -909,7 +963,7 @@ void named_arguments() : { rangeToken.image = rangeToken.image + token.image; break; default: - jj_la1[41] = jj_gen; + jj_la1[44] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -932,7 +986,7 @@ void named_arguments() : { rangeToken.image = rangeToken.image + identToken; break; default: - jj_la1[42] = jj_gen; + jj_la1[45] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -959,30 +1013,30 @@ void named_arguments() : { finally { jj_save(2, xla); } } - private boolean jj_3R_74() { - if (jj_scan_token(67)) return true; - if (jj_3R_73()) return true; + private boolean jj_3R_32() { + if (jj_scan_token(9)) return true; + if (jj_3R_31()) return true; return false; } - private boolean jj_3R_35() { - if (jj_3R_39()) return true; + private boolean jj_3R_36() { + if (jj_3R_40()) return true; return false; } - private boolean jj_3R_33() { + private boolean jj_3R_34() { Token xsp; xsp = jj_scanpos; - if (jj_3R_35()) jj_scanpos = xsp; - if (jj_3R_36()) return true; + if (jj_3R_36()) jj_scanpos = xsp; + if (jj_3R_37()) return true; while (true) { xsp = jj_scanpos; - if (jj_3R_37()) { jj_scanpos = xsp; break; } + if (jj_3R_38()) { jj_scanpos = xsp; break; } } return false; } - private boolean jj_3R_38() { + private boolean jj_3R_39() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(70)) { @@ -1004,397 +1058,445 @@ void named_arguments() : { return false; } - private boolean jj_3R_16() { - if (jj_scan_token(66)) return true; - if (jj_3R_13()) return true; + private boolean jj_3R_27() { + if (jj_scan_token(67)) return true; + if (jj_3R_26()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_30()) jj_scanpos = xsp; return false; } - private boolean jj_3R_26() { - if (jj_scan_token(67)) return true; - if (jj_3R_25()) return true; + private boolean jj_3R_29() { + if (jj_scan_token(22)) return true; + if (jj_3R_28()) return true; + return false; + } + + private boolean jj_3R_85() { + if (jj_scan_token(41)) return true; + if (jj_3R_18()) return true; + return false; + } + + private boolean jj_3R_33() { + if (jj_3R_34()) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_29()) jj_scanpos = xsp; + if (jj_3R_35()) jj_scanpos = xsp; return false; } - private boolean jj_3R_79() { - if (jj_3R_15()) return true; + private boolean jj_3R_31() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(12)) jj_scanpos = xsp; + if (jj_3R_33()) return true; return false; } - private boolean jj_3R_28() { - if (jj_scan_token(22)) return true; - if (jj_3R_27()) return true; + private boolean jj_3R_82() { + if (jj_scan_token(69)) return true; + if (jj_3R_81()) return true; return false; } - private boolean jj_3R_80() { - if (jj_scan_token(41)) return true; - if (jj_3R_17()) return true; + private boolean jj_3R_28() { + if (jj_3R_31()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_32()) { jj_scanpos = xsp; break; } + } return false; } - private boolean jj_3R_32() { - if (jj_3R_33()) return true; + private boolean jj_3R_65() { + if (jj_scan_token(26)) return true; + if (jj_3R_14()) return true; + if (jj_scan_token(60)) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_34()) jj_scanpos = xsp; + if (jj_3R_69()) jj_scanpos = xsp; + if (jj_scan_token(61)) return true; return false; } - private boolean jj_3R_78() { - if (jj_scan_token(UNSIGNED_INTEGER)) return true; + private boolean jj_3R_58() { + if (jj_scan_token(66)) return true; + if (jj_3R_52()) return true; return false; } - private boolean jj_3R_73() { + private boolean jj_3R_26() { + if (jj_3R_28()) return true; Token xsp; - xsp = jj_scanpos; - if (jj_3R_78()) { - jj_scanpos = xsp; - if (jj_3R_79()) return true; + while (true) { + xsp = jj_scanpos; + if (jj_3R_29()) { jj_scanpos = xsp; break; } } return false; } - private boolean jj_3R_30() { + private boolean jj_3R_81() { + if (jj_3R_16()) return true; Token xsp; xsp = jj_scanpos; - if (jj_scan_token(12)) jj_scanpos = xsp; - if (jj_3R_32()) return true; + if (jj_3R_85()) jj_scanpos = xsp; return false; } - private boolean jj_3R_13() { - if (jj_3R_15()) return true; + private boolean jj_3R_24() { + if (jj_3R_26()) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_16()) jj_scanpos = xsp; + if (jj_3R_27()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3_2() { + if (jj_3R_15()) return true; return false; } private boolean jj_3R_77() { - if (jj_scan_token(69)) return true; - if (jj_3R_76()) return true; + if (jj_3R_81()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_82()) { jj_scanpos = xsp; break; } + } return false; } - private boolean jj_3R_27() { - if (jj_3R_30()) return true; + private boolean jj_3R_22() { + if (jj_scan_token(31)) return true; + if (jj_3R_18()) return true; + if (jj_scan_token(28)) return true; + if (jj_3R_18()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_31()) { jj_scanpos = xsp; break; } + if (jj_3R_25()) { jj_scanpos = xsp; break; } } + if (jj_scan_token(15)) return true; + if (jj_3R_18()) return true; return false; } - private boolean jj_3R_66() { - if (jj_scan_token(69)) return true; - if (jj_3R_54()) return true; + private boolean jj_3R_64() { + if (jj_3R_18()) return true; return false; } - private boolean jj_3R_63() { + private boolean jj_3R_18() { Token xsp; xsp = jj_scanpos; - if (jj_3R_66()) { + if (jj_3R_21()) { jj_scanpos = xsp; - if (jj_3R_67()) return true; + if (jj_3R_22()) return true; } return false; } - private boolean jj_3R_57() { - if (jj_scan_token(66)) return true; - if (jj_3R_51()) return true; + private boolean jj_3R_21() { + if (jj_3R_24()) return true; return false; } - private boolean jj_3R_76() { - if (jj_3R_15()) return true; + private boolean jj_3R_61() { Token xsp; xsp = jj_scanpos; - if (jj_3R_80()) jj_scanpos = xsp; + if (jj_3R_64()) { + jj_scanpos = xsp; + if (jj_3R_65()) return true; + } + xsp = jj_scanpos; + if (jj_3R_66()) jj_scanpos = xsp; return false; } - private boolean jj_3R_25() { - if (jj_3R_27()) return true; + private boolean jj_3R_55() { Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_28()) { jj_scanpos = xsp; break; } + xsp = jj_scanpos; + if (jj_3R_60()) { + jj_scanpos = xsp; + if (jj_3R_61()) return true; } return false; } - private boolean jj_3_2() { - if (jj_3R_14()) return true; + private boolean jj_3R_60() { + if (jj_3R_15()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_63()) jj_scanpos = xsp; return false; } - private boolean jj_3R_23() { - if (jj_3R_25()) return true; + private boolean jj_3R_56() { + if (jj_3R_55()) return true; + return false; + } + + private boolean jj_3R_51() { + if (jj_scan_token(60)) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_26()) jj_scanpos = xsp; + if (jj_3R_56()) jj_scanpos = xsp; + if (jj_scan_token(61)) return true; return false; } - private boolean jj_3R_19() { - if (jj_scan_token(QIDENT)) return true; + private boolean jj_3R_57() { + if (jj_3R_62()) return true; return false; } - private boolean jj_3R_72() { - if (jj_3R_76()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_77()) { jj_scanpos = xsp; break; } - } + private boolean jj_3R_80() { + if (jj_scan_token(69)) return true; + if (jj_3R_78()) return true; return false; } - private boolean jj_3R_71() { - if (jj_scan_token(62)) return true; - if (jj_3R_73()) return true; + private boolean jj_3R_52() { + if (jj_3R_16()) return true; Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_75()) { jj_scanpos = xsp; break; } - } - if (jj_scan_token(63)) return true; + xsp = jj_scanpos; + if (jj_3R_57()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_58()) jj_scanpos = xsp; return false; } - private boolean jj_3R_53() { - if (jj_scan_token(68)) return true; - if (jj_3R_52()) return true; + private boolean jj_3R_79() { + if (jj_scan_token(67)) return true; + if (jj_3R_78()) return true; return false; } - private boolean jj_3R_21() { - if (jj_scan_token(31)) return true; - if (jj_3R_17()) return true; - if (jj_scan_token(28)) return true; - if (jj_3R_17()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_24()) { jj_scanpos = xsp; break; } - } - if (jj_scan_token(15)) return true; - if (jj_3R_17()) return true; + private boolean jj_3R_17() { + if (jj_scan_token(66)) return true; + if (jj_3R_14()) return true; return false; } - private boolean jj_3R_60() { - if (jj_3R_17()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_63()) jj_scanpos = xsp; + private boolean jj_3R_84() { + if (jj_3R_16()) return true; return false; } - private boolean jj_3R_65() { - if (jj_scan_token(69)) return true; - if (jj_3R_64()) return true; + private boolean jj_3R_71() { + if (jj_scan_token(21)) return true; + if (jj_3R_77()) return true; return false; } - private boolean jj_3R_20() { - if (jj_3R_23()) return true; + private boolean jj_3R_83() { + if (jj_scan_token(UNSIGNED_INTEGER)) return true; return false; } - private boolean jj_3R_17() { + private boolean jj_3R_14() { + if (jj_3R_16()) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_20()) { + if (jj_3R_17()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_78() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_83()) { jj_scanpos = xsp; - if (jj_3R_21()) return true; + if (jj_3R_84()) return true; } return false; } - private boolean jj_3_3() { - if (jj_3R_13()) return true; - if (jj_scan_token(60)) return true; + private boolean jj_3R_20() { + if (jj_scan_token(QIDENT)) return true; return false; } - private boolean jj_3R_70() { - if (jj_3R_73()) return true; + private boolean jj_3R_54() { + if (jj_scan_token(68)) return true; + if (jj_3R_53()) return true; + return false; + } + + private boolean jj_3R_75() { + if (jj_scan_token(62)) return true; + if (jj_3R_78()) return true; Token xsp; - xsp = jj_scanpos; - if (jj_3R_74()) jj_scanpos = xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_80()) { jj_scanpos = xsp; break; } + } + if (jj_scan_token(63)) return true; return false; } - private boolean jj_3R_59() { + private boolean jj_3_3() { if (jj_3R_14()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_62()) jj_scanpos = xsp; + if (jj_scan_token(60)) return true; return false; } - private boolean jj_3R_54() { + private boolean jj_3R_66() { Token xsp; xsp = jj_scanpos; - if (jj_3R_59()) { + if (jj_3R_70()) { jj_scanpos = xsp; - if (jj_3R_60()) return true; + if (jj_3R_71()) return true; } return false; } - private boolean jj_3R_55() { - if (jj_3R_54()) return true; + private boolean jj_3R_68() { + if (jj_scan_token(69)) return true; + if (jj_3R_67()) return true; return false; } - private boolean jj_3R_22() { - if (jj_3R_15()) return true; + private boolean jj_3R_70() { + if (jj_scan_token(69)) return true; + if (jj_3R_55()) return true; return false; } - private boolean jj_3R_69() { - if (jj_3R_13()) return true; - if (jj_3R_50()) return true; + private boolean jj_3R_74() { + if (jj_3R_78()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_79()) jj_scanpos = xsp; return false; } - private boolean jj_3R_18() { - if (jj_scan_token(IDENT)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_22()) jj_scanpos = xsp; + private boolean jj_3R_23() { + if (jj_3R_16()) return true; return false; } - private boolean jj_3R_15() { + private boolean jj_3R_73() { + if (jj_3R_14()) return true; + if (jj_3R_51()) return true; + return false; + } + + private boolean jj_3R_16() { Token xsp; xsp = jj_scanpos; - if (jj_3R_18()) { + if (jj_3R_19()) { jj_scanpos = xsp; - if (jj_3R_19()) return true; + if (jj_3R_20()) return true; } return false; } - private boolean jj_3R_50() { - if (jj_scan_token(60)) return true; + private boolean jj_3R_19() { + if (jj_scan_token(IDENT)) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_55()) jj_scanpos = xsp; - if (jj_scan_token(61)) return true; + if (jj_3R_23()) jj_scanpos = xsp; return false; } - private boolean jj_3R_56() { - if (jj_3R_61()) return true; + private boolean jj_3_1() { + if (jj_3R_14()) return true; + if (jj_scan_token(60)) return true; return false; } - private boolean jj_3R_68() { - if (jj_scan_token(67)) return true; + private boolean jj_3R_50() { + if (jj_scan_token(62)) return true; + if (jj_3R_55()) return true; + if (jj_scan_token(63)) return true; return false; } - private boolean jj_3R_64() { + private boolean jj_3R_67() { Token xsp; xsp = jj_scanpos; - if (jj_3R_68()) { + if (jj_3R_72()) { jj_scanpos = xsp; - if (jj_3R_69()) { + if (jj_3R_73()) { jj_scanpos = xsp; - if (jj_3R_70()) { + if (jj_3R_74()) { jj_scanpos = xsp; - if (jj_3R_71()) return true; + if (jj_3R_75()) return true; } } } return false; } - private boolean jj_3_1() { - if (jj_3R_13()) return true; - if (jj_scan_token(60)) return true; + private boolean jj_3R_72() { + if (jj_scan_token(67)) return true; return false; } private boolean jj_3R_49() { - if (jj_scan_token(62)) return true; - if (jj_3R_54()) return true; - if (jj_scan_token(63)) return true; - return false; - } - - private boolean jj_3R_48() { if (jj_scan_token(64)) return true; - if (jj_3R_52()) return true; + if (jj_3R_53()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_53()) { jj_scanpos = xsp; break; } + if (jj_3R_54()) { jj_scanpos = xsp; break; } } if (jj_scan_token(65)) return true; return false; } - private boolean jj_3R_47() { + private boolean jj_3R_48() { if (jj_scan_token(60)) return true; - if (jj_3R_17()) return true; + if (jj_3R_18()) return true; if (jj_scan_token(61)) return true; return false; } + private boolean jj_3R_47() { + if (jj_3R_52()) return true; + return false; + } + private boolean jj_3R_46() { + if (jj_3R_14()) return true; if (jj_3R_51()) return true; return false; } - private boolean jj_3R_58() { + private boolean jj_3R_59() { if (jj_scan_token(69)) return true; - if (jj_3R_17()) return true; + if (jj_3R_18()) return true; return false; } - private boolean jj_3R_61() { - if (jj_scan_token(64)) return true; - if (jj_3R_64()) return true; + private boolean jj_3R_44() { Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_65()) { jj_scanpos = xsp; break; } + xsp = jj_scanpos; + if (jj_scan_token(84)) { + jj_scanpos = xsp; + if (jj_scan_token(85)) return true; } - if (jj_scan_token(65)) return true; + if (jj_3R_43()) return true; return false; } - private boolean jj_3R_45() { - if (jj_3R_13()) return true; - if (jj_3R_50()) return true; - return false; - } - - private boolean jj_3R_43() { + private boolean jj_3R_62() { + if (jj_scan_token(64)) return true; + if (jj_3R_67()) return true; Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(84)) { - jj_scanpos = xsp; - if (jj_scan_token(85)) return true; + while (true) { + xsp = jj_scanpos; + if (jj_3R_68()) { jj_scanpos = xsp; break; } } - if (jj_3R_42()) return true; + if (jj_scan_token(65)) return true; return false; } - private boolean jj_3R_42() { + private boolean jj_3R_43() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(92)) { @@ -1407,8 +1509,6 @@ void named_arguments() : { jj_scanpos = xsp; if (jj_scan_token(33)) { jj_scanpos = xsp; - if (jj_3R_45()) { - jj_scanpos = xsp; if (jj_3R_46()) { jj_scanpos = xsp; if (jj_3R_47()) { @@ -1417,6 +1517,8 @@ void named_arguments() : { jj_scanpos = xsp; if (jj_3R_49()) { jj_scanpos = xsp; + if (jj_3R_50()) { + jj_scanpos = xsp; if (jj_scan_token(35)) return true; } } @@ -1431,31 +1533,25 @@ void named_arguments() : { return false; } - private boolean jj_3R_29() { - if (jj_scan_token(67)) return true; - if (jj_3R_25()) return true; - return false; - } - - private boolean jj_3R_41() { - if (jj_3R_44()) return true; - if (jj_3R_40()) return true; + private boolean jj_3R_76() { + if (jj_scan_token(69)) return true; + if (jj_3R_15()) return true; return false; } - private boolean jj_3R_34() { - if (jj_3R_38()) return true; - if (jj_3R_33()) return true; + private boolean jj_3R_30() { + if (jj_scan_token(67)) return true; + if (jj_3R_26()) return true; return false; } - private boolean jj_3R_37() { - if (jj_3R_39()) return true; - if (jj_3R_36()) return true; + private boolean jj_3R_42() { + if (jj_3R_45()) return true; + if (jj_3R_41()) return true; return false; } - private boolean jj_3R_44() { + private boolean jj_3R_45() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(80)) { @@ -1471,68 +1567,78 @@ void named_arguments() : { return false; } - private boolean jj_3R_40() { - if (jj_3R_42()) return true; + private boolean jj_3R_38() { + if (jj_3R_40()) return true; + if (jj_3R_37()) return true; + return false; + } + + private boolean jj_3R_35() { + if (jj_3R_39()) return true; + if (jj_3R_34()) return true; + return false; + } + + private boolean jj_3R_41() { + if (jj_3R_43()) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_43()) jj_scanpos = xsp; + if (jj_3R_44()) jj_scanpos = xsp; return false; } - private boolean jj_3R_52() { - if (jj_3R_17()) return true; + private boolean jj_3R_53() { + if (jj_3R_18()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_58()) { jj_scanpos = xsp; break; } + if (jj_3R_59()) { jj_scanpos = xsp; break; } } return false; } - private boolean jj_3R_75() { - if (jj_scan_token(69)) return true; - if (jj_3R_73()) return true; - return false; - } - - private boolean jj_3R_62() { + private boolean jj_3R_63() { if (jj_scan_token(69)) return true; - if (jj_3R_54()) return true; + if (jj_3R_55()) return true; return false; } - private boolean jj_3R_14() { - if (jj_3R_15()) return true; - if (jj_scan_token(86)) return true; - if (jj_3R_17()) return true; + private boolean jj_3R_37() { + if (jj_3R_41()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_42()) { jj_scanpos = xsp; break; } + } return false; } - private boolean jj_3R_67() { - if (jj_scan_token(21)) return true; - if (jj_3R_72()) return true; + private boolean jj_3R_25() { + if (jj_scan_token(20)) return true; + if (jj_3R_18()) return true; + if (jj_scan_token(28)) return true; + if (jj_3R_18()) return true; return false; } - private boolean jj_3R_24() { - if (jj_scan_token(20)) return true; - if (jj_3R_17()) return true; - if (jj_scan_token(28)) return true; - if (jj_3R_17()) return true; + private boolean jj_3R_15() { + if (jj_3R_16()) return true; + if (jj_scan_token(86)) return true; + if (jj_3R_18()) return true; return false; } - private boolean jj_3R_36() { - if (jj_3R_40()) return true; + private boolean jj_3R_69() { + if (jj_3R_15()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_41()) { jj_scanpos = xsp; break; } + if (jj_3R_76()) { jj_scanpos = xsp; break; } } return false; } - private boolean jj_3R_39() { + private boolean jj_3R_40() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(76)) { @@ -1548,22 +1654,6 @@ void named_arguments() : { return false; } - private boolean jj_3R_51() { - if (jj_3R_15()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_56()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_3R_57()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_31() { - if (jj_scan_token(9)) return true; - if (jj_3R_30()) return true; - return false; - } - /** Generated Token Manager. */ public ExpressionParserTokenManager token_source; SimpleCharStream jj_input_stream; @@ -1575,7 +1665,7 @@ void named_arguments() : { private Token jj_scanpos, jj_lastpos; private int jj_la; private int jj_gen; - final private int[] jj_la1 = new int[43]; + final private int[] jj_la1 = new int[46]; static private int[] jj_la1_0; static private int[] jj_la1_1; static private int[] jj_la1_2; @@ -1585,13 +1675,13 @@ void named_arguments() : { jj_la1_init_2(); } private static void jj_la1_init_0() { - 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,}; + 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,}; } private static void jj_la1_init_1() { - 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,}; + 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,}; } private static void jj_la1_init_2() { - 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,}; + 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,}; } final private JJCalls[] jj_2_rtns = new JJCalls[3]; private boolean jj_rescan = false; @@ -1608,7 +1698,7 @@ void named_arguments() : { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 43; i++) jj_la1[i] = -1; + for (int i = 0; i < 46; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -1623,7 +1713,7 @@ void named_arguments() : { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 43; i++) jj_la1[i] = -1; + for (int i = 0; i < 46; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -1634,7 +1724,7 @@ void named_arguments() : { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 43; i++) jj_la1[i] = -1; + for (int i = 0; i < 46; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -1645,7 +1735,7 @@ void named_arguments() : { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 43; i++) jj_la1[i] = -1; + for (int i = 0; i < 46; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -1655,7 +1745,7 @@ void named_arguments() : { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 43; i++) jj_la1[i] = -1; + for (int i = 0; i < 46; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -1665,7 +1755,7 @@ void named_arguments() : { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 43; i++) jj_la1[i] = -1; + for (int i = 0; i < 46; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -1782,7 +1872,7 @@ void named_arguments() : { la1tokens[jj_kind] = true; jj_kind = -1; } - for (int i = 0; i < 43; i++) { + for (int i = 0; i < 46; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1<() { + + @Override + public Boolean perform(ReadGraph graph) throws DatabaseException { + SysdynResource SR = SysdynResource.getInstance(graph); + SimulationResource SIM = SimulationResource.getInstance(graph); + Resource configuration = graph.getPossibleObject(OldSysdynExperiment.this.model, SIM.HasConfiguration); + return graph.hasStatement(configuration, SR.SysdynModel_useModelicaLibraries); + } + }); + } catch (DatabaseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if (useModelicaLibraries) + functionscript.append("loadModel(Modelica);\n"); + + for(String path : FunctionUtils.getLibraryPathsForModelica(this)) { functionscript.append("loadFile(\"" + path + "\");\n"); } return functionscript.toString(); @@ -826,10 +849,16 @@ public class OldSysdynExperiment extends SysdynExperiment { public void resultsChanged() { resultsChanged(false); } + + protected void onPublishResults() { + resultsChanged(true); + } public void setPublishResults(boolean value) { publishResults = value; - if(publishResults) resultsChanged(true); + if(publishResults) { + onPublishResults(); + } } public void resultsChanged(boolean force) { diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynConsole.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynConsole.java index 3d20128c..6a79068f 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynConsole.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynConsole.java @@ -127,20 +127,26 @@ public class SysdynConsole implements ISolverMonitor { } } + final static private SimpleDateFormat hhmmss = new SimpleDateFormat("hh:mm:ss"); + @Override public void message(String message) { - message(message, "hh:mm:ss"); + message(message, hhmmss); + } + + public void message(String message, String timeStampFormat) { + message(message, new SimpleDateFormat(timeStampFormat)); } + final static Calendar cal = Calendar.getInstance(); + /** * Print message to a console with a specified time stamp format * * @param message the message to be printed * @param timeStampFormat simpledateformat timestamp format. null if no timestamp wanted */ - public void message(String message, String timeStampFormat) { - Calendar cal = Calendar.getInstance(); - SimpleDateFormat sdf = new SimpleDateFormat(timeStampFormat); + public void message(String message, SimpleDateFormat sdf) { String time = sdf.format(cal.getTime()); MessageConsoleStream out = this.console.newMessageStream(); diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiments.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiments.java index 1e0f76de..5c7ac3de 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiments.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiments.java @@ -14,12 +14,17 @@ import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.ObjectsWithType; +import org.simantics.db.common.request.WriteRequest; +import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.adapter.impl.DefaultCopyHandler; +import org.simantics.db.layer0.adapter.impl.DefaultPasteHandler; import org.simantics.db.layer0.util.Layer0Utils; import org.simantics.db.layer0.util.RemoverUtil; import org.simantics.db.layer0.variable.RVI; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.Variables; +import org.simantics.db.service.VirtualGraphSupport; import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingResources; import org.simantics.modeling.PartialIC; @@ -30,6 +35,7 @@ import org.simantics.simulation.experiment.IExperiment; import org.simantics.simulation.model.ExperimentLoadingFailed; import org.simantics.simulation.project.IExperimentActivationListener; import org.simantics.simulation.project.IExperimentManager; +import org.simantics.structural.stubs.StructuralResource2; import org.simantics.sysdyn.SysdynResource; import org.simantics.utils.DataContainer; @@ -148,9 +154,18 @@ public class SysdynExperiments { } private static void processChild(ReadGraph graph, Variable child, PartialIC IC) throws DatabaseException { +<<<<<<< .working +======= + + StructuralResource2 STR = StructuralResource2.getInstance(graph); + +>>>>>>> .merge-right.r30389 for(Variable c : child.getChildren(graph)) { - processChild(graph, c, IC); + Resource type = c.getPossibleType(graph); + if(type == null) continue; + if(graph.isInheritedFrom(type, STR.Component)) + processChild(graph, c, IC); } Variable values = child.getPossibleProperty(graph, "values"); if(values == null) return; @@ -162,7 +177,9 @@ public class SysdynExperiments { SysdynResource SYSDYN = SysdynResource.getInstance(graph); Collection exprs = graph.syncRequest(new ObjectsWithType(represents, L0.ConsistsOf, SYSDYN.ParameterExpression)); - if(exprs.size() == 0) return; + if(exprs.size() == 0) { + if(graph.hasStatement(represents, SYSDYN.Variable_isHeadOf)) return; + } Variable v = values.getPossibleProperty(graph, ""); if(v == null) return; @@ -176,11 +193,18 @@ public class SysdynExperiments { if(target != null && ds.length > 0) { RVI rvi = target.getRVI(graph); double initial = ds[0]; - System.err.println("rvi=" + rvi + " value=" + initial); +// System.err.println("rvi=" + rvi + " value=" + initial); IC.add(rvi, Variant.ofInstance(initial)); } } } + + public static Resource saveIC(WriteGraph graph, Variable input) throws DatabaseException { + Layer0 L0 = Layer0.getInstance(graph); + Resource model = Variables.getModel(graph, input); + String name = NameUtils.findFreshName(graph, "IC", model, L0.ConsistsOf); + return saveIC(graph, input, name); + } public static Resource saveIC(WriteGraph graph, Variable input, String name) throws DatabaseException { graph.markUndoPoint(); @@ -198,7 +222,7 @@ public class SysdynExperiments { PartialIC IC = new PartialIC(); processChild(graph, input, IC); - + Layer0 L0 = Layer0.getInstance(graph); ModelingResources MOD = ModelingResources.getInstance(graph); Resource ic = graph.newResource(); @@ -206,6 +230,19 @@ public class SysdynExperiments { graph.addLiteral(ic, L0.HasName, L0.NameOf, L0.String, name, Bindings.STRING); graph.addLiteral(ic, SYSDYN.InitialCondition_HasInitialValues, SYSDYN.InitialCondition_HasInitialValues_Inverse, MOD.PartialIC, IC, PartialIC.BINDING); graph.claim(model, L0.ConsistsOf, ic); + + Resource represents = input.getPossibleRepresents(graph); + if(represents != null) { + Resource state = Layer0Utils.getPossibleChild(graph, represents, "__simupedia__"); + Layer0Utils.copyTo(graph, ic, state, null, new DefaultCopyHandler(state) { + + @Override + protected boolean ignoreVirtualResources() { + return false; + } + + }, new DefaultPasteHandler(ic)); + } Layer0Utils.addCommentMetadata(graph, "Saved new Initial Condition " + name + " " + ic); return ic; @@ -214,12 +251,11 @@ public class SysdynExperiments { public static void assignIC(WriteGraph graph, Variable experiment, String name) throws DatabaseException { graph.markUndoPoint(); - System.err.println("assignIC " + experiment.getURI(graph)); Layer0 L0 = Layer0.getInstance(graph); SysdynResource SYSDYN = SysdynResource.getInstance(graph); - Resource run = experiment.getPossibleRepresents(graph); + final Resource run = experiment.getPossibleRepresents(graph); if(run == null) return; Resource exp = graph.getPossibleObject(run, L0.PartOf); if(exp == null) return; @@ -233,12 +269,29 @@ public class SysdynExperiments { graph.deny(exp, SYSDYN.Experiment_ic); graph.claim(exp, SYSDYN.Experiment_ic, ic); Layer0Utils.addCommentMetadata(graph, "Assigned Initial Condition " + graph.getRelatedValue2(ic, L0.HasName, Bindings.STRING) + " to experiment " + graph.getRelatedValue2(exp, L0.HasName, Bindings.STRING)); + + Resource oldState = Layer0Utils.getPossibleChild(graph, run, "__simupedia__"); + if(oldState != null) { + graph.deny(run, L0.ConsistsOf, oldState); + } + + final Resource storedState = Layer0Utils.getPossibleChild(graph, ic, "__simupedia__"); + if(storedState != null) { + VirtualGraphSupport vgs = graph.getService(VirtualGraphSupport.class); + graph.syncRequest(new WriteRequest(vgs.getMemoryPersistent("experiments")) { + + @Override + public void perform(WriteGraph graph) throws DatabaseException { + Layer0Utils.copyTo(graph, run, storedState, null, new DefaultCopyHandler(storedState), new DefaultPasteHandler(run)); + } + + }); + } + } public static void deassignIC(WriteGraph graph, Variable experiment) throws DatabaseException { - System.err.println("deassignIC " + experiment.getURI(graph)); - Layer0 L0 = Layer0.getInstance(graph); SysdynResource SYSDYN = SysdynResource.getInstance(graph); @@ -253,8 +306,6 @@ public class SysdynExperiments { public static void applyIC(WriteGraph graph, Variable experiment, String name) throws DatabaseException { - System.err.println("applyIC " + experiment.getURI(graph)); - Layer0 L0 = Layer0.getInstance(graph); SysdynResource SYSDYN = SysdynResource.getInstance(graph); @@ -271,8 +322,13 @@ public class SysdynExperiments { Variable base = Variables.getVariable(graph, run); + SysdynExperiments.setPublishResults(graph, base, false); + PartialIC data = graph.getPossibleRelatedValue(ic, SYSDYN.InitialCondition_HasInitialValues, PartialIC.BINDING); data.apply(graph, base); + + SysdynExperiments.setPublishResults(graph, base, true); + } diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynGameExperimentBase.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynGameExperimentBase.java index 421e75d2..31314bbd 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynGameExperimentBase.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynGameExperimentBase.java @@ -14,13 +14,16 @@ package org.simantics.sysdyn.manager; import gnu.trove.list.array.TDoubleArrayList; import gnu.trove.map.hash.THashMap; +import java.util.Collection; import java.util.HashMap; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.jobs.Job; import org.simantics.db.AsyncReadGraph; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; +import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.DatabaseException; import org.simantics.db.procedure.AsyncListener; import org.simantics.db.request.Read; @@ -47,7 +50,7 @@ abstract public class SysdynGameExperimentBase extends OldSysdynExperiment { THashMap results; - protected String[] subscription; + public String[] subscription; public static double DEFAULT_STEP_DURATION = 1.0; public static double DEFAULT_STEP_LENGTH = 0.1; @@ -82,6 +85,25 @@ abstract public class SysdynGameExperimentBase extends OldSysdynExperiment { this.savePer = interval; } + public static class Subscription { + public SysdynGameExperimentBase exp; + public int[] indexes; + public void getValues(double[] data) { + for(int i=0;i names) { + Subscription result = new Subscription(); + int[] indexes = new int[names.size()]; + int index = 0; + for(String name : names) + indexes[index++] = subscriptionIndexes.get(name); + result.exp = this; + result.indexes = indexes; + return result; + } + public Double getCurrentValue(String name) { if(subscriptionIndexes != null && name != null) { Integer index = subscriptionIndexes.get(name); @@ -194,5 +216,16 @@ abstract public class SysdynGameExperimentBase extends OldSysdynExperiment { } } + + @Override + protected void onPublishResults() { + try { + setSubscribedResults(new NullProgressMonitor(), getSolver().getTime()); + } catch (FMUJNIException e) { + Logger.defaultLogError(e); + } + ((MemoryResult)getCurrentResult()).setResult(new GameResult(this, this.results, this.subscription)); + super.onPublishResults(); + } } diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynGameExperimentInternal.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynGameExperimentInternal.java index 1dfc9a8d..71025a73 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynGameExperimentInternal.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynGameExperimentInternal.java @@ -153,9 +153,11 @@ public class SysdynGameExperimentInternal extends SysdynGameExperimentBase { @Override public void refresh() { try { - setSubscribedResults(new NullProgressMonitor(), solver.getTime()); - - ((MemoryResult)getCurrentResult()).setResult(new GameResult(this, this.results, this.subscription)); + + if(publishResults) { + setSubscribedResults(new NullProgressMonitor(), solver.getTime()); + ((MemoryResult)getCurrentResult()).setResult(new GameResult(this, this.results, this.subscription)); + } resultsChanged(true); } catch (Exception e) { diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java index ab040550..93df521e 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2013 Association for Decentralized Information Management in + * Copyright (c) 2010, 2013, 2014 Association for Decentralized Information Management in * Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -23,9 +23,11 @@ import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; import org.simantics.Simantics; +import org.simantics.databoard.Bindings; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.Session; +import org.simantics.db.WriteGraph; import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; import org.simantics.db.exception.ManyObjectsForFunctionalRelationException; @@ -34,11 +36,14 @@ import org.simantics.db.procedure.Listener; import org.simantics.db.request.Read; import org.simantics.db.service.VirtualGraphSupport; import org.simantics.layer0.Layer0; +import org.simantics.modeling.ModelingResources; import org.simantics.objmap.IMapping; import org.simantics.objmap.IMappingListener; import org.simantics.objmap.MappingException; import org.simantics.objmap.Mappings; import org.simantics.project.IProject; +import org.simantics.scl.runtime.function.Function2; +import org.simantics.scl.runtime.function.FunctionImpl2; import org.simantics.simulation.experiment.IExperiment; import org.simantics.simulation.model.IModel; import org.simantics.simulation.ontology.SimulationResource; @@ -66,7 +71,7 @@ import org.simantics.sysdyn.solver.SolverSettings.SolverType; /** * Maintains a Java representation of system dynamic model. - * @author Hannu Niemistö, Teemu Lempinen + * @author Hannu Niemistö, Teemu Lempinen, Tuomas Miettinen */ public class SysdynModel implements IModel, IMappingListener, VariableSubscriptionManager { @@ -453,8 +458,27 @@ public class SysdynModel implements IModel, IMappingListener, VariableSubscripti exp.init(g); + Function2 scl = new FunctionImpl2() { + + @Override + public Object apply(WriteGraph graph, Resource run) { + try { + Layer0 L0 = Layer0.getInstance(graph); + ModelingResources MOD = ModelingResources.getInstance(graph); + Resource session = graph.newResource(); + graph.claim(session, L0.InstanceOf, MOD.SCLCommandSession); + graph.addLiteral(session, L0.HasName, L0.NameOf, L0.String, "__scl__", Bindings.STRING); + graph.claim(run, L0.ConsistsOf, session); + } catch (DatabaseException e) { + e.printStackTrace(); + } + return null; + } + + }; + VirtualGraphSupport support = g.getSession().getService(VirtualGraphSupport.class); - ExperimentRuns.createRun(g.getSession(), support.getWorkspacePersistent("experiments"), experiment, exp, SysdynResource.URIs.Experiment_Run, listener, null); + ExperimentRuns.createRun(g.getSession(), support.getWorkspacePersistent("experiments"), experiment, exp, SysdynResource.URIs.Experiment_Run, listener, scl, null); if(listener != null) listener.onExperimentActivated(exp); return exp; @@ -493,7 +517,7 @@ public class SysdynModel implements IModel, IMappingListener, VariableSubscripti if (element instanceof Module) { Module module = (Module) element; Configuration conf = module.getType().getConfiguration(); - String prfx = prefix + module.getName() + "."; + String prfx = prefix + module.getModelicaName() + "."; inits.putAll(getInits(conf, prfx)); for(ParameterOverride po : module.getParameterOverrides()) { inits.put(prfx + po.getVariable().getName(), po.getExpression()); diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelImport/IModelParser.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelImport/IModelParser.java new file mode 100644 index 00000000..a179b6c5 --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelImport/IModelParser.java @@ -0,0 +1,9 @@ +package org.simantics.sysdyn.modelImport; + +import java.io.File; + +import org.simantics.sysdyn.modelImport.model.Model; + +public interface IModelParser { + public Model parse(File file) throws Exception; +} diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelImport/MdlParser.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelImport/MdlParser.java index 25c77c0e..876390a5 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelImport/MdlParser.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelImport/MdlParser.java @@ -20,6 +20,7 @@ import java.util.regex.Pattern; import org.simantics.sysdyn.modelImport.mdl.Declaration; import org.simantics.sysdyn.modelImport.mdl.Lookup; import org.simantics.sysdyn.modelImport.mdl.MdlModel; +import org.simantics.sysdyn.modelImport.mdl.MdlVariable; import org.simantics.sysdyn.modelImport.mdl.Sketch; import org.simantics.sysdyn.modelImport.mdl.SketchComment; import org.simantics.sysdyn.modelImport.mdl.SketchConnection; @@ -28,7 +29,6 @@ import org.simantics.sysdyn.modelImport.mdl.SketchValve; import org.simantics.sysdyn.modelImport.mdl.SketchVariable; import org.simantics.sysdyn.modelImport.mdl.Subscript; import org.simantics.sysdyn.modelImport.mdl.SubscriptVariable; -import org.simantics.sysdyn.modelImport.mdl.MdlVariable; import org.simantics.sysdyn.modelImport.model.Comment; import org.simantics.sysdyn.modelImport.model.Connection; import org.simantics.sysdyn.modelImport.model.Model; @@ -37,7 +37,7 @@ import org.simantics.sysdyn.modelImport.model.Shadow; import org.simantics.sysdyn.modelImport.model.Symbol; import org.simantics.sysdyn.modelImport.model.Valve; -public class MdlParser { +public class MdlParser implements IModelParser { private static final String UTF_8 = "{UTF-8}"; private static final String SKETCH_VERSION = "V300"; @@ -48,7 +48,8 @@ public class MdlParser { private static final String PARAMETER_STOP = "FINAL TIME"; private static final String PARAMETER_STEP = "TIME STEP"; - public static Model parse(File file) throws Exception { + @Override + public Model parse(File file) throws Exception { // generate a mdl model based on the contents of the file MdlModel mdl = parseFile(file); diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelImport/mdl/MdlVariable.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelImport/mdl/MdlVariable.java index ad63d003..2be6234e 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelImport/mdl/MdlVariable.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelImport/mdl/MdlVariable.java @@ -158,22 +158,20 @@ public class MdlVariable extends Declaration { private static Range parseRange(String unit) { Matcher matcher = Pattern.compile( - "\\["+MdlUtil.DBL_G+",(\\?|"+MdlUtil.DBL_G+"|"+MdlUtil.DBL_G+","+MdlUtil.DBL_G+")\\]" + "\\[(\\?|"+MdlUtil.DBL+"),(\\?|"+MdlUtil.DBL+")(,(\\?|"+MdlUtil.DBL+"))?\\]" ).matcher(unit); if (matcher.find()) { - Double start, end, step; - start = Double.parseDouble(matcher.group(1)); - if (matcher.group(2).equals("?")) { - end = null; - step = null; + Double start = null; + if (!matcher.group(1).equals("?")) { + start = Double.parseDouble(matcher.group(1)); } - else if (matcher.group(2).contains(",")){ - end = Double.parseDouble(matcher.group(4)); - step = Double.parseDouble(matcher.group(5)); + Double end = null; + if (!matcher.group(2).equals("?")) { + end = Double.parseDouble(matcher.group(2)); } - else { - end = Double.parseDouble(matcher.group(3)); - step = null; + Double step = null; + if (matcher.group(3) != null && !matcher.group(4).equals("?")) { + step = Double.parseDouble(matcher.group(4)); } return new Range(start, end, step); } diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelImport/mdl/SubscriptVariable.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelImport/mdl/SubscriptVariable.java index ef397f4e..156ec931 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelImport/mdl/SubscriptVariable.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelImport/mdl/SubscriptVariable.java @@ -125,14 +125,17 @@ public class SubscriptVariable extends MdlVariable { // bar[b] = 2 // bar[c] = 3 + // remove spaces, should maybe remove all whitespace + String exprstr = getExpressionString().replaceAll(" ", ""); + valuearray: if (next == null) { // number(,number)* if (enumerations.size() == 1 && - Pattern.matches(MdlUtil.DBL+"(,"+MdlUtil.DBL+")*", getExpressionString())) { + Pattern.matches(MdlUtil.DBL+"(,"+MdlUtil.DBL+")*", exprstr)) { EnumerationExpression expr = new EnumerationExpression(enumerations); - String[] values = getExpressionString().split(","); + String[] values = exprstr.split(","); if (enumerations.get(0).getValues().size() != values.length) { // could not find a value for each enumeration index, // attempt to parse the equation normally @@ -148,10 +151,10 @@ public class SubscriptVariable extends MdlVariable { } // (number(,number)*;)* else if (enumerations.size() == 2 && - Pattern.matches("("+MdlUtil.DBL+"(,"+MdlUtil.DBL+")*;)+", getExpressionString())) { + Pattern.matches("("+MdlUtil.DBL+"(,"+MdlUtil.DBL+")*;)+", exprstr)) { EnumerationExpression expr = new EnumerationExpression(enumerations); - String[] rows = getExpressionString().split(";"); + String[] rows = exprstr.split(";"); if (enumerations.get(0).getValues().size() != rows.length) { // could not find a value for each enumeration index // in the first enumeration, attempt to parse the equation diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelImport/model/Model.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelImport/model/Model.java index 14a82c80..5bfd82ae 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelImport/model/Model.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelImport/model/Model.java @@ -156,6 +156,10 @@ public class Model implements IWriteableObject { public Collection getFunctions() { return functions.values(); } + + public Resource write(WriteGraph graph, Resource project) throws DatabaseException { + return write(graph, project, new WriteContext()); + } @Override public Resource write(WriteGraph graph, Resource parent, WriteContext context) throws DatabaseException { diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java index f2c0a1b7..87dd09e2 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2012 Association for Decentralized Information Management in + * Copyright (c) 2007, 2012, 2014 Association for Decentralized Information Management in * Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -99,24 +99,41 @@ public class ModelicaWriter { // find out which delays are used in the model and create the // necessary classes - HashSet delays = new HashSet(); + List generated = new ArrayList(); for (Configuration configuration : configurations) { for (IElement element : configuration.getElements()) { if (element instanceof IndependentVariable) { - for (IExpression expression : ((IndependentVariable)element).getExpressions()) { + IndependentVariable variable = (IndependentVariable)element; + for (IExpression expression : variable.getExpressions()) { if (expression instanceof DelayExpression) { - delays.add(((DelayExpression)expression).getOrder()); + DelayExpression delay = (DelayExpression)expression; + + int order = delay.getOrder(); + int[] dimensions = null; + + // TODO: is it cool to assume an expression is in the array + // shorthand form if the expression does not have an array range + // even though the variable has array indices? (if this + // assumption does not hold DelayExpression must be updated as well) + + if (expression.getArrayRange() == null) { + dimensions = variable.getDimensionArray(); + } + + // create the appropriate delay class if it has not + // been created already + + if (!generated.contains(getDelayName(order, dimensions))) { + b.append(getDelayClass(order, dimensions)); + b.append("\n"); + generated.add(getDelayName(order, dimensions)); + } } } } } } - for (Integer i : delays) { - b.append(getDelayClass(i)); - b.append("\n"); - } - HashSet sheetNames = new HashSet(); for(Sheet sheet : getSpreadSheets(configurations)) sheetNames.add(sheet.getModelicaName()); @@ -212,11 +229,11 @@ public class ModelicaWriter { // Module Module m = (Module)element; modules.add(m); - moduleInputs.put(m.getName(), new ArrayList()); + moduleInputs.put(m.getModelicaName(), new ArrayList()); for(IElement e : m.getType().getConfiguration().getElements()) // Inputs inside the module if(e instanceof Input && !((Input)e).isHeadOfDependency()) { - moduleInputs.get(m.getName()).add((Input)e); + moduleInputs.get(m.getModelicaName()).add((Input)e); } } else if (element instanceof Input) { // Input variables @@ -245,7 +262,7 @@ public class ModelicaWriter { ModuleType mt = configuration.getModuleType(); // className == null, if this is a model configuration. model configuration start and end are written in ModelicaWriter.write - String className = mt != null ? (mt.getName().replace(" ", "")) : null; + String className = mt != null ? (mt.getModelicaName()) : null; if(className != null) b.append("class "+className+"\n"); @@ -335,8 +352,8 @@ public class ModelicaWriter { Module module = (Module)dependency.getHead(); Input reference = (Input)dependency.refersTo(); if(reference != null && reference.getName() != null && (reference.getVariability() == null || reference.getVariability().isEmpty())) { - b.append(" " + module.getName() + "." + reference.getModelicaName() + " = " + variable.getModelicaName() + ";\n"); - moduleInputs.get(module.getName()).remove(reference); + b.append(" " + module.getModelicaName() + "." + reference.getModelicaName() + " = " + variable.getModelicaName() + ";\n"); + moduleInputs.get(module.getModelicaName()).remove(reference); } } @@ -352,7 +369,7 @@ public class ModelicaWriter { if(configuration.isGameConfiguration() && !modules.isEmpty()) { b.append("// Time values for module\n"); for(Module m : modules) { - b.append(" " + m.getName() + ".time = time;\n"); + b.append(" " + m.getModelicaName() + ".time = time;\n"); } } } @@ -391,7 +408,7 @@ public class ModelicaWriter { String expression; // If reference exists, use reference name. Otherwise, use default value. if(reference != null && reference.getName() != null) - expression = module.getName() + "." + reference.getModelicaName() + ";\n"; + expression = module.getModelicaName() + "." + reference.getModelicaName() + ";\n"; else expression = input.getDefaultInputValue() + ";\n"; @@ -445,28 +462,37 @@ public class ModelicaWriter { public static final String DELAY_TIME = "delayTime"; public static final String DELAY_INITIAL = "initialValue"; - - private static String getDelayClass(int order) { + + private static String getDelayClass(int order, int...dimensions) { + boolean array = dimensions != null && dimensions.length > 0; + StringBuilder buffer = new StringBuilder(); - buffer.append("class " + getDelayName(order) + "\n"); + buffer.append("class ").append(getDelayName(order, dimensions)).append("\n"); // variable block // (possibly) continuous auxiliary variable - buffer.append("\tReal DL;\n"); + buffer.append('\t') + .append(getReal("DL")).append(";\n"); // (possibly) continuous delay time - buffer.append("\tReal " + DELAY_TIME + ";\n"); + buffer.append('\t') + .append(getReal(DELAY_TIME)).append(";\n"); // (possibly) continuous initial value - buffer.append("\tReal " + DELAY_INITIAL + ";\n"); + buffer.append('\t') + .append(getReal(DELAY_INITIAL, dimensions)).append(";\n"); // first valve - buffer.append("\tReal " + getDelayValve(0) + ";\n"); + buffer.append('\t') + .append(getReal(getDelayValve(0), dimensions)).append(";\n"); // stocks and valves, valves are delayed values of the variable for (int i = 1; i <= order; i++) { - buffer.append("\tReal LV"+i + "(fixed=false);\n"); - buffer.append("\tReal "+ getDelayValve(i) + ";\n"); + buffer.append('\t') + .append(getReal("LV"+i, dimensions)).append(' ') + .append("(" + (array ? "each " : "") + "fixed=false)").append(";\n"); + buffer.append('\t') + .append(getReal(getDelayValve(i), dimensions)).append(";\n"); } // initial equation block @@ -474,29 +500,64 @@ public class ModelicaWriter { // Each stock gets the same initial value for (int i = 1; i <= order; i++) { - buffer.append("\tLV"+i + " = DL * " + DELAY_INITIAL + ";\n"); + buffer.append('\t') + .append("LV"+i) + .append(" = ") + .append("DL" + (array ? " .* " : " * ") + DELAY_INITIAL) + .append(";\n"); } // equation block buffer.append("equation\n"); - buffer.append("\tDL = " + DELAY_TIME + " / "+order+";\n"); - + buffer.append('\t') + .append("DL") + .append(" = ") + .append(DELAY_TIME +" / " + order) + .append(";\n"); + // valves and stocks for (int i = 1; i <= order; i++) { - buffer.append("\tder(LV"+i + ") = - " + getDelayValve(i) + " + " + getDelayValve(i-1) + ";\n"); - buffer.append("\t"+ getDelayValve(i) + " = LV"+i + " / DL;\n"); + buffer.append('\t') + .append("der(LV"+i + ")") + .append(" = ") + .append("-" + getDelayValve(i) + (array ? " .+ " : " + ") + getDelayValve(i-1)) + .append(";\n"); + buffer.append('\t') + .append(getDelayValve(i)) + .append(" = ") + .append("LV"+i + (array ? " ./ " : " / ") + "DL") + .append(";\n"); } - buffer.append("end "); - buffer.append(getDelayName(order)); - buffer.append(";\n"); + buffer.append("end ").append(getDelayName(order, dimensions)).append(";\n"); return buffer.toString(); } - - public static String getDelayName(int order) { - return "order_"+order+"_delay"; + + private static String getReal(String name, int...dims) { + StringBuilder buffer = new StringBuilder(); + buffer.append("Real ").append(name); + if (dims != null && dims.length > 0) { + buffer.append('['); + for (int i = 0; i < dims.length; i++) { + if (i > 0) buffer.append(','); + buffer.append(dims[i]); + } + buffer.append(']'); + } + return buffer.toString(); + } + + public static String getDelayName(int order, int...dims) { + StringBuilder buffer = new StringBuilder(); + buffer.append("o_").append(order).append('_'); + if (dims != null && dims.length > 0) { + buffer.append("d_"); + for (int dim : dims) buffer.append(dim).append('_'); + } + buffer.append("delay"); + return buffer.toString(); } public static String getDelayValve(int order) { diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Module.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Module.java index 3938f200..e8908c9b 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Module.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Module.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2012 Association for Decentralized Information Management in + * Copyright (c) 2010, 2012, 2014 Association for Decentralized Information Management in * Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -58,6 +58,17 @@ public class Module implements IElement { public String getName() { return name; } + + /** + * Get Modelica compliant name + * @return The name of this variable with spaces (' ') replaced with + * underscore characters ('_') + */ + public String getModelicaName() { + if (this.name == null) + return null; + return this.name.replace(' ', '_'); + } public ModuleType getType() { return type; @@ -114,9 +125,9 @@ public class Module implements IElement { } sb.append(" "); - sb.append(getType().getName()); + sb.append(getType().getModelicaName()); sb.append(" "); - sb.append(getName()); + sb.append(getModelicaName()); sb.append(redeclarations.toString()); // possible redeclarations sb.append(";\n"); return sb.toString(); diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/ModuleType.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/ModuleType.java index bf7b84a9..1dbabb0c 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/ModuleType.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/ModuleType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2012 Association for Decentralized Information Management in + * Copyright (c) 2010, 2012, 2014 Association for Decentralized Information Management in * Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -22,6 +22,7 @@ import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid; * Representation of a module type * * @author Teemu Lempinen + * @author Tuomas Miettinen * */ @GraphType(StructuralResource2.URIs.ComponentType) @@ -35,7 +36,18 @@ public class ModuleType implements IElement { @RelatedElement(Layer0.URIs.PartOf) protected Object parent; - + + /** + * Get Modelica compliant name + * @return The name of this variable with spaces (' ') replaced with + * underscore characters ('_') + */ + public String getModelicaName() { + if (this.name == null) + return null; + return this.name.replace(' ', '_'); + } + public String getName() { return name; } diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Variable.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Variable.java index 997e61db..92b49941 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Variable.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Variable.java @@ -114,6 +114,17 @@ public abstract class Variable implements IElement { return this.arrayIndexes; } + public int[] getDimensionArray() { + if (arrayIndexes == null) + return null; + + int[] dimensions = new int[arrayIndexes.size()]; + for (int i = 0; i < arrayIndexes.size(); i++) { + dimensions[i] = arrayIndexes.get(i).getEnumerationIndexes().size(); + } + return dimensions; + } + /** * * @return Expressions of this variable diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/DelayExpression.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/DelayExpression.java index 4edf3089..6865e112 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/DelayExpression.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/DelayExpression.java @@ -65,7 +65,15 @@ public class DelayExpression extends Expression { @Override public String getDeclarationAddition() { // instantiate the correct delay class for this expression - return "\t" + ModelicaWriter.getDelayName(order) + " " + instance() + ";\n"; + + // TODO: this is not necessary correct, see discussion in delay class + // generation code in ModelicaWriter.java + int[] dimensions = null; + if (getArrayRange() == null) { + dimensions = getParent().getDimensionArray(); + } + + return "\t" + ModelicaWriter.getDelayName(order, dimensions) + " " + instance() + ";\n"; } @Override diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/Expression.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/Expression.java index 7463bfcc..98c51a57 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/Expression.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/Expression.java @@ -67,10 +67,7 @@ public abstract class Expression implements IExpression { @Override public String getArrayRange() { - if(range == null) - return ""; - else - return range; + return range; } @Override @@ -80,7 +77,7 @@ public abstract class Expression implements IExpression { @Override public String validateUnits(ReadGraph graph, SysdynModel model) { - return UnitUtils.matchUnits(graph, model, parent.getParentConfiguration(), parent.getUnit(), getExpression()); + return UnitUtils.matchUnits(graph, model, parent.getParentConfiguration(), parent.getUnit(), getExpression()); } @Override diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/UnitUtils.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/UnitUtils.java index 8418b14f..66566c80 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/UnitUtils.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/UnitUtils.java @@ -35,6 +35,7 @@ import org.simantics.sysdyn.representation.Module; import org.simantics.sysdyn.representation.Shadow; import org.simantics.sysdyn.representation.Variable; import org.simantics.sysdyn.unitParser.ParseException; +import org.simantics.sysdyn.unitParser.TokenMgrError; import org.simantics.sysdyn.unitParser.UnitCheckingException; import org.simantics.sysdyn.unitParser.UnitCheckingNode; import org.simantics.sysdyn.unitParser.UnitParser; @@ -128,6 +129,8 @@ public class UnitUtils { } } catch (ParseException e) { return "Cannot validate units: Syntax error in expression."; + } catch (TokenMgrError e) { + return "Cannot validate units: Syntax error in expression."; } return null; } diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/solver/SolverSettings.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/solver/SolverSettings.java index b3e8fb06..65ec03b9 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/solver/SolverSettings.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/solver/SolverSettings.java @@ -1,7 +1,6 @@ package org.simantics.sysdyn.solver; -import org.eclipse.core.runtime.preferences.ConfigurationScope; -import org.osgi.service.prefs.Preferences; +import org.eclipse.core.runtime.Platform; public class SolverSettings { @@ -16,10 +15,13 @@ public class SolverSettings { public static final String SOLVER_TYPE_OPENMODELICA = "OPENMODELICA"; public static SolverType getSelectedSolverType() { - Preferences preferences = ConfigurationScope.INSTANCE.getNode(SolverSettings.QUALIFIER); - // default to internal solver - String type = preferences.get(SolverSettings.SOLVER_TYPE, SolverSettings.SOLVER_TYPE_INTERNAL); + String type = Platform.getPreferencesService().getString(QUALIFIER, SOLVER_TYPE, null, null); + if (type == null) { + // solver type is not set, should not happen since the default + // value should be in plugin_customization.ini + return SolverType.OPENMODELICA; + } if (SOLVER_TYPE_INTERNAL.equals(type)) { return SolverType.INTERNAL; } diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/DocumentationUtils.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/DocumentationUtils.java index 28ec9bf6..b8b06837 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/DocumentationUtils.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/DocumentationUtils.java @@ -16,6 +16,7 @@ import org.simantics.databoard.Bindings; import org.simantics.databoard.util.Base64; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; +import org.simantics.db.common.request.BinaryRead; import org.simantics.db.common.request.ObjectsWithSupertype; import org.simantics.db.common.request.UniqueRead; import org.simantics.db.common.request.WriteRequest; @@ -558,11 +559,17 @@ public class DocumentationUtils { } - public static org.simantics.db.layer0.variable.Variable lastValue2(ReadGraph graph, org.simantics.db.layer0.variable.Variable run, String path) throws DatabaseException { + public static org.simantics.db.layer0.variable.Variable lastValue2(ReadGraph graph, org.simantics.db.layer0.variable.Variable input, String path) throws DatabaseException { - if(run == null) return null; + if(input == null) return null; + + org.simantics.db.layer0.variable.Variable context = Variables.getPossibleContext(graph, input); + if(context == null) { + context = Variables.getConfigurationContext(graph, input); + if(context == null) return null; + } - org.simantics.db.layer0.variable.Variable v = run.browsePossible(graph, "/" + path); + org.simantics.db.layer0.variable.Variable v = context.browsePossible(graph, "/" + path); if(v == null) return null; org.simantics.db.layer0.variable.Variable p = v.browsePossible(graph, "#value#$0"); @@ -572,6 +579,26 @@ public class DocumentationUtils { } + public static org.simantics.db.layer0.variable.Variable currentValue(ReadGraph graph, org.simantics.db.layer0.variable.Variable input, String path) throws DatabaseException { + + if(input == null) return null; + + org.simantics.db.layer0.variable.Variable context = Variables.getPossibleContext(graph, input); + if(context == null) { + context = Variables.getConfigurationContext(graph, input); + if(context == null) return null; + } + + org.simantics.db.layer0.variable.Variable v = context.browsePossible(graph, "/" + path); + if(v == null) return null; + + org.simantics.db.layer0.variable.Variable p = v.browsePossible(graph, "#value#$0"); + if(p == null) return null; + + return p; + + } + /** * Splits indexed variable reference into name and indices part. * @@ -591,23 +618,40 @@ public class DocumentationUtils { } - public static org.simantics.db.layer0.variable.Variable lastValueIndexed(ReadGraph graph, org.simantics.db.layer0.variable.Variable run, String path) throws DatabaseException { - - if(run == null) return null; + public static class LastValueIndexed extends BinaryRead { - Pair nameAndIndices = splitToNameAndIndices(path); + public LastValueIndexed(Resource resource, String path) { + super(resource, path); + } - org.simantics.db.layer0.variable.Variable v = run.browsePossible(graph, "/" + nameAndIndices.first + "#value#" + nameAndIndices.second); - if(v == null) throw new MissingVariableException("No variable for SysDyn reference path: " + path); - - return v; + @Override + public org.simantics.db.layer0.variable.Variable perform(ReadGraph graph) throws DatabaseException { + + org.simantics.db.layer0.variable.Variable run = Variables.getVariable(graph, parameter); + Pair nameAndIndices = splitToNameAndIndices(parameter2); + org.simantics.db.layer0.variable.Variable v = run.browsePossible(graph, "/" + nameAndIndices.first + "#value#" + nameAndIndices.second); + if(v == null) throw new MissingVariableException("No variable for SysDyn reference path: " + parameter2); + return v; + } + } + + + public static org.simantics.db.layer0.variable.Variable lastValueIndexed(ReadGraph graph, org.simantics.db.layer0.variable.Variable run, String path) throws DatabaseException { + if(run == null) return null; + return graph.syncRequest(new LastValueIndexed(run.getRepresents(graph), path)); } - public static org.simantics.db.layer0.variable.Variable equation(ReadGraph graph, org.simantics.db.layer0.variable.Variable run, String path) throws DatabaseException { + public static org.simantics.db.layer0.variable.Variable equation(ReadGraph graph, org.simantics.db.layer0.variable.Variable input, String path) throws DatabaseException { - if(run == null) return null; + if(input == null) return null; + + org.simantics.db.layer0.variable.Variable context = Variables.getPossibleContext(graph, input); + if(context == null) { + context = Variables.getConfigurationContext(graph, input); + if(context == null) return null; + } - org.simantics.db.layer0.variable.Variable v = run.browsePossible(graph, "/" + path); + org.simantics.db.layer0.variable.Variable v = context.browsePossible(graph, "/" + path); if(v == null) return null; org.simantics.db.layer0.variable.Variable p = v.browsePossible(graph, "#equation"); diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/imports/ImportUtils.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/imports/ImportUtils.java index ceeff8aa..18be49f7 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/imports/ImportUtils.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/imports/ImportUtils.java @@ -173,7 +173,7 @@ public class ImportUtils { for(ModelDependency dependency : dependenciesBean.dependencies) { Resource existing = session.sync(new PossibleResource(dependency.uri)); if(existing == null) { - MigrationUtils.importSharedOntology(session, dependency.tg); + MigrationUtils.importSharedOntology(session, dependency.tg, false); } } } -- 2.47.1