From a3e44394bc439d34a17c4990b2c3786115be0877 Mon Sep 17 00:00:00 2001 From: jkauttio Date: Fri, 25 Apr 2014 13:20:31 +0000 Subject: [PATCH] Merge changes from trunk refs #2924 git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/branches/dev-jkauttio@29355 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../src/fi/semantum/sysdyn/solver/Array.java | 39 +- .../sysdyn/solver/ElementwiseDivision.java | 78 ++ .../sysdyn/solver/ElementwisePower.java | 78 ++ .../fi/semantum/sysdyn/solver/NodeClass.java | 2 + .../src/fi/semantum/sysdyn/solver/Parser.java | 18 +- .../src/fi/semantum/sysdyn/solver/Power.java | 74 ++ .../sysdyn/solver/parser/ModelParser.java | 890 +++++++++--------- .../sysdyn/solver/parser/ModelicaParser.jj | 5 + .../sysdyn/solver/parser/ModelicaParser.jjt | 2 +- org.simantics.sysdyn.ui/plugin.xml | 104 ++ .../ui/browser/contributions/Project.java | 9 + .../browser/contributions/SharedOntology.java | 38 + .../contributions/SharedOntologyImager.java | 24 + .../contributions/SharedOntologyLabeler.java | 19 + .../contributions/SharedOntologyNode.java | 25 + .../sysdyn/ui/browser/nodes/SCLModule.java | 37 +- .../handlers/ExportSharedOntologyHandler.java | 33 + .../ui/handlers/NewSCLModuleHandler.java | 47 + 18 files changed, 1077 insertions(+), 445 deletions(-) create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ElementwiseDivision.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ElementwisePower.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Power.java create mode 100644 org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SharedOntology.java create mode 100644 org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SharedOntologyImager.java create mode 100644 org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SharedOntologyLabeler.java create mode 100644 org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SharedOntologyNode.java create mode 100644 org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ExportSharedOntologyHandler.java create mode 100644 org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewSCLModuleHandler.java diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Array.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Array.java index 45449362..a14e5ace 100644 --- a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Array.java +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Array.java @@ -140,6 +140,20 @@ public class Array implements IExpression { } return result; } + + public Array pow(double d) { + Array result = new Array(); + for(Object o : elements) { + if(o instanceof Double) { + result.addElement(Math.pow((Double)o,d)); + } else if (o instanceof Array) { + result.addElement(((Array)o).pow(d)); + } else { + throw new IllegalStateException(); + } + } + return result; + } public boolean validateDimensions(int[] dimensions, int index) { if(elements.size() != dimensions[index]) return false; @@ -220,7 +234,30 @@ public class Array implements IExpression { } else if (l instanceof Array && r instanceof Array) { Array arr = (Array)l; Array otherArr = (Array)r; - result.addElement(arr.add(otherArr)); + result.addElement(arr.mul(otherArr)); + } else { + throw new IllegalStateException(); + } + } + return result; + } + + public Array pow(Array other) { + Array result = new Array(); + Collection lae = elements(); + Collection rae = other.elements(); + if(lae.size() != rae.size()) throw new IllegalStateException(); + Iterator li = lae.iterator(); + Iterator ri = rae.iterator(); + for(int i=0;i lae = la.elements(); + Collection rae = ra.elements(); + if(lae.size() != rae.size()) throw new UnsupportedOperationException(); + Iterator li = lae.iterator(); + Iterator ri = rae.iterator(); + Array result = new Array(); + for(int i=0;i copies) { + exp1 = exp1.rewrite(frame, copies); + exp2 = exp2.rewrite(frame, copies); + return this; + } + + @Override + public void accept(ExpressionVisitor visitor) { + visitor.visit(this); + exp1.accept(visitor); + exp2.accept(visitor); + } + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ElementwisePower.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ElementwisePower.java new file mode 100644 index 00000000..6fac7280 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ElementwisePower.java @@ -0,0 +1,78 @@ +/******************************************************************************* + * Copyright (c) 2013 Semantum Oy. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Semantum Oy - initial API and implementation + *******************************************************************************/ +package fi.semantum.sysdyn.solver; + +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; + +public class ElementwisePower implements IExpression { + + public IExpression exp1; + public IExpression exp2; + + public ElementwisePower(IExpression exp1, IExpression exp2) { + this.exp1 = exp1; + this.exp2 = exp2; + } + + @Override + public String toString() { + return exp1 + " ^ " + exp2; + } + + @Override + public Object evaluate(IEnvironment environment) { + Object left = exp1.evaluate(environment); + Object right = exp2.evaluate(environment); + if(left instanceof Array && right instanceof Array) { + Array la = (Array)left; + Array ra = (Array)right; + Collection lae = la.elements(); + Collection rae = ra.elements(); + if(lae.size() != rae.size()) throw new UnsupportedOperationException(); + Iterator li = lae.iterator(); + Iterator ri = rae.iterator(); + Array result = new Array(); + for(int i=0;i copies) { + exp1 = exp1.rewrite(frame, copies); + exp2 = exp2.rewrite(frame, copies); + return this; + } + + @Override + public void accept(ExpressionVisitor visitor) { + visitor.visit(this); + exp1.accept(visitor); + exp2.accept(visitor); + } + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/NodeClass.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/NodeClass.java index 33415ec5..81b86df7 100644 --- a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/NodeClass.java +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/NodeClass.java @@ -45,9 +45,11 @@ public enum NodeClass { logical_term, arithmetic_expression, term, + factor, if_expression, add_op, mul_op, + factor_op, rel_op, der_initial, output_expression_list, diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Parser.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Parser.java index cbfac5e7..175ea53c 100644 --- a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Parser.java +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Parser.java @@ -27,7 +27,7 @@ public class Parser { // public IFrame currentFrame; - private int PRINT = 0; + private int PRINT = 1; public Object walk(SimpleNode n, int indent, IFrame model) { Object result = walk_(n, indent, model); @@ -511,12 +511,26 @@ public class Parser { IExpression exp2 = (IExpression)walk((SimpleNode)n.jjtGetChild(i+1), indent+2, frame); if("*".equals(op)) term = new Multiplication(term, exp2); else if(".*".equals(op)) term = new ElementwiseProduct(term, exp2); + else if("./".equals(op)) term = new ElementwiseDivision(term, exp2); else if("/".equals(op)) term = new Division(term, exp2); } return term; } else { return walk((SimpleNode)n.jjtGetChild(0), indent+2, frame); } + case factor: + if(n.jjtGetNumChildren() > 1) { + IExpression term = (IExpression)walk((SimpleNode)n.jjtGetChild(0), indent+2, frame); + for(int i=1;i copies) { + exp1 = exp1.rewrite(frame, copies); + exp2 = exp2.rewrite(frame, copies); + return this; + } + + @Override + public void accept(ExpressionVisitor visitor) { + visitor.visit(this); + exp1.accept(visitor); + exp2.accept(visitor); + } + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParser.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParser.java index 29ef1f1e..de6a2b25 100644 --- a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParser.java +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParser.java @@ -3686,6 +3686,9 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo break; case 85: jj_consume_token(85); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.op = "./"; break; default: jj_la1[105] = jj_gen; @@ -4655,13 +4658,13 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo if (jj_scan_token(62)) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_165()) jj_scanpos = xsp; + if (jj_3R_166()) jj_scanpos = xsp; if (jj_scan_token(63)) return true; return false; } - private boolean jj_3R_85() { - if (jj_3R_95()) return true; + private boolean jj_3R_129() { + if (jj_scan_token(49)) return true; return false; } @@ -4670,36 +4673,17 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_129() { - if (jj_scan_token(49)) return true; - return false; - } - - private boolean jj_3R_152() { + private boolean jj_3R_153() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(68)) jj_scanpos = xsp; if (jj_scan_token(IDENT)) return true; xsp = jj_scanpos; - if (jj_3R_160()) jj_scanpos = xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_161()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_42() { - if (jj_3R_43()) return true; - Token xsp; + if (jj_3R_161()) jj_scanpos = xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_50()) { jj_scanpos = xsp; break; } + if (jj_3R_162()) { jj_scanpos = xsp; break; } } - xsp = jj_scanpos; - if (jj_3R_51()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_3R_52()) jj_scanpos = xsp; return false; } @@ -4709,13 +4693,13 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_158() { + private boolean jj_3R_159() { if (jj_scan_token(58)) return true; return false; } - private boolean jj_3R_106() { - if (jj_scan_token(7)) return true; + private boolean jj_3R_77() { + if (jj_scan_token(68)) return true; return false; } @@ -4724,11 +4708,6 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_77() { - if (jj_scan_token(68)) return true; - return false; - } - private boolean jj_3R_60() { Token xsp; xsp = jj_scanpos; @@ -4741,12 +4720,6 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_71() { - if (jj_scan_token(21)) return true; - if (jj_3R_85()) return true; - return false; - } - private boolean jj_3R_46() { if (jj_3R_60()) return true; return false; @@ -4766,42 +4739,28 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_163() { - if (jj_scan_token(70)) return true; + private boolean jj_3R_123() { + if (jj_scan_token(74)) return true; return false; } private boolean jj_3R_146() { - if (jj_3R_154()) return true; - return false; - } - - private boolean jj_3R_123() { - if (jj_scan_token(74)) return true; + if (jj_3R_155()) return true; return false; } - private boolean jj_3_4() { - if (jj_scan_token(IDENT)) return true; - if (jj_scan_token(88)) return true; - if (jj_scan_token(40)) return true; + private boolean jj_3R_164() { + if (jj_scan_token(70)) return true; return false; } private boolean jj_3R_145() { if (jj_scan_token(66)) return true; - if (jj_3R_153()) return true; + if (jj_3R_154()) return true; if (jj_scan_token(67)) return true; return false; } - private boolean jj_3_3() { - if (jj_scan_token(IDENT)) return true; - if (jj_scan_token(88)) return true; - if (jj_scan_token(58)) return true; - return false; - } - private boolean jj_3R_144() { if (jj_scan_token(62)) return true; if (jj_3R_47()) return true; @@ -4809,42 +4768,18 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3_2() { - if (jj_scan_token(IDENT)) return true; - if (jj_scan_token(88)) return true; - return false; - } - - private boolean jj_3R_156() { - if (jj_scan_token(87)) return true; - return false; - } - private boolean jj_3R_142() { - if (jj_3R_151()) return true; - return false; - } - - private boolean jj_3R_143() { if (jj_3R_152()) return true; return false; } - private boolean jj_3_1() { - if (jj_scan_token(IDENT)) return true; - if (jj_3R_41()) return true; - if (jj_3R_42()) return true; - if (jj_scan_token(35)) return true; - return false; - } - - private boolean jj_3R_141() { - if (jj_scan_token(33)) return true; + private boolean jj_3R_157() { + if (jj_scan_token(87)) return true; return false; } - private boolean jj_3R_137() { - if (jj_scan_token(UNSIGNED_NUMBER)) return true; + private boolean jj_3R_143() { + if (jj_3R_153()) return true; return false; } @@ -4885,6 +4820,16 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } + private boolean jj_3R_137() { + if (jj_scan_token(UNSIGNED_NUMBER)) return true; + return false; + } + + private boolean jj_3R_141() { + if (jj_scan_token(33)) return true; + return false; + } + private boolean jj_3R_140() { if (jj_scan_token(6)) return true; return false; @@ -4895,11 +4840,6 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_108() { - if (jj_scan_token(26)) return true; - return false; - } - private boolean jj_3R_138() { if (jj_scan_token(UNSIGNED_INTEGER)) return true; return false; @@ -4915,9 +4855,9 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_154() { + private boolean jj_3R_155() { if (jj_scan_token(64)) return true; - if (jj_3R_164()) return true; + if (jj_3R_165()) return true; if (jj_scan_token(65)) return true; return false; } @@ -4928,22 +4868,17 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_105() { - if (jj_scan_token(34)) return true; - return false; - } - - private boolean jj_3R_153() { - if (jj_3R_162()) return true; + private boolean jj_3R_154() { + if (jj_3R_163()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_163()) { jj_scanpos = xsp; break; } + if (jj_3R_164()) { jj_scanpos = xsp; break; } } return false; } - private boolean jj_3R_157() { + private boolean jj_3R_158() { if (jj_3R_60()) return true; return false; } @@ -4953,14 +4888,14 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_151() { + private boolean jj_3R_152() { Token xsp; xsp = jj_scanpos; - if (jj_3R_157()) { - jj_scanpos = xsp; if (jj_3R_158()) { jj_scanpos = xsp; - if (jj_3R_159()) return true; + if (jj_3R_159()) { + jj_scanpos = xsp; + if (jj_3R_160()) return true; } } if (jj_3R_74()) return true; @@ -4972,62 +4907,21 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_101() { + private boolean jj_3R_147() { Token xsp; xsp = jj_scanpos; - if (jj_scan_token(30)) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_scan_token(47)) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_3R_105()) { - jj_scanpos = xsp; - if (jj_3R_106()) { - jj_scanpos = xsp; - if (jj_scan_token(61)) { - jj_scanpos = xsp; - if (jj_scan_token(24)) { - jj_scanpos = xsp; - if (jj_3R_107()) { + if (jj_3R_156()) { jj_scanpos = xsp; - if (jj_scan_token(38)) { - jj_scanpos = xsp; - if (jj_scan_token(37)) { - jj_scanpos = xsp; - if (jj_3R_108()) { - jj_scanpos = xsp; - if (jj_scan_token(17)) { - jj_scanpos = xsp; - if (jj_scan_token(95)) { - jj_scanpos = xsp; - if (jj_scan_token(96)) return true; - } - } - } - } - } - } - } - } - } + if (jj_3R_157()) return true; } return false; } - private boolean jj_3R_155() { + private boolean jj_3R_156() { if (jj_scan_token(86)) return true; return false; } - private boolean jj_3R_147() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_155()) { - jj_scanpos = xsp; - if (jj_3R_156()) return true; - } - return false; - } - private boolean jj_3R_119() { if (jj_3R_134()) return true; Token xsp; @@ -5042,20 +4936,15 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_113() { - if (jj_3R_118()) return true; - if (jj_3R_112()) return true; - return false; - } - private boolean jj_3R_104() { if (jj_3R_114()) return true; if (jj_3R_103()) return true; return false; } - private boolean jj_3R_148() { - if (jj_scan_token(82)) return true; + private boolean jj_3R_113() { + if (jj_3R_118()) return true; + if (jj_3R_112()) return true; return false; } @@ -5068,13 +4957,18 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo jj_scanpos = xsp; if (jj_3R_150()) { jj_scanpos = xsp; - if (jj_scan_token(85)) return true; + if (jj_3R_151()) return true; } } } return false; } + private boolean jj_3R_148() { + if (jj_scan_token(82)) return true; + return false; + } + private boolean jj_3R_110() { if (jj_3R_60()) return true; return false; @@ -5090,17 +4984,6 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_70() { - if (jj_scan_token(31)) return true; - if (jj_3R_47()) return true; - return false; - } - - private boolean jj_3R_132() { - if (jj_scan_token(78)) return true; - return false; - } - private boolean jj_3R_131() { if (jj_scan_token(56)) return true; return false; @@ -5122,8 +5005,8 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3_7() { - if (jj_3R_44()) return true; + private boolean jj_3R_132() { + if (jj_scan_token(78)) return true; return false; } @@ -5133,8 +5016,13 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_111() { - if (jj_3R_118()) return true; + private boolean jj_3R_117() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_130()) { + jj_scanpos = xsp; + if (jj_3R_131()) return true; + } return false; } @@ -5143,16 +5031,29 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_117() { + private boolean jj_3R_111() { + if (jj_3R_118()) return true; + return false; + } + + private boolean jj_3R_116() { Token xsp; xsp = jj_scanpos; - if (jj_3R_130()) { + if (jj_3R_127()) { jj_scanpos = xsp; - if (jj_3R_131()) return true; + if (jj_3R_128()) { + jj_scanpos = xsp; + if (jj_3R_129()) return true; + } } return false; } + private boolean jj_3R_127() { + if (jj_scan_token(5)) return true; + return false; + } + private boolean jj_3R_103() { Token xsp; xsp = jj_scanpos; @@ -5165,25 +5066,12 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_127() { - if (jj_scan_token(5)) return true; - return false; - } - - private boolean jj_3R_121() { - if (jj_scan_token(72)) return true; - return false; - } - - private boolean jj_3R_116() { + private boolean jj_3R_115() { Token xsp; xsp = jj_scanpos; - if (jj_3R_127()) { - jj_scanpos = xsp; - if (jj_3R_128()) { + if (jj_scan_token(16)) { jj_scanpos = xsp; - if (jj_3R_129()) return true; - } + if (jj_scan_token(23)) return true; } return false; } @@ -5210,13 +5098,8 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_115() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(16)) { - jj_scanpos = xsp; - if (jj_scan_token(23)) return true; - } + private boolean jj_3R_121() { + if (jj_scan_token(72)) return true; return false; } @@ -5269,27 +5152,6 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_58() { - if (jj_scan_token(IDENT)) return true; - if (jj_3R_74()) return true; - return false; - } - - private boolean jj_3R_57() { - if (jj_3R_73()) return true; - return false; - } - - private boolean jj_3R_56() { - if (jj_3R_72()) return true; - return false; - } - - private boolean jj_3R_55() { - if (jj_3R_71()) return true; - return false; - } - private boolean jj_3R_86() { if (jj_3R_96()) return true; Token xsp; @@ -5300,8 +5162,8 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_54() { - if (jj_3R_70()) return true; + private boolean jj_3R_92() { + if (jj_scan_token(27)) return true; return false; } @@ -5315,16 +5177,6 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_92() { - if (jj_scan_token(27)) return true; - return false; - } - - private boolean jj_3_8() { - if (jj_3R_45()) return true; - return false; - } - private boolean jj_3R_59() { if (jj_3R_75()) return true; Token xsp; @@ -5333,8 +5185,8 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_172() { - if (jj_3R_47()) return true; + private boolean jj_3R_66() { + if (jj_3R_80()) return true; return false; } @@ -5344,16 +5196,6 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_66() { - if (jj_3R_80()) return true; - return false; - } - - private boolean jj_3R_61() { - if (jj_3R_59()) return true; - return false; - } - private boolean jj_3R_47() { Token xsp; xsp = jj_scanpos; @@ -5364,36 +5206,8 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_68() { - if (jj_scan_token(14)) return true; - return false; - } - - private boolean jj_3R_44() { - Token xsp; - xsp = jj_scanpos; - if (jj_3_8()) { - jj_scanpos = xsp; - if (jj_3R_54()) { - jj_scanpos = xsp; - if (jj_3R_55()) { - jj_scanpos = xsp; - if (jj_3R_56()) { - jj_scanpos = xsp; - if (jj_3R_57()) { - jj_scanpos = xsp; - if (jj_3R_58()) return true; - } - } - } - } - } - return false; - } - - private boolean jj_3R_161() { - if (jj_scan_token(68)) return true; - if (jj_scan_token(IDENT)) return true; + private boolean jj_3R_61() { + if (jj_3R_59()) return true; return false; } @@ -5408,56 +5222,19 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_64() { - if (jj_scan_token(21)) return true; - return false; - } - - private boolean jj_3R_49() { - if (jj_scan_token(STRING)) return true; - return false; - } - private boolean jj_3_6() { if (jj_scan_token(IDENT)) return true; if (jj_scan_token(88)) return true; return false; } - private boolean jj_3R_41() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_49()) jj_scanpos = xsp; - return false; - } - private boolean jj_3R_90() { if (jj_scan_token(55)) return true; return false; } - private boolean jj_3R_126() { - if (jj_scan_token(77)) return true; - return false; - } - - private boolean jj_3R_45() { - if (jj_3R_59()) return true; - if (jj_scan_token(88)) return true; - if (jj_3R_47()) return true; - return false; - } - - private boolean jj_3R_81() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(46)) jj_scanpos = xsp; - if (jj_scan_token(4)) return true; - return false; - } - - private boolean jj_3R_88() { - if (jj_scan_token(46)) return true; + private boolean jj_3R_89() { + if (jj_scan_token(36)) return true; return false; } @@ -5467,36 +5244,18 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_89() { - if (jj_scan_token(36)) return true; - return false; - } - - private boolean jj_3R_80() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_88()) jj_scanpos = xsp; - if (jj_scan_token(45)) return true; - return false; - } - private boolean jj_3R_94() { if (jj_scan_token(13)) return true; return false; } - private boolean jj_3R_65() { - if (jj_scan_token(52)) return true; - return false; - } - private boolean jj_3R_98() { if (jj_3R_101()) return true; return false; } - private boolean jj_3R_171() { - if (jj_scan_token(69)) return true; + private boolean jj_3R_65() { + if (jj_scan_token(52)) return true; return false; } @@ -5510,18 +5269,8 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_169() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_171()) { - jj_scanpos = xsp; - if (jj_3R_172()) return true; - } - return false; - } - - private boolean jj_3R_167() { - if (jj_scan_token(71)) return true; + private boolean jj_3R_91() { + if (jj_scan_token(51)) return true; return false; } @@ -5533,16 +5282,6 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_91() { - if (jj_scan_token(51)) return true; - return false; - } - - private boolean jj_3R_160() { - if (jj_3R_166()) return true; - return false; - } - private boolean jj_3R_84() { Token xsp; xsp = jj_scanpos; @@ -5566,32 +5305,11 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_166() { - if (jj_scan_token(66)) return true; - if (jj_3R_169()) return true; - return false; - } - private boolean jj_3R_82() { if (jj_3R_89()) return true; return false; } - private boolean jj_3R_63() { - if (jj_scan_token(71)) return true; - return false; - } - - private boolean jj_3R_48() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_63()) { - jj_scanpos = xsp; - if (jj_3R_64()) return true; - } - return false; - } - private boolean jj_3R_69() { Token xsp; xsp = jj_scanpos; @@ -5605,21 +5323,6 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_162() { - if (jj_3R_47()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_167()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_125() { - if (jj_scan_token(76)) return true; - return false; - } - private boolean jj_3R_53() { if (jj_3R_69()) return true; return false; @@ -5640,57 +5343,19 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3R_173() { - if (jj_scan_token(IDENT)) return true; - if (jj_scan_token(88)) return true; - return false; - } - - private boolean jj_3R_159() { - if (jj_scan_token(46)) return true; - return false; - } - - private boolean jj_3R_170() { - if (jj_3R_173()) return true; - return false; - } - - private boolean jj_3R_168() { - if (jj_3R_170()) return true; - return false; - } - - private boolean jj_3_10() { - if (jj_3R_47()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_48()) jj_scanpos = xsp; - return false; - } - private boolean jj_3R_52() { if (jj_3R_68()) return true; return false; } - private boolean jj_3R_165() { - if (jj_3R_164()) return true; - return false; - } - - private boolean jj_3R_164() { - Token xsp; - xsp = jj_scanpos; - if (jj_3_10()) { - jj_scanpos = xsp; - if (jj_3R_168()) return true; - } + private boolean jj_3R_51() { + if (jj_scan_token(59)) return true; return false; } - private boolean jj_3R_51() { - if (jj_scan_token(59)) return true; + private boolean jj_3_5() { + if (jj_scan_token(57)) return true; + if (jj_3R_43()) return true; return false; } @@ -5710,14 +5375,357 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo return false; } - private boolean jj_3_5() { - if (jj_scan_token(57)) return true; - if (jj_3R_43()) return true; + private boolean jj_3R_95() { + if (jj_scan_token(IDENT)) return true; return false; } - private boolean jj_3R_95() { + private boolean jj_3R_85() { + if (jj_3R_95()) return true; + return false; + } + + private boolean jj_3R_42() { + if (jj_3R_43()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_50()) { jj_scanpos = xsp; break; } + } + xsp = jj_scanpos; + if (jj_3R_51()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_52()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_106() { + if (jj_scan_token(7)) return true; + return false; + } + + private boolean jj_3R_71() { + if (jj_scan_token(21)) return true; + if (jj_3R_85()) return true; + return false; + } + + private boolean jj_3_4() { + if (jj_scan_token(IDENT)) return true; + if (jj_scan_token(88)) return true; + if (jj_scan_token(40)) return true; + return false; + } + + private boolean jj_3_3() { + if (jj_scan_token(IDENT)) return true; + if (jj_scan_token(88)) return true; + if (jj_scan_token(58)) return true; + return false; + } + + private boolean jj_3_2() { + if (jj_scan_token(IDENT)) return true; + if (jj_scan_token(88)) return true; + return false; + } + + private boolean jj_3_1() { if (jj_scan_token(IDENT)) return true; + if (jj_3R_41()) return true; + if (jj_3R_42()) return true; + if (jj_scan_token(35)) return true; + return false; + } + + private boolean jj_3R_108() { + if (jj_scan_token(26)) return true; + return false; + } + + private boolean jj_3R_105() { + if (jj_scan_token(34)) return true; + return false; + } + + private boolean jj_3R_101() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(30)) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_scan_token(47)) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_105()) { + jj_scanpos = xsp; + if (jj_3R_106()) { + jj_scanpos = xsp; + if (jj_scan_token(61)) { + jj_scanpos = xsp; + if (jj_scan_token(24)) { + jj_scanpos = xsp; + if (jj_3R_107()) { + jj_scanpos = xsp; + if (jj_scan_token(38)) { + jj_scanpos = xsp; + if (jj_scan_token(37)) { + jj_scanpos = xsp; + if (jj_3R_108()) { + jj_scanpos = xsp; + if (jj_scan_token(17)) { + jj_scanpos = xsp; + if (jj_scan_token(95)) { + jj_scanpos = xsp; + if (jj_scan_token(96)) return true; + } + } + } + } + } + } + } + } + } + } + return false; + } + + private boolean jj_3R_70() { + if (jj_scan_token(31)) return true; + if (jj_3R_47()) return true; + return false; + } + + private boolean jj_3_7() { + if (jj_3R_44()) return true; + return false; + } + + private boolean jj_3R_58() { + if (jj_scan_token(IDENT)) return true; + if (jj_3R_74()) return true; + return false; + } + + private boolean jj_3R_57() { + if (jj_3R_73()) return true; + return false; + } + + private boolean jj_3R_56() { + if (jj_3R_72()) return true; + return false; + } + + private boolean jj_3R_55() { + if (jj_3R_71()) return true; + return false; + } + + private boolean jj_3R_54() { + if (jj_3R_70()) return true; + return false; + } + + private boolean jj_3_8() { + if (jj_3R_45()) return true; + return false; + } + + private boolean jj_3R_173() { + if (jj_3R_47()) return true; + return false; + } + + private boolean jj_3R_68() { + if (jj_scan_token(14)) return true; + return false; + } + + private boolean jj_3R_44() { + Token xsp; + xsp = jj_scanpos; + if (jj_3_8()) { + jj_scanpos = xsp; + if (jj_3R_54()) { + jj_scanpos = xsp; + if (jj_3R_55()) { + jj_scanpos = xsp; + if (jj_3R_56()) { + jj_scanpos = xsp; + if (jj_3R_57()) { + jj_scanpos = xsp; + if (jj_3R_58()) return true; + } + } + } + } + } + return false; + } + + private boolean jj_3R_162() { + if (jj_scan_token(68)) return true; + if (jj_scan_token(IDENT)) return true; + return false; + } + + private boolean jj_3R_64() { + if (jj_scan_token(21)) return true; + return false; + } + + private boolean jj_3R_49() { + if (jj_scan_token(STRING)) return true; + return false; + } + + private boolean jj_3R_41() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_49()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_81() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(46)) jj_scanpos = xsp; + if (jj_scan_token(4)) return true; + return false; + } + + private boolean jj_3R_45() { + if (jj_3R_59()) return true; + if (jj_scan_token(88)) return true; + if (jj_3R_47()) return true; + return false; + } + + private boolean jj_3R_126() { + if (jj_scan_token(77)) return true; + return false; + } + + private boolean jj_3R_88() { + if (jj_scan_token(46)) return true; + return false; + } + + private boolean jj_3R_80() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_88()) jj_scanpos = xsp; + if (jj_scan_token(45)) return true; + return false; + } + + private boolean jj_3R_172() { + if (jj_scan_token(69)) return true; + return false; + } + + private boolean jj_3R_168() { + if (jj_scan_token(71)) return true; + return false; + } + + private boolean jj_3R_170() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_172()) { + jj_scanpos = xsp; + if (jj_3R_173()) return true; + } + return false; + } + + private boolean jj_3R_161() { + if (jj_3R_167()) return true; + return false; + } + + private boolean jj_3R_48() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_63()) { + jj_scanpos = xsp; + if (jj_3R_64()) return true; + } + return false; + } + + private boolean jj_3R_63() { + if (jj_scan_token(71)) return true; + return false; + } + + private boolean jj_3R_167() { + if (jj_scan_token(66)) return true; + if (jj_3R_170()) return true; + return false; + } + + private boolean jj_3R_125() { + if (jj_scan_token(76)) return true; + return false; + } + + private boolean jj_3R_163() { + if (jj_3R_47()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_168()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_174() { + if (jj_scan_token(IDENT)) return true; + if (jj_scan_token(88)) return true; + return false; + } + + private boolean jj_3R_160() { + if (jj_scan_token(46)) return true; + return false; + } + + private boolean jj_3R_171() { + if (jj_3R_174()) return true; + return false; + } + + private boolean jj_3R_151() { + if (jj_scan_token(85)) return true; + return false; + } + + private boolean jj_3R_169() { + if (jj_3R_171()) return true; + return false; + } + + private boolean jj_3_10() { + if (jj_3R_47()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_48()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_165() { + Token xsp; + xsp = jj_scanpos; + if (jj_3_10()) { + jj_scanpos = xsp; + if (jj_3R_169()) return true; + } + return false; + } + + private boolean jj_3R_166() { + if (jj_3R_165()) return true; return false; } diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelicaParser.jj b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelicaParser.jj index 2ba477f3..190ea2f8 100644 --- a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelicaParser.jj +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelicaParser.jj @@ -2365,6 +2365,11 @@ void mul_op() : {/*@bgen(jjtree) mul_op */ jjtc000 = false; } /*@egen*/ { jjtn000.op = ".*";} | "./"/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ { jjtn000.op = "./";}/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelicaParser.jjt b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelicaParser.jjt index 0296fd88..2fc5f9ce 100644 --- a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelicaParser.jjt +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelicaParser.jjt @@ -652,7 +652,7 @@ void term() : { void mul_op() : { } { - "*" { jjtThis.op = "*";} | "/" { jjtThis.op = "/";} | ".*" { jjtThis.op = ".*";} | "./" + "*" { jjtThis.op = "*";} | "/" { jjtThis.op = "/";} | ".*" { jjtThis.op = ".*";} | "./" { jjtThis.op = "./";} } void factor() : { diff --git a/org.simantics.sysdyn.ui/plugin.xml b/org.simantics.sysdyn.ui/plugin.xml index eadf6cee..2a623324 100644 --- a/org.simantics.sysdyn.ui/plugin.xml +++ b/org.simantics.sysdyn.ui/plugin.xml @@ -782,6 +782,23 @@ style="push"> --> + + + + + + + + + + + + + + + + + + + + @@ -1404,6 +1445,11 @@ property="org.simantics.graph.resourceType" value="true"> + + @@ -1466,6 +1512,14 @@ + + + + @@ -1762,6 +1816,21 @@ class="org.simantics.sysdyn.ui.trend.TrendToSvg" commandId="org.simantics.sysdyn.ui.trend.view.svg"> + + + + + + + + + + @@ -1842,6 +1911,10 @@ args="org.simantics.sysdyn.ui.browser.nodes.AbstractChartNode" property="org.simantics.sysdyn.ui.nodeClass"> + +