]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Merge changes from trunk
authorjkauttio <jkauttio@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 17 Apr 2014 11:55:12 +0000 (11:55 +0000)
committerjkauttio <jkauttio@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 17 Apr 2014 11:55:12 +0000 (11:55 +0000)
refs #2924

git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/branches/dev-jkauttio@29301 ac1ea38d-2e2b-0410-8846-a27921b304fc

82 files changed:
fi.semantum.sysdyn.solver/META-INF/MANIFEST.MF
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Addition.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/And.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Application.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Argument.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Array.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ArraySliceExpression.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Assignment.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Constant.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Declaration.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Derivate.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Derivative.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Division.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ElementwiseProduct.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Equals.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ForArray.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/GreaterOrEqualThan.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/GreaterThan.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IExpression.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IfThenElse.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/LessOrEqualThan.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/LessThan.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Multiplication.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Negation.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/NotEquals.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/NullModification.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Or.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ParameterDeclaration.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Solver.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Subtraction.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/TimeVariable.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Variable.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/VariableBase.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/VariableDeclaration.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParser.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParserConstants.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParserTokenManager.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelicaParser.jj
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelicaParser.jjt
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/AdjustableTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/LabelPropertyTabContributor.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/bar/BarAxisTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/bar/BarGeneralPropertiesTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/bar/BarSeriesTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/pie/PieGeneralPropertiesTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/pie/PieSeriesTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/xyline/XYLineAxisAndVariablesTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/xyline/XYLineGeneralPropertiesTab.java
org.simantics.sysdyn.feature/rootfiles/sampleModels/Tourists Environments And Hotel Facilities.sysdyn
org.simantics.sysdyn.ontology/graph.tg
org.simantics.sysdyn.ontology/graph/Migration.pgraph
org.simantics.sysdyn.ontology/graph/Sysdyn.pgraph
org.simantics.sysdyn.ontology/src/org/simantics/sysdyn/SysdynResource.java
org.simantics.sysdyn.ui/plugin.xml
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Model.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/LoopFactory.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ArrayDependencyTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/CommentTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ConfigurationTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/DependencyTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EquationTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/FunctionTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/LoopTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/SensitivityAnalysisExperimentTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/VariableInformationTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/CustomFontDialog.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/SensitivityChartAxisAndVariablesTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/ArrayVariableUtils.java
org.simantics.sysdyn/adapters.xml
org.simantics.sysdyn/scl/Sysdyn.scl
org.simantics.sysdyn/src/org/simantics/sysdyn/Functions.java
org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/CustomMigrationStep.java [new file with mode: 0644]
org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariable.java
org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableBase.java [new file with mode: 0644]
org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableI.java [new file with mode: 0644]
org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Sheet.java
org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/IndexUtils.java
org.simantics.sysdyn/src/org/simantics/sysdyn/utils/DocumentationUtils.java
org.simantics.sysdyn/src/org/simantics/sysdyn/utils/LoopUtils.java
org.simantics.sysdyn/src/org/simantics/sysdyn/utils/ModelUtils.java
org.simantics.sysdyn/src/org/simantics/sysdyn/utils/ProfileEntries.java

index 7f8fe97d19ac5dcb28aaff4086048b5e9ba9a302..3256e51361bff8c9fb4984c3f4df3bca96a84c30 100644 (file)
@@ -7,7 +7,8 @@ Bundle-Activator: fi.semantum.sysdyn.solver.Activator
 Bundle-Vendor: Semantum Oy
 Require-Bundle: org.eclipse.core.runtime,
  org.simantics.utils;bundle-version="1.1.0",
- org.simantics.databoard;bundle-version="0.6.5"
+ org.simantics.databoard;bundle-version="0.6.5",
+ org.simantics.utils.datastructures;bundle-version="1.1.0"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ActivationPolicy: lazy
 Export-Package: fi.semantum.sysdyn.solver
index 27ee6841018a5f8788a7df75d5b6e6a6fdb2c49e..a407ca4e2dec1adcc04b73f440e49f2b88514341 100644 (file)
@@ -61,4 +61,11 @@ public class Addition implements IExpression {
                return this;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               exp1.accept(visitor);\r
+               exp2.accept(visitor);\r
+       }\r
+       \r
 }\r
index d77a191c0972e1653f330af130da141fef10bfe4..dc3ab53d03f92e0821797fc86514ff45242692aa 100644 (file)
@@ -13,6 +13,8 @@ package fi.semantum.sysdyn.solver;
 import java.util.ArrayList;\r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class And implements IExpression {\r
        \r
     public IExpression[] exps;\r
@@ -59,4 +61,10 @@ public class And implements IExpression {
                return this;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               for(IExpression exp : exps) exp.accept(visitor);\r
+       }\r
+       \r
 }\r
index c9c2282c923e576c1896f88607db1b94f93cab41..a59ece28b39daa68866aeade33baba2d9cfdabbb 100644 (file)
@@ -12,6 +12,8 @@ package fi.semantum.sysdyn.solver;
 \r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class Application implements IExpression {\r
 \r
        public String name;\r
@@ -48,4 +50,11 @@ public class Application implements IExpression {
                return this;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               for(Argument a : args.args)\r
+                       a.modification.accept(visitor);\r
+       }\r
+       \r
 }\r
index 3a7013f4eddc77158f81711c13845a7935135c06..2712ab905037bf5dd5fa026b1d7a0cebd63a17df 100644 (file)
@@ -12,6 +12,8 @@ package fi.semantum.sysdyn.solver;
 \r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class Argument implements IExpression {\r
 \r
        public String name;\r
@@ -47,4 +49,10 @@ public class Argument implements IExpression {
                return this;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               modification.accept(visitor);\r
+       }\r
+       \r
 }\r
index 72fcd4050e1532c88b1aceb62e6baf7f6fd98607..4544936274cd53fdc4bcebd8b3e900421320d939 100644 (file)
@@ -15,6 +15,7 @@ import java.util.Collection;
 import java.util.Iterator;\r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
 import fi.semantum.sysdyn.solver.SolverUtils.Slice;\r
 \r
 public class Array implements IExpression {\r
@@ -227,4 +228,15 @@ public class Array implements IExpression {
                return result;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               for(int i=0;i<elements.size();i++) {\r
+                       Object element = elements.get(i);\r
+                       if(element instanceof IExpression) {\r
+                               ((IExpression)element).accept(visitor);\r
+                       }\r
+               }\r
+       }\r
+       \r
 }\r
index b2813e698071da7e4b4a7c1e1342055b00b24961..9ed04b14069c72af50efe648cc0f30216b09f8cc 100644 (file)
@@ -12,6 +12,8 @@ package fi.semantum.sysdyn.solver;
 \r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class ArraySliceExpression implements IExpression {\r
 \r
        public IExpression start;\r
@@ -54,4 +56,11 @@ public class ArraySliceExpression implements IExpression {
                return this;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               start.accept(visitor);\r
+               end.accept(visitor);\r
+       }\r
+       \r
 }\r
index fd7f1d06932b6016278a7dcf4474a9cf88e15aa3..acaee56a3aefd664b8b2994dd047a015f7cad7e2 100644 (file)
@@ -10,7 +10,7 @@
  *******************************************************************************/\r
 package fi.semantum.sysdyn.solver;\r
 \r
-import org.omg.PortableInterceptor.SUCCESSFUL;\r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
 \r
 public class Assignment {\r
        \r
index d00f236293d2da28c44a8653674bb8606d5112b7..9fd58ddd0df7279a1443e1f22c30706b18a7e659 100644 (file)
@@ -12,6 +12,8 @@ package fi.semantum.sysdyn.solver;
 \r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class Constant implements IExpression {\r
 \r
        public Object value;\r
@@ -49,5 +51,10 @@ public class Constant implements IExpression {
                return this;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+       }\r
+       \r
 }\r
 \r
index a1490f5270d93fdf7ae7e6069f3b40b234718a5c..90b2cfc2a1eb7dfaddd305855b23eafb8097e5dd 100644 (file)
  *******************************************************************************/\r
 package fi.semantum.sysdyn.solver;\r
 \r
+import java.nio.channels.UnsupportedAddressTypeException;\r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class Declaration implements IExpression {\r
 \r
        public Variable variable;\r
@@ -48,4 +51,9 @@ public class Declaration implements IExpression {
                throw new UnsupportedOperationException();\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               throw new UnsupportedOperationException();\r
+       }\r
+\r
 }\r
index 426e3fa72ad39adb9d53aaddfaa902e827b28f87..ef3b60121f104e749982486eabaeacd86550b530 100644 (file)
@@ -12,11 +12,13 @@ package fi.semantum.sysdyn.solver;
 \r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class Derivate implements IExpression {\r
 \r
        private Variable variable;\r
        private IExpression[] subscripts;\r
-       private IExpression e;\r
+       public IExpression e;\r
        \r
        public Derivate(Variable variable, IExpression[] subscripts, IExpression e) {\r
                this.variable = variable;\r
@@ -64,4 +66,14 @@ public class Derivate implements IExpression {
                return this;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               if(subscripts != null) {\r
+                       for(int i=0;i<subscripts.length;i++)\r
+                               subscripts[i].accept(visitor);\r
+               }\r
+               e.accept(visitor);\r
+       }\r
+       \r
 }\r
index 51dbf974ae394ed64f8f4d62efc603e1fee3a814..037a17453fa4c3eb558b7aa8998dec32ac90f9f5 100644 (file)
@@ -45,4 +45,9 @@ public class Derivative implements IExpression {
                throw new UnsupportedOperationException();\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               throw new UnsupportedOperationException();\r
+       }\r
+       \r
 }\r
index 0f643949c853c569ec05cb762de3be69c7e4096f..6b7658f20de06f4cea1fd128f15109fe553794ec 100644 (file)
@@ -12,6 +12,8 @@ package fi.semantum.sysdyn.solver;
 \r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class Division implements IExpression {\r
        \r
     public IExpression exp1;\r
@@ -66,4 +68,11 @@ public class Division implements IExpression {
                return this;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               exp1.accept(visitor);\r
+               exp2.accept(visitor);\r
+       }\r
+       \r
 }\r
index d8d3aafb70908657313e88f493311b6bfb89922b..5888029f8b1f713cd64e9f3fc706379692ec1565 100644 (file)
@@ -14,6 +14,8 @@ import java.util.Collection;
 import java.util.Iterator;\r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class ElementwiseProduct implements IExpression {\r
        \r
     public IExpression exp1;\r
@@ -68,4 +70,11 @@ public class ElementwiseProduct implements IExpression {
                return this;\r
        }\r
 \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               exp1.accept(visitor);\r
+               exp2.accept(visitor);\r
+       }\r
+       \r
 }\r
index a92ed1a32adf2bf2282756e1e1fdadee78d7a43e..110c99bd97c06f657b862b96f53900dd0d29a0df 100644 (file)
@@ -12,6 +12,8 @@ package fi.semantum.sysdyn.solver;
 \r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class Equals implements IExpression {\r
        \r
     public IExpression exp1;\r
@@ -55,4 +57,11 @@ public class Equals implements IExpression {
                return this;\r
        }\r
 \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               exp1.accept(visitor);\r
+               exp2.accept(visitor);\r
+       }\r
+       \r
 }\r
index 1f66818ac9ba2a4bcdd11c60bddbd087949cc175..2a2687329d90be5ce8d2c3824cb08d3ec38fb789 100644 (file)
@@ -14,6 +14,8 @@ import java.util.ArrayList;
 import java.util.Collection;\r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class ForArray implements IExpression {\r
 \r
        private ArrayList<Object> elements = new ArrayList<Object>();\r
@@ -110,4 +112,15 @@ public class ForArray implements IExpression {
                return this;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               for(int i=0;i<elements.size();i++) {\r
+                       Object o = elements.get(i);\r
+                       if(o instanceof IExpression) {\r
+                               ((IExpression)o).accept(visitor);\r
+                       }\r
+               }\r
+       }\r
+       \r
 }\r
index 6d4620146e00ef9748e6b4e8b59a080178d52cc0..4876199cfaa7d106bbbe6da7210a95d55cbb95f8 100644 (file)
@@ -12,6 +12,8 @@ package fi.semantum.sysdyn.solver;
 \r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class GreaterOrEqualThan implements IExpression {\r
        \r
     public IExpression exp1;\r
@@ -49,4 +51,11 @@ public class GreaterOrEqualThan implements IExpression {
                return this;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               exp1.accept(visitor);\r
+               exp2.accept(visitor);\r
+       }\r
+       \r
 }\r
index 21d81acc5364a2d24a351c8137e1c67692fedac4..1a9791d6652c55a439a0189530d0d4ef6ac9dd15 100644 (file)
@@ -12,6 +12,8 @@ package fi.semantum.sysdyn.solver;
 \r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class GreaterThan implements IExpression {\r
        \r
     public IExpression exp1;\r
@@ -49,4 +51,11 @@ public class GreaterThan implements IExpression {
                return this;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               exp1.accept(visitor);\r
+               exp2.accept(visitor);\r
+       }\r
+       \r
 }\r
index 6377a3ad513eea1e391f9fa29b02c2f199e5f959..5d58d7f3fe71028fe081766d278a9b465b11ff7b 100644 (file)
@@ -14,9 +14,14 @@ import java.util.Map;
 \r
 public interface IExpression {\r
 \r
+       public interface ExpressionVisitor {\r
+               void visit(IExpression expression);\r
+       }\r
+       \r
        public Object evaluate(IEnvironment environment);\r
        public IExpression withBase(IFrame frame, String prefix);\r
        public Object getPossibleConstant();\r
        public IExpression rewrite(IFrame frame, Map<String, VariableBase> copies);\r
+       public void accept(ExpressionVisitor visitor);\r
        \r
 }\r
index 2176faf49c1be298a0078e83119195a91504bc54..a95c99e1265edba02eda76e22c31ab35c1e6069b 100644 (file)
@@ -12,6 +12,8 @@ package fi.semantum.sysdyn.solver;
 \r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class IfThenElse implements IExpression {\r
        \r
     public IExpression exp;\r
@@ -56,4 +58,12 @@ public class IfThenElse implements IExpression {
                return this;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               exp.accept(visitor);\r
+               t.accept(visitor);\r
+               e.accept(visitor);\r
+       }\r
+\r
 }\r
index 7c2f28707e198cfb44c0d5dc24a0ffa8c9a1cc72..b9ab757e3900428ecd3204f8e81449636cd05574 100644 (file)
@@ -12,6 +12,8 @@ package fi.semantum.sysdyn.solver;
 \r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class LessOrEqualThan implements IExpression {\r
        \r
     public IExpression exp1;\r
@@ -51,4 +53,11 @@ public class LessOrEqualThan implements IExpression {
                return this;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               exp1.accept(visitor);\r
+               exp2.accept(visitor);\r
+       }\r
+       \r
 }\r
index 9a8085384eda48bd838361a633bd577df4567a44..db79808367fb69b8baefdd83ea78316a44a51131 100644 (file)
@@ -12,6 +12,8 @@ package fi.semantum.sysdyn.solver;
 \r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class LessThan implements IExpression {\r
        \r
     public IExpression exp1;\r
@@ -51,4 +53,11 @@ public class LessThan implements IExpression {
                return this;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               exp1.accept(visitor);\r
+               exp2.accept(visitor);\r
+       }\r
+       \r
 }\r
index 00397a37d3cefa148736d570a415ac051a0f099d..cc4724ab3fad0d7320b38951f79855778b76b5a8 100644 (file)
@@ -12,6 +12,8 @@ package fi.semantum.sysdyn.solver;
 \r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class Multiplication implements IExpression {\r
        \r
     public IExpression exp1;\r
@@ -62,4 +64,11 @@ public class Multiplication implements IExpression {
                return this;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               exp1.accept(visitor);\r
+               exp2.accept(visitor);\r
+       }\r
+       \r
 }\r
index cdf125bae2928a02ff74428a53ffa10917d0b65e..15e9e2df8fa13057435be334767d431e21ecbd8a 100644 (file)
@@ -12,6 +12,8 @@ package fi.semantum.sysdyn.solver;
 \r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class Negation implements IExpression {\r
        \r
     public IExpression exp;\r
@@ -46,4 +48,10 @@ public class Negation implements IExpression {
                return this;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               exp.accept(visitor);\r
+       }\r
+       \r
 }\r
index 41ca66a5b47c03d5fd420c47d0df38e4c88d9ed5..5c5499cecc435f801a96796bcb19055da6904345 100644 (file)
@@ -12,6 +12,8 @@ package fi.semantum.sysdyn.solver;
 \r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class NotEquals implements IExpression {\r
        \r
     public IExpression exp1;\r
@@ -49,4 +51,11 @@ public class NotEquals implements IExpression {
                return this;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               exp1.accept(visitor);\r
+               exp2.accept(visitor);\r
+       }\r
+       \r
 }\r
index 287d61807e1bd5e45492816ff88364cf1b919ef0..cbafd0d9c6fc3afe1d1b0f3b008e4e56f5820802 100644 (file)
@@ -23,5 +23,10 @@ public class NullModification implements IExpression {
        public IExpression rewrite(IFrame frame, Map<String, VariableBase> copies) {\r
                return this;\r
        }\r
+       \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+       }\r
 \r
 }\r
index e08c3282151961afb82cd2cba52f1683e22cd629..375c9240e1e70e1d74cb9b7b59ecdd824c6b4e3d 100644 (file)
@@ -13,6 +13,8 @@ package fi.semantum.sysdyn.solver;
 import java.util.ArrayList;\r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class Or implements IExpression {\r
        \r
     public IExpression[] exps;\r
@@ -59,4 +61,10 @@ public class Or implements IExpression {
                return this;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               for(IExpression exp : exps) exp.accept(visitor);\r
+       }\r
+       \r
 }\r
index 1aa811f74d0af9b2430286b906c6ac30438ef06f..72cbab5e08ade7e3be89addaf70c2c97deba1e04 100644 (file)
@@ -49,4 +49,9 @@ public class ParameterDeclaration implements IExpression {
                throw new UnsupportedOperationException();\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               throw new UnsupportedOperationException();\r
+       }\r
+       \r
 }\r
index bcd050d4a931231b88ea8f9b2343ef97678248a3..1a4aed8c9937fafe357a467d5ec678edf6b9ff24 100644 (file)
@@ -13,7 +13,15 @@ package fi.semantum.sysdyn.solver;
 \r
 import java.io.StringReader;\r
 import java.util.ArrayList;\r
+import java.util.Collections;\r
+import java.util.Comparator;\r
+import java.util.HashSet;\r
+import java.util.List;\r
+import java.util.Set;\r
 \r
+import org.simantics.utils.datastructures.MapList;\r
+\r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
 import fi.semantum.sysdyn.solver.Model.Globals;\r
 import fi.semantum.sysdyn.solver.parser.ModelParser;\r
 import fi.semantum.sysdyn.solver.parser.SimpleNode;\r
@@ -27,6 +35,7 @@ public class Solver {
        private Environment env;\r
 \r
        private Object[] newValues;\r
+       private Object[] derivatives;\r
        \r
        private double step;\r
        private double start;\r
@@ -51,6 +60,52 @@ public class Solver {
                ready = false;\r
        }\r
        \r
+       private void sortAssignments() {\r
+\r
+               final MapList<String,Assignment> asses = new MapList<String,Assignment>();\r
+               for(Assignment ass : model.assignments) asses.add(ass.target.base.name, ass);\r
+               \r
+               final List<VariableBase> found = new ArrayList<VariableBase>();\r
+               final Set<String> visited = new HashSet<String>();\r
+\r
+               ExpressionVisitor sortVisitor = new ExpressionVisitor() {\r
+                       @Override\r
+                       public void visit(IExpression expression) {\r
+                               if(expression instanceof Variable) {\r
+                                       Variable var = (Variable)expression;\r
+                                       if(visited.add(var.base.name)) {\r
+                                               for(Assignment ass : asses.getValues(var.base.name)) {\r
+                                                       ass.expression.accept(this);\r
+                                                       if(ass.subscripts != null)\r
+                                                               for(IExpression e : ass.subscripts) e.accept(this);\r
+                                               }\r
+                                               found.add(var.base);\r
+                                       }\r
+                               }\r
+                       }\r
+               };\r
+               \r
+               // Sort assignments\r
+               for(Assignment ass : model.assignments) {\r
+                       ass.target.accept(sortVisitor);\r
+               }\r
+\r
+               Collections.sort(model.assignments, new Comparator<Assignment>() {\r
+\r
+                       @Override\r
+                       public int compare(Assignment o1, Assignment o2) {\r
+                               int i1 = found.indexOf(o1.target.base); \r
+                               int i2 = found.indexOf(o2.target.base);\r
+                               if(i1 < i2) return -1;\r
+                               else if (i1 > i2) return 1;\r
+                               return 0;\r
+                       }\r
+\r
+                       \r
+               });\r
+               \r
+       }\r
+       \r
        public void prepare(String input) throws Exception {\r
                \r
                long startNanos = System.nanoTime();\r
@@ -79,11 +134,14 @@ public class Solver {
                \r
                env.valueTable = new Object[size+STACK_SIZE];\r
                \r
+               sortAssignments();\r
+               \r
                model.assignmentArray = model.assignments.toArray(new Assignment[model.assignments.size()]);\r
                model.derivativeArray = model.derivatives.toArray(new Assignment[model.derivatives.size()]);\r
                model.parameterArray = model.parameters.toArray(new ParameterDeclaration[model.parameters.size()]);\r
                \r
                newValues = new Object[Math.max(model.assignments.size(),model.derivatives.size())];\r
+               derivatives = new Object[model.derivatives.size()];\r
                \r
                int condition = 1;\r
                int loops = 0;\r
@@ -185,6 +243,8 @@ public class Solver {
                return env.getValueArray();\r
        }\r
        \r
+       \r
+       \r
        public void step() {\r
                // TODO: do something more sensible if the solver is not ready\r
                if (!ready) return;\r
@@ -192,24 +252,24 @@ public class Solver {
                Assignment[] assignments = model.assignmentArray;\r
                Assignment[] derivatives = model.derivativeArray;\r
                \r
-               // should probably be wrapped inside a method or something\r
-               env.time += env.step;\r
-               \r
-               // Solve algebraic equations\r
-               for(int i=0;i<assignments.length;i++) {\r
-                       newValues[i] = assignments[i].expression.evaluate(env);\r
-               }\r
-               for(int i=0;i<model.assignments.size();i++) {\r
-                       assignments[i].target.assign(env, assignments[i].subscripts, newValues[i]);\r
-               }\r
-\r
-               // Solve derivatives\r
+               // first we evaluate, integrate and assign derivatives at previous time step\r
                for(int i=0;i<model.derivatives.size();i++) {\r
                        newValues[i] = derivatives[i].expression.evaluate(env);\r
                }\r
                for(int i=0;i<model.derivatives.size();i++) {\r
                        derivatives[i].target.assign(env, assignments[i].subscripts, newValues[i]);\r
                }\r
+\r
+               // Increment time\r
+               // should probably be wrapped inside a method or something\r
+               env.time += env.step;\r
+\r
+               // Next solve algebraic equations\r
+               for(int i=0;i<assignments.length;i++) {\r
+                       Object value = assignments[i].expression.evaluate(env);\r
+                       assignments[i].target.assign(env, assignments[i].subscripts, value);\r
+               }\r
+\r
        }\r
        \r
        // TODO: implement some on the fly parameter change stuff for different experiment types\r
index f7f8763d32767665308ef28b6d45a39d3d4944bc..79d1404caf5c64594da13de9b89e8819627bfef4 100644 (file)
@@ -12,6 +12,8 @@ package fi.semantum.sysdyn.solver;
 \r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class Subtraction implements IExpression {\r
        \r
     public IExpression exp1;\r
@@ -50,4 +52,11 @@ public class Subtraction implements IExpression {
                return this;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+               exp1.accept(visitor);\r
+               exp2.accept(visitor);\r
+       }\r
+       \r
 }\r
index d2d3e4c6044f5cf73f41bf242a6139233b26cb60..19e5f299e9c035c2f5e3d54822995db15dc3a5cc 100644 (file)
@@ -12,6 +12,8 @@ package fi.semantum.sysdyn.solver;
 \r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 public class TimeVariable implements IExpression {\r
 \r
        @Override\r
@@ -40,4 +42,9 @@ public class TimeVariable implements IExpression {
                return this;\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+       }\r
+       \r
 }\r
index 183d0cc3be23cfada5bb2d5b8841c58fe64aa112..8144fba00de810baf85a3f4d9691845cc99620ea 100644 (file)
@@ -13,6 +13,8 @@ package fi.semantum.sysdyn.solver;
 \r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 \r
 \r
 public class Variable implements IExpression {\r
@@ -236,4 +238,9 @@ public class Variable implements IExpression {
                \r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               visitor.visit(this);\r
+       }\r
+       \r
 }\r
index 1466574bd3b71002e442951eaed9ba246abe588b..b00a48cf9c892c2670488ac5f43428e34462fa7e 100644 (file)
@@ -10,8 +10,6 @@
  *******************************************************************************/\r
 package fi.semantum.sysdyn.solver;\r
 \r
-import java.util.Arrays;\r
-\r
 import fi.semantum.sysdyn.solver.SolverUtils.Slice;\r
 \r
 public class VariableBase {\r
index 08c8a49d78d7b03ef0f231b57ed085039a74ac27..51164eac35cdce8fe1332e463779339d2cc139d4 100644 (file)
@@ -12,6 +12,8 @@ package fi.semantum.sysdyn.solver;
 \r
 import java.util.Map;\r
 \r
+import fi.semantum.sysdyn.solver.IExpression.ExpressionVisitor;\r
+\r
 \r
 public class VariableDeclaration implements IExpression {\r
 \r
@@ -53,4 +55,9 @@ public class VariableDeclaration implements IExpression {
                throw new UnsupportedOperationException();\r
        }\r
        \r
+       @Override\r
+       public void accept(ExpressionVisitor visitor) {\r
+               throw new UnsupportedOperationException();\r
+       }\r
+       \r
 }\r
index 99bdaaee3a952db76e2ba27c2b69aa2fdb38d912..29ef1f1e0e8041c877a79f8f6c54a8e63a7ba241 100644 (file)
@@ -119,8 +119,8 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo
         case 47:\r
         case 50:\r
         case 61:\r
-        case 94:\r
         case 95:\r
+        case 96:\r
           ;\r
           break;\r
         default:\r
@@ -226,12 +226,12 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo
       case 17:\r
         jj_consume_token(17);\r
         break;\r
-      case 94:\r
-        jj_consume_token(94);\r
-        break;\r
       case 95:\r
         jj_consume_token(95);\r
         break;\r
+      case 96:\r
+        jj_consume_token(96);\r
+        break;\r
       default:\r
         jj_la1[7] = jj_gen;\r
         jj_consume_token(-1);\r
@@ -709,8 +709,8 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo
         case 61:\r
         case 68:\r
         case IDENT:\r
-        case 94:\r
         case 95:\r
+        case 96:\r
           ;\r
           break;\r
         default:\r
@@ -786,8 +786,8 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo
       case 61:\r
       case 68:\r
       case IDENT:\r
-      case 94:\r
       case 95:\r
+      case 96:\r
         switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
         case 8:\r
           jj_consume_token(8);\r
@@ -844,8 +844,8 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo
         case 61:\r
         case 68:\r
         case IDENT:\r
-        case 94:\r
         case 95:\r
+        case 96:\r
           switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
           case 7:\r
           case 17:\r
@@ -859,8 +859,8 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo
           case 47:\r
           case 50:\r
           case 61:\r
-          case 94:\r
           case 95:\r
+          case 96:\r
             class_definition();\r
             break;\r
           case 5:\r
@@ -895,8 +895,8 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo
           case 47:\r
           case 50:\r
           case 61:\r
-          case 94:\r
           case 95:\r
+          case 96:\r
             class_definition();\r
             break;\r
           case 5:\r
@@ -1772,8 +1772,8 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo
       case 61:\r
       case 68:\r
       case IDENT:\r
-      case 94:\r
       case 95:\r
+      case 96:\r
         switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
         case 7:\r
         case 17:\r
@@ -1787,8 +1787,8 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo
         case 47:\r
         case 50:\r
         case 61:\r
-        case 94:\r
         case 95:\r
+        case 96:\r
           class_definition();\r
           break;\r
         case 5:\r
@@ -1857,8 +1857,8 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo
       case 47:\r
       case 50:\r
       case 61:\r
-      case 94:\r
       case 95:\r
+      case 96:\r
         class_definition();\r
         break;\r
       case 5:\r
@@ -4997,9 +4997,9 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo
     jj_scanpos = xsp;\r
     if (jj_scan_token(17)) {\r
     jj_scanpos = xsp;\r
-    if (jj_scan_token(94)) {\r
+    if (jj_scan_token(95)) {\r
     jj_scanpos = xsp;\r
-    if (jj_scan_token(95)) return true;\r
+    if (jj_scan_token(96)) return true;\r
     }\r
     }\r
     }\r
@@ -5736,10 +5736,12 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo
   static private int[] jj_la1_0;\r
   static private int[] jj_la1_1;\r
   static private int[] jj_la1_2;\r
+  static private int[] jj_la1_3;\r
   static {\r
       jj_la1_init_0();\r
       jj_la1_init_1();\r
       jj_la1_init_2();\r
+      jj_la1_init_3();\r
    }\r
    private static void jj_la1_init_0() {\r
       jj_la1_0 = new int[] {0x0,0x0,0x45020880,0x800,0x40000000,0x0,0x0,0x5020080,0x0,0x0,0x0,0x0,0x0,0x10,0x10,0x0,0x0,0x4000,0x0,0x4000,0x0,0x80001040,0x4d8329a0,0x100,0x800,0x0,0x8000000,0x458300a0,0x458300a0,0x0,0x458320a0,0x4d8329a0,0x0,0x0,0x0,0x4000,0x0,0x0,0x810000,0x810000,0x20,0x20,0x0,0x0,0x0,0x80000000,0x0,0x0,0x0,0x0,0x2d00,0x0,0x2d00,0x400,0x800,0x2000,0x0,0x400,0x800,0x458300a0,0x458320a0,0x458300a0,0x0,0x0,0x0,0xa0240000,0x80200000,0x0,0xa0240000,0x80201040,0x100000,0x80201040,0x80201040,0x8000,0xa0240000,0x100000,0xa0240000,0xa0240000,0x8000,0x80201040,0xa0240000,0x0,0x0,0xa0240000,0x80201040,0x2000000,0x80201040,0xa0240000,0x2000000,0xa0240000,0x100000,0x80001040,0x100000,0x80001040,0x0,0x0,0x400000,0x200,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80001040,0x200000,0x200000,0x0,0x0,0x80001040,0x0,0x80001040,0x0,0x0,0x80001040,0x4000,0x0,0x0,};\r
@@ -5748,7 +5750,10 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo
       jj_la1_1 = new int[] {0x0,0x200000,0x20049064,0x0,0x0,0x8000,0x40000,0x20041064,0x0,0x40000000,0x0,0x0,0x0,0x2106000,0x106000,0x0,0x0,0x0,0x8000000,0x0,0x0,0x4400400a,0x218e9475,0x0,0x0,0x80000,0x0,0x21069465,0x21069465,0x400000,0x21069465,0x218e9475,0x0,0x0,0x40000000,0x0,0x40000000,0x0,0x0,0x0,0x20400,0x20400,0x1000001,0x1000001,0x0,0x0,0x0,0x40000000,0x0,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x40000000,0x0,0x0,0x21069465,0x21069465,0x21069465,0x400000,0x4000,0x4000,0x40010800,0x880,0x40000000,0x40010800,0x4400488a,0x0,0x4400488a,0x4400488a,0x0,0x40010800,0x0,0x40010800,0x40010800,0x0,0x4400488a,0x40010800,0x0,0x200,0x40010800,0x4400488a,0x0,0x4400488a,0x40010800,0x0,0x40010800,0x0,0x4400400a,0x0,0x4400400a,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4004000,0x0,0x2,0x40000008,0x0,0x0,0x0,0x0,0x0,0x0,0x4400400a,0x0,0x0,0x0,0x0,0x4400400a,0x0,0x4400400a,0x0,0x0,0x4400400a,0x0,0x0,0x0,};\r
    }\r
    private static void jj_la1_init_2() {\r
-      jj_la1_2 = new int[] {0x4000010,0x0,0xc0000000,0x0,0x0,0x0,0x0,0xc0000000,0x4,0x0,0x80,0x4000000,0x80,0x0,0x0,0x8000000,0x4000010,0x0,0x0,0x0,0x4000010,0x3c03c015,0xc4000010,0x0,0x0,0x0,0x0,0xc4000010,0xc4000010,0x0,0xc4000010,0xc4000010,0x10,0x4000010,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x0,0x4,0x3000000,0x1000000,0x3000000,0x4000010,0x80,0x4000010,0x0,0x0,0x4000010,0x3000000,0x0,0x0,0xc4000010,0xc4000010,0xc4000010,0x0,0x0,0x0,0x4000010,0x4000000,0x2000000,0x4000010,0x3c03c015,0x0,0x3c03c015,0x3c03c015,0x0,0x4000010,0x0,0x4000010,0x4000010,0x0,0x3c03c015,0x4000010,0x80,0x0,0x4000010,0x3c03c015,0x0,0x3c03c015,0x4000010,0x0,0x4000010,0x0,0x3c03c015,0x0,0x3c03c015,0x20,0x20,0x0,0x0,0x0,0x3f00,0x3f00,0x3c000,0x3c000,0x3c000,0x3c0000,0x3c0000,0xc00000,0xc00000,0x4000010,0x40,0x38000000,0x4000015,0x10,0x10,0x10,0x4,0x10,0x4,0x3c03c015,0x80,0x80,0x4000000,0x80,0x3c03c015,0x80,0x3c03c015,0x80,0x80,0x3c03c035,0x0,0x4000,0x8000000,};\r
+      jj_la1_2 = new int[] {0x4000010,0x0,0x80000000,0x0,0x0,0x0,0x0,0x80000000,0x4,0x0,0x80,0x4000000,0x80,0x0,0x0,0x8000000,0x4000010,0x0,0x0,0x0,0x4000010,0x6c03c015,0x84000010,0x0,0x0,0x0,0x0,0x84000010,0x84000010,0x0,0x84000010,0x84000010,0x10,0x4000010,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x0,0x4,0x3000000,0x1000000,0x3000000,0x4000010,0x80,0x4000010,0x0,0x0,0x4000010,0x3000000,0x0,0x0,0x84000010,0x84000010,0x84000010,0x0,0x0,0x0,0x4000010,0x4000000,0x2000000,0x4000010,0x6c03c015,0x0,0x6c03c015,0x6c03c015,0x0,0x4000010,0x0,0x4000010,0x4000010,0x0,0x6c03c015,0x4000010,0x80,0x0,0x4000010,0x6c03c015,0x0,0x6c03c015,0x4000010,0x0,0x4000010,0x0,0x6c03c015,0x0,0x6c03c015,0x20,0x20,0x0,0x0,0x0,0x3f00,0x3f00,0x3c000,0x3c000,0x3c000,0x3c0000,0x3c0000,0xc00000,0xc00000,0x4000010,0x40,0x68000000,0x4000015,0x10,0x10,0x10,0x4,0x10,0x4,0x6c03c015,0x80,0x80,0x4000000,0x80,0x6c03c015,0x80,0x6c03c015,0x80,0x80,0x6c03c035,0x0,0x4000,0x8000000,};\r
+   }\r
+   private static void jj_la1_init_3() {\r
+      jj_la1_3 = new int[] {0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x1,0x1,0x0,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};\r
    }\r
   final private JJCalls[] jj_2_rtns = new JJCalls[10];\r
   private boolean jj_rescan = false;\r
@@ -5937,7 +5942,7 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo
   /** Generate ParseException. */\r
   public ParseException generateParseException() {\r
     jj_expentries.clear();\r
-    boolean[] la1tokens = new boolean[96];\r
+    boolean[] la1tokens = new boolean[97];\r
     if (jj_kind >= 0) {\r
       la1tokens[jj_kind] = true;\r
       jj_kind = -1;\r
@@ -5954,10 +5959,13 @@ public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, Mo
           if ((jj_la1_2[i] & (1<<j)) != 0) {\r
             la1tokens[64+j] = true;\r
           }\r
+          if ((jj_la1_3[i] & (1<<j)) != 0) {\r
+            la1tokens[96+j] = true;\r
+          }\r
         }\r
       }\r
     }\r
-    for (int i = 0; i < 96; i++) {\r
+    for (int i = 0; i < 97; i++) {\r
       if (la1tokens[i]) {\r
         jj_expentry = new int[1];\r
         jj_expentry[0] = i;\r
index 1f375ca73edc9a887856c9633d08fac496f563f5..0407262ea8334314c00a5a0dab82e233d5d09121 100644 (file)
@@ -21,9 +21,11 @@ public interface ModelParserConstants {
   /** RegularExpression Id. */\r
   int STRING = 91;\r
   /** RegularExpression Id. */\r
-  int UNSIGNED_INTEGER = 92;\r
+  int EXP = 92;\r
   /** RegularExpression Id. */\r
-  int UNSIGNED_NUMBER = 93;\r
+  int UNSIGNED_INTEGER = 93;\r
+  /** RegularExpression Id. */\r
+  int UNSIGNED_NUMBER = 94;\r
 \r
   /** Lexical state. */\r
   int DEFAULT = 0;\r
@@ -122,6 +124,7 @@ public interface ModelParserConstants {
     "\":=\"",\r
     "<IDENT>",\r
     "<STRING>",\r
+    "<EXP>",\r
     "<UNSIGNED_INTEGER>",\r
     "<UNSIGNED_NUMBER>",\r
     "\"operator function\"",\r
index 754f36e8fa3403579cc02a03dce08da9bbbd7c02..5aa460e21333bbe30566c613a29635e61ee1aa4b 100644 (file)
@@ -15,20 +15,25 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1)
    switch (pos)
    {\r
       case 0:\r
-         if ((active0 & 0x3ffffffffffffff0L) != 0L || (active1 & 0xc0000000L) != 0L)\r
+         if ((active1 & 0x80000L) != 0L)\r
+            return 20;\r
+         if ((active0 & 0x377bdef7bdef7bf0L) != 0L || (active1 & 0x180000000L) != 0L)\r
          {\r
             jjmatchedKind = 90;\r
             return 2;\r
          }\r
-         if ((active1 & 0x80000L) != 0L)\r
-            return 13;\r
          if ((active1 & 0xb30010L) != 0L)\r
-            return 9;\r
+            return 13;\r
+         if ((active0 & 0x884210842108400L) != 0L)\r
+         {\r
+            jjmatchedKind = 90;\r
+            return 44;\r
+         }\r
          return -1;\r
       case 1:\r
          if ((active0 & 0x108420080400000L) != 0L)\r
             return 2;\r
-         if ((active0 & 0x3ef7bdff7fbffff0L) != 0L || (active1 & 0xc0000000L) != 0L)\r
+         if ((active0 & 0x3ef7bdff7fbffff0L) != 0L || (active1 & 0x180000000L) != 0L)\r
          {\r
             if (jjmatchedPos != 1)\r
             {\r
@@ -41,7 +46,7 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1)
       case 2:\r
          if ((active0 & 0x400000800201200L) != 0L)\r
             return 2;\r
-         if ((active0 & 0x3bfffdf77f9fedf0L) != 0L || (active1 & 0xc0000000L) != 0L)\r
+         if ((active0 & 0x3bfffdf77f9fedf0L) != 0L || (active1 & 0x180000000L) != 0L)\r
          {\r
             jjmatchedKind = 90;\r
             jjmatchedPos = 2;\r
@@ -51,7 +56,7 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1)
       case 3:\r
          if ((active0 & 0x1000084212118400L) != 0L)\r
             return 2;\r
-         if ((active0 & 0x2bfff5b56d8e69f0L) != 0L || (active1 & 0xc0000000L) != 0L)\r
+         if ((active0 & 0x2bfff5b56d8e69f0L) != 0L || (active1 & 0x180000000L) != 0L)\r
          {\r
             if (jjmatchedPos != 3)\r
             {\r
@@ -64,7 +69,7 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1)
       case 4:\r
          if ((active0 & 0x1090004290008c0L) != 0L)\r
             return 2;\r
-         if ((active0 & 0x2af6f5b1469e6130L) != 0L || (active1 & 0xc0000000L) != 0L)\r
+         if ((active0 & 0x2af6f5b1469e6130L) != 0L || (active1 & 0x180000000L) != 0L)\r
          {\r
             jjmatchedKind = 90;\r
             jjmatchedPos = 4;\r
@@ -74,7 +79,7 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1)
       case 5:\r
          if ((active0 & 0x22200011009c0000L) != 0L)\r
             return 2;\r
-         if ((active0 & 0x8d6f5a046026130L) != 0L || (active1 & 0xc0000000L) != 0L)\r
+         if ((active0 & 0x8d6f5a046026130L) != 0L || (active1 & 0x180000000L) != 0L)\r
          {\r
             jjmatchedKind = 90;\r
             jjmatchedPos = 5;\r
@@ -84,7 +89,7 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1)
       case 6:\r
          if ((active0 & 0x80d0a000000000L) != 0L)\r
             return 2;\r
-         if ((active0 & 0x856250046026130L) != 0L || (active1 & 0xc0000000L) != 0L)\r
+         if ((active0 & 0x856250046026130L) != 0L || (active1 & 0x180000000L) != 0L)\r
          {\r
             if (jjmatchedPos != 6)\r
             {\r
@@ -104,7 +109,7 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1)
             }\r
             return 2;\r
          }\r
-         if ((active0 & 0x802200006020020L) != 0L || (active1 & 0xc0000000L) != 0L)\r
+         if ((active0 & 0x802200006020020L) != 0L || (active1 & 0x180000000L) != 0L)\r
             return 2;\r
          return -1;\r
       case 8:\r
@@ -185,7 +190,7 @@ private int jjMoveStringLiteralDfa0_0()
          jjmatchedKind = 68;\r
          return jjMoveStringLiteralDfa1_0(0x0L, 0xb30000L);\r
       case 47:\r
-         return jjStartNfaWithStates_0(0, 83, 13);\r
+         return jjStartNfaWithStates_0(0, 83, 20);\r
       case 58:\r
          jjmatchedKind = 69;\r
          return jjMoveStringLiteralDfa1_0(0x0L, 0x2000000L);\r
@@ -227,7 +232,7 @@ private int jjMoveStringLiteralDfa0_0()
       case 110:\r
          return jjMoveStringLiteralDfa1_0(0x1000L, 0x0L);\r
       case 111:\r
-         return jjMoveStringLiteralDfa1_0(0x108420000L, 0xc0000000L);\r
+         return jjMoveStringLiteralDfa1_0(0x108420000L, 0x180000000L);\r
       case 112:\r
          return jjMoveStringLiteralDfa1_0(0x210842000000000L, 0x0L);\r
       case 114:\r
@@ -315,7 +320,7 @@ private int jjMoveStringLiteralDfa1_0(long active0, long active1)
       case 111:\r
          return jjMoveStringLiteralDfa2_0(active0, 0x1042108000201080L, active1, 0L);\r
       case 112:\r
-         return jjMoveStringLiteralDfa2_0(active0, 0x20000L, active1, 0xc0000000L);\r
+         return jjMoveStringLiteralDfa2_0(active0, 0x20000L, active1, 0x180000000L);\r
       case 113:\r
          return jjMoveStringLiteralDfa2_0(active0, 0x200000000000L, active1, 0L);\r
       case 114:\r
@@ -361,7 +366,7 @@ private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long a
             return jjStartNfaWithStates_0(2, 35, 2);\r
          return jjMoveStringLiteralDfa3_0(active0, 0x180L, active1, 0L);\r
       case 101:\r
-         return jjMoveStringLiteralDfa3_0(active0, 0x80030020000L, active1, 0xc0000000L);\r
+         return jjMoveStringLiteralDfa3_0(active0, 0x80030020000L, active1, 0x180000000L);\r
       case 103:\r
          return jjMoveStringLiteralDfa3_0(active0, 0x10L, active1, 0L);\r
       case 105:\r
@@ -442,7 +447,7 @@ private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long a
             return jjStartNfaWithStates_0(3, 60, 2);\r
          return jjMoveStringLiteralDfa4_0(active0, 0x100000000L, active1, 0L);\r
       case 114:\r
-         return jjMoveStringLiteralDfa4_0(active0, 0x20000L, active1, 0xc0000000L);\r
+         return jjMoveStringLiteralDfa4_0(active0, 0x20000L, active1, 0x180000000L);\r
       case 115:\r
          return jjMoveStringLiteralDfa4_0(active0, 0x42000400000040L, active1, 0L);\r
       case 116:\r
@@ -470,7 +475,7 @@ private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long a
    switch(curChar)\r
    {\r
       case 97:\r
-         return jjMoveStringLiteralDfa5_0(active0, 0x2000822000L, active1, 0xc0000000L);\r
+         return jjMoveStringLiteralDfa5_0(active0, 0x2000822000L, active1, 0x180000000L);\r
       case 99:\r
          return jjMoveStringLiteralDfa5_0(active0, 0x100L, active1, 0L);\r
       case 101:\r
@@ -578,7 +583,7 @@ private int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long a
             return jjStartNfaWithStates_0(5, 32, 2);\r
          else if ((active0 & 0x1000000000L) != 0L)\r
             return jjStartNfaWithStates_0(5, 36, 2);\r
-         return jjMoveStringLiteralDfa6_0(active0, 0x20000L, active1, 0xc0000000L);\r
+         return jjMoveStringLiteralDfa6_0(active0, 0x20000L, active1, 0x180000000L);\r
       default :\r
          break;\r
    }\r
@@ -610,7 +615,7 @@ private int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long a
       case 110:\r
          return jjMoveStringLiteralDfa7_0(active0, 0x2000000000000L, active1, 0L);\r
       case 111:\r
-         return jjMoveStringLiteralDfa7_0(active0, 0x200004020000L, active1, 0xc0000000L);\r
+         return jjMoveStringLiteralDfa7_0(active0, 0x200004020000L, active1, 0x180000000L);\r
       case 115:\r
          if ((active0 & 0x80000000000000L) != 0L)\r
             return jjStartNfaWithStates_0(6, 55, 2);\r
@@ -672,7 +677,7 @@ private int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long a
             jjmatchedKind = 17;\r
             jjmatchedPos = 7;\r
          }\r
-         return jjMoveStringLiteralDfa8_0(active0, 0x100L, active1, 0xc0000000L);\r
+         return jjMoveStringLiteralDfa8_0(active0, 0x100L, active1, 0x180000000L);\r
       case 116:\r
          if ((active0 & 0x2000000000000L) != 0L)\r
             return jjStartNfaWithStates_0(7, 49, 2);\r
@@ -694,7 +699,7 @@ private int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long a
    switch(curChar)\r
    {\r
       case 32:\r
-         return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0xc0000000L);\r
+         return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x180000000L);\r
       case 97:\r
          return jjMoveStringLiteralDfa9_0(active0, 0x40000000L, active1, 0L);\r
       case 98:\r
@@ -746,7 +751,7 @@ private int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long a
             return jjStartNfaWithStates_0(9, 50, 2);\r
          return jjMoveStringLiteralDfa10_0(active0, 0x40000000000000L, active1, 0L);\r
       case 102:\r
-         return jjMoveStringLiteralDfa10_0(active0, 0L, active1, 0x40000000L);\r
+         return jjMoveStringLiteralDfa10_0(active0, 0L, active1, 0x80000000L);\r
       case 108:\r
          return jjMoveStringLiteralDfa10_0(active0, 0x2000L, active1, 0L);\r
       case 110:\r
@@ -756,7 +761,7 @@ private int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long a
       case 111:\r
          return jjMoveStringLiteralDfa10_0(active0, 0x10000000000L, active1, 0L);\r
       case 114:\r
-         return jjMoveStringLiteralDfa10_0(active0, 0L, active1, 0x80000000L);\r
+         return jjMoveStringLiteralDfa10_0(active0, 0L, active1, 0x100000000L);\r
       case 116:\r
          return jjMoveStringLiteralDfa10_0(active0, 0x40000000L, active1, 0L);\r
       default :\r
@@ -780,13 +785,13 @@ private int jjMoveStringLiteralDfa10_0(long old0, long active0, long old1, long
       case 101:\r
          if ((active0 & 0x2000L) != 0L)\r
             return jjStartNfaWithStates_0(10, 13, 2);\r
-         return jjMoveStringLiteralDfa11_0(active0, 0x40000000L, active1, 0x80000000L);\r
+         return jjMoveStringLiteralDfa11_0(active0, 0x40000000L, active1, 0x100000000L);\r
       case 110:\r
          if ((active0 & 0x10000000000L) != 0L)\r
             return jjStartNfaWithStates_0(10, 40, 2);\r
          break;\r
       case 117:\r
-         return jjMoveStringLiteralDfa11_0(active0, 0L, active1, 0x40000000L);\r
+         return jjMoveStringLiteralDfa11_0(active0, 0L, active1, 0x80000000L);\r
       default :\r
          break;\r
    }\r
@@ -806,13 +811,13 @@ private int jjMoveStringLiteralDfa11_0(long old0, long active0, long old1, long
       case 98:\r
          return jjMoveStringLiteralDfa12_0(active0, 0x40000000000000L, active1, 0L);\r
       case 99:\r
-         return jjMoveStringLiteralDfa12_0(active0, 0L, active1, 0x80000000L);\r
+         return jjMoveStringLiteralDfa12_0(active0, 0L, active1, 0x100000000L);\r
       case 100:\r
          if ((active0 & 0x40000000L) != 0L)\r
             return jjStartNfaWithStates_0(11, 30, 2);\r
          break;\r
       case 110:\r
-         return jjMoveStringLiteralDfa12_0(active0, 0L, active1, 0x40000000L);\r
+         return jjMoveStringLiteralDfa12_0(active0, 0L, active1, 0x80000000L);\r
       default :\r
          break;\r
    }\r
@@ -830,9 +835,9 @@ private int jjMoveStringLiteralDfa12_0(long old0, long active0, long old1, long
    switch(curChar)\r
    {\r
       case 99:\r
-         return jjMoveStringLiteralDfa13_0(active0, 0L, active1, 0x40000000L);\r
-      case 111:\r
          return jjMoveStringLiteralDfa13_0(active0, 0L, active1, 0x80000000L);\r
+      case 111:\r
+         return jjMoveStringLiteralDfa13_0(active0, 0L, active1, 0x100000000L);\r
       case 121:\r
          if ((active0 & 0x40000000000000L) != 0L)\r
             return jjStartNfaWithStates_0(12, 54, 2);\r
@@ -854,9 +859,9 @@ private int jjMoveStringLiteralDfa13_0(long old0, long active0, long old1, long
    switch(curChar)\r
    {\r
       case 114:\r
-         return jjMoveStringLiteralDfa14_0(active1, 0x80000000L);\r
+         return jjMoveStringLiteralDfa14_0(active1, 0x100000000L);\r
       case 116:\r
-         return jjMoveStringLiteralDfa14_0(active1, 0x40000000L);\r
+         return jjMoveStringLiteralDfa14_0(active1, 0x80000000L);\r
       default :\r
          break;\r
    }\r
@@ -874,11 +879,11 @@ private int jjMoveStringLiteralDfa14_0(long old1, long active1)
    switch(curChar)\r
    {\r
       case 100:\r
-         if ((active1 & 0x80000000L) != 0L)\r
-            return jjStopAtPos(14, 95);\r
+         if ((active1 & 0x100000000L) != 0L)\r
+            return jjStopAtPos(14, 96);\r
          break;\r
       case 105:\r
-         return jjMoveStringLiteralDfa15_0(active1, 0x40000000L);\r
+         return jjMoveStringLiteralDfa15_0(active1, 0x80000000L);\r
       default :\r
          break;\r
    }\r
@@ -896,7 +901,7 @@ private int jjMoveStringLiteralDfa15_0(long old1, long active1)
    switch(curChar)\r
    {\r
       case 111:\r
-         return jjMoveStringLiteralDfa16_0(active1, 0x40000000L);\r
+         return jjMoveStringLiteralDfa16_0(active1, 0x80000000L);\r
       default :\r
          break;\r
    }\r
@@ -914,8 +919,8 @@ private int jjMoveStringLiteralDfa16_0(long old1, long active1)
    switch(curChar)\r
    {\r
       case 110:\r
-         if ((active1 & 0x40000000L) != 0L)\r
-            return jjStopAtPos(16, 94);\r
+         if ((active1 & 0x80000000L) != 0L)\r
+            return jjStopAtPos(16, 95);\r
          break;\r
       default :\r
          break;\r
@@ -936,7 +941,7 @@ static final long[] jjbitVec0 = {
 private int jjMoveNfa_0(int startState, int curPos)\r
 {\r
    int startsAt = 0;\r
-   jjnewStateCnt = 31;\r
+   jjnewStateCnt = 44;\r
    int i = 1;\r
    jjstateSet[0] = startState;\r
    int kind = 0x7fffffff;\r
@@ -951,22 +956,12 @@ private int jjMoveNfa_0(int startState, int curPos)
          {\r
             switch(jjstateSet[--i])\r
             {\r
-               case 13:\r
-                  if (curChar == 47)\r
-                  {\r
-                     if (kind > 3)\r
-                        kind = 3;\r
-                     jjCheckNAdd(20);\r
-                  }\r
-                  else if (curChar == 42)\r
-                     jjCheckNAddStates(0, 2);\r
-                  break;\r
                case 0:\r
                   if ((0x3ff000000000000L & l) != 0L)\r
                   {\r
-                     if (kind > 92)\r
-                        kind = 92;\r
-                     jjCheckNAddStates(3, 7);\r
+                     if (kind > 93)\r
+                        kind = 93;\r
+                     jjCheckNAddStates(0, 6);\r
                   }\r
                   else if ((0x100002600L & l) != 0L)\r
                   {\r
@@ -974,140 +969,179 @@ private int jjMoveNfa_0(int startState, int curPos)
                         kind = 1;\r
                   }\r
                   else if (curChar == 47)\r
-                     jjAddStates(8, 9);\r
+                     jjAddStates(7, 8);\r
                   else if (curChar == 46)\r
-                     jjCheckNAdd(9);\r
+                     jjCheckNAdd(13);\r
                   else if (curChar == 34)\r
-                     jjCheckNAddStates(10, 12);\r
+                     jjCheckNAddStates(9, 11);\r
+                  break;\r
+               case 44:\r
+                  if ((0x3ff400000000000L & l) != 0L)\r
+                  {\r
+                     if (kind > 90)\r
+                        kind = 90;\r
+                     jjCheckNAdd(2);\r
+                  }\r
+                  else if (curChar == 45)\r
+                  {\r
+                     if (kind > 92)\r
+                        kind = 92;\r
+                  }\r
+                  break;\r
+               case 20:\r
+                  if (curChar == 47)\r
+                  {\r
+                     if (kind > 3)\r
+                        kind = 3;\r
+                     jjCheckNAdd(27);\r
+                  }\r
+                  else if (curChar == 42)\r
+                     jjCheckNAddStates(12, 14);\r
                   break;\r
                case 2:\r
                   if ((0x3ff400000000000L & l) == 0L)\r
                      break;\r
                   if (kind > 90)\r
                      kind = 90;\r
-                  jjstateSet[jjnewStateCnt++] = 2;\r
+                  jjCheckNAdd(2);\r
                   break;\r
                case 3:\r
                   if (curChar == 34)\r
-                     jjCheckNAddStates(10, 12);\r
+                     jjCheckNAddStates(9, 11);\r
                   break;\r
                case 4:\r
                   if ((0xfffffffbfffffbffL & l) != 0L)\r
-                     jjCheckNAddStates(10, 12);\r
+                     jjCheckNAddStates(9, 11);\r
                   break;\r
                case 6:\r
                   if ((0xfffffffffffffbffL & l) != 0L)\r
-                     jjCheckNAddStates(10, 12);\r
+                     jjCheckNAddStates(9, 11);\r
                   break;\r
                case 7:\r
                   if (curChar == 34 && kind > 91)\r
                      kind = 91;\r
                   break;\r
-               case 8:\r
+               case 9:\r
+                  if (curChar == 45 && kind > 92)\r
+                     kind = 92;\r
+                  break;\r
+               case 12:\r
                   if (curChar == 46)\r
-                     jjCheckNAdd(9);\r
+                     jjCheckNAdd(13);\r
                   break;\r
-               case 9:\r
+               case 13:\r
                   if ((0x3ff000000000000L & l) == 0L)\r
                      break;\r
-                  if (kind > 93)\r
-                     kind = 93;\r
-                  jjCheckNAddTwoStates(9, 10);\r
+                  if (kind > 94)\r
+                     kind = 94;\r
+                  jjCheckNAddStates(15, 18);\r
                   break;\r
-               case 11:\r
+               case 15:\r
                   if ((0x3ff000000000000L & l) == 0L)\r
                      break;\r
-                  if (kind > 93)\r
-                     kind = 93;\r
-                  jjstateSet[jjnewStateCnt++] = 11;\r
+                  if (kind > 94)\r
+                     kind = 94;\r
+                  jjCheckNAdd(15);\r
                   break;\r
-               case 12:\r
+               case 16:\r
+                  if (curChar == 45)\r
+                     jjCheckNAdd(15);\r
+                  break;\r
+               case 19:\r
                   if (curChar == 47)\r
-                     jjAddStates(8, 9);\r
+                     jjAddStates(7, 8);\r
                   break;\r
-               case 14:\r
+               case 21:\r
                   if ((0xfffffbffffffffffL & l) != 0L)\r
-                     jjCheckNAddStates(0, 2);\r
+                     jjCheckNAddStates(12, 14);\r
                   break;\r
-               case 15:\r
+               case 22:\r
                   if (curChar == 42)\r
-                     jjstateSet[jjnewStateCnt++] = 16;\r
+                     jjstateSet[jjnewStateCnt++] = 23;\r
                   break;\r
-               case 16:\r
+               case 23:\r
                   if ((0xffff7fffffffffffL & l) != 0L)\r
-                     jjCheckNAddStates(0, 2);\r
+                     jjCheckNAddStates(12, 14);\r
                   break;\r
-               case 17:\r
+               case 24:\r
                   if (curChar == 47 && kind > 2)\r
                      kind = 2;\r
                   break;\r
-               case 18:\r
+               case 25:\r
                   if (curChar == 42)\r
-                     jjstateSet[jjnewStateCnt++] = 17;\r
+                     jjstateSet[jjnewStateCnt++] = 24;\r
                   break;\r
-               case 19:\r
+               case 26:\r
                   if (curChar != 47)\r
                      break;\r
                   if (kind > 3)\r
                      kind = 3;\r
-                  jjCheckNAdd(20);\r
+                  jjCheckNAdd(27);\r
                   break;\r
-               case 20:\r
+               case 27:\r
                   if ((0xfffffffffffffbffL & l) == 0L)\r
                      break;\r
                   if (kind > 3)\r
                      kind = 3;\r
-                  jjCheckNAdd(20);\r
+                  jjCheckNAdd(27);\r
                   break;\r
-               case 21:\r
+               case 28:\r
                   if ((0x3ff000000000000L & l) == 0L)\r
                      break;\r
-                  if (kind > 92)\r
-                     kind = 92;\r
-                  jjCheckNAddStates(3, 7);\r
+                  if (kind > 93)\r
+                     kind = 93;\r
+                  jjCheckNAddStates(0, 6);\r
                   break;\r
-               case 22:\r
+               case 29:\r
                   if ((0x3ff000000000000L & l) == 0L)\r
                      break;\r
-                  if (kind > 92)\r
-                     kind = 92;\r
-                  jjCheckNAdd(22);\r
+                  if (kind > 93)\r
+                     kind = 93;\r
+                  jjCheckNAdd(29);\r
                   break;\r
-               case 23:\r
+               case 30:\r
                   if ((0x3ff000000000000L & l) != 0L)\r
-                     jjCheckNAddTwoStates(23, 24);\r
+                     jjCheckNAddTwoStates(30, 31);\r
                   break;\r
-               case 24:\r
+               case 31:\r
                   if (curChar != 46)\r
                      break;\r
-                  if (kind > 93)\r
-                     kind = 93;\r
-                  jjCheckNAddTwoStates(25, 26);\r
+                  if (kind > 94)\r
+                     kind = 94;\r
+                  jjCheckNAddStates(19, 22);\r
                   break;\r
-               case 25:\r
+               case 32:\r
                   if ((0x3ff000000000000L & l) == 0L)\r
                      break;\r
-                  if (kind > 93)\r
-                     kind = 93;\r
-                  jjCheckNAddTwoStates(25, 26);\r
+                  if (kind > 94)\r
+                     kind = 94;\r
+                  jjCheckNAddStates(19, 22);\r
                   break;\r
-               case 27:\r
+               case 34:\r
                   if ((0x3ff000000000000L & l) == 0L)\r
                      break;\r
-                  if (kind > 93)\r
-                     kind = 93;\r
-                  jjstateSet[jjnewStateCnt++] = 27;\r
+                  if (kind > 94)\r
+                     kind = 94;\r
+                  jjCheckNAdd(34);\r
                   break;\r
-               case 28:\r
+               case 35:\r
+                  if (curChar == 45)\r
+                     jjCheckNAdd(34);\r
+                  break;\r
+               case 38:\r
                   if ((0x3ff000000000000L & l) != 0L)\r
-                     jjCheckNAddTwoStates(28, 29);\r
+                     jjCheckNAddStates(23, 26);\r
                   break;\r
-               case 30:\r
+               case 40:\r
                   if ((0x3ff000000000000L & l) == 0L)\r
                      break;\r
-                  if (kind > 93)\r
-                     kind = 93;\r
-                  jjstateSet[jjnewStateCnt++] = 30;\r
+                  if (kind > 94)\r
+                     kind = 94;\r
+                  jjCheckNAdd(40);\r
+                  break;\r
+               case 41:\r
+                  if (curChar == 45)\r
+                     jjCheckNAdd(40);\r
                   break;\r
                default : break;\r
             }\r
@@ -1121,6 +1155,23 @@ private int jjMoveNfa_0(int startState, int curPos)
             switch(jjstateSet[--i])\r
             {\r
                case 0:\r
+                  if ((0x7fffffe87fffffeL & l) != 0L)\r
+                  {\r
+                     if (kind > 90)\r
+                        kind = 90;\r
+                     jjCheckNAdd(2);\r
+                  }\r
+                  if ((0x2000000020L & l) != 0L)\r
+                  {\r
+                     if (kind > 92)\r
+                        kind = 92;\r
+                  }\r
+                  if (curChar == 69)\r
+                     jjCheckNAdd(9);\r
+                  else if (curChar == 101)\r
+                     jjCheckNAdd(9);\r
+                  break;\r
+               case 44:\r
                case 2:\r
                   if ((0x7fffffe87fffffeL & l) == 0L)\r
                      break;\r
@@ -1128,37 +1179,80 @@ private int jjMoveNfa_0(int startState, int curPos)
                      kind = 90;\r
                   jjCheckNAdd(2);\r
                   break;\r
+               case 1:\r
+                  if ((0x7fffffe87fffffeL & l) == 0L)\r
+                     break;\r
+                  if (kind > 90)\r
+                     kind = 90;\r
+                  jjCheckNAdd(2);\r
+                  break;\r
                case 4:\r
                   if ((0xffffffffefffffffL & l) != 0L)\r
-                     jjCheckNAddStates(10, 12);\r
+                     jjCheckNAddStates(9, 11);\r
                   break;\r
                case 5:\r
                   if (curChar == 92)\r
                      jjstateSet[jjnewStateCnt++] = 6;\r
                   break;\r
                case 6:\r
-                  jjCheckNAddStates(10, 12);\r
+                  jjCheckNAddStates(9, 11);\r
+                  break;\r
+               case 8:\r
+                  if ((0x2000000020L & l) != 0L && kind > 92)\r
+                     kind = 92;\r
                   break;\r
                case 10:\r
-                  if ((0x2000000020L & l) != 0L)\r
-                     jjstateSet[jjnewStateCnt++] = 11;\r
+                  if (curChar == 101)\r
+                     jjCheckNAdd(9);\r
+                  break;\r
+               case 11:\r
+                  if (curChar == 69)\r
+                     jjCheckNAdd(9);\r
                   break;\r
                case 14:\r
-               case 16:\r
-                  jjCheckNAddStates(0, 2);\r
+                  if ((0x2000000020L & l) != 0L)\r
+                     jjstateSet[jjnewStateCnt++] = 15;\r
                   break;\r
-               case 20:\r
+               case 17:\r
+                  if (curChar == 101)\r
+                     jjCheckNAdd(16);\r
+                  break;\r
+               case 18:\r
+                  if (curChar == 69)\r
+                     jjCheckNAdd(16);\r
+                  break;\r
+               case 21:\r
+               case 23:\r
+                  jjCheckNAddStates(12, 14);\r
+                  break;\r
+               case 27:\r
                   if (kind > 3)\r
                      kind = 3;\r
-                  jjstateSet[jjnewStateCnt++] = 20;\r
+                  jjstateSet[jjnewStateCnt++] = 27;\r
                   break;\r
-               case 26:\r
+               case 33:\r
                   if ((0x2000000020L & l) != 0L)\r
-                     jjstateSet[jjnewStateCnt++] = 27;\r
+                     jjstateSet[jjnewStateCnt++] = 34;\r
                   break;\r
-               case 29:\r
+               case 36:\r
+                  if (curChar == 101)\r
+                     jjCheckNAdd(35);\r
+                  break;\r
+               case 37:\r
+                  if (curChar == 69)\r
+                     jjCheckNAdd(35);\r
+                  break;\r
+               case 39:\r
                   if ((0x2000000020L & l) != 0L)\r
-                     jjstateSet[jjnewStateCnt++] = 30;\r
+                     jjstateSet[jjnewStateCnt++] = 40;\r
+                  break;\r
+               case 42:\r
+                  if (curChar == 101)\r
+                     jjCheckNAdd(41);\r
+                  break;\r
+               case 43:\r
+                  if (curChar == 69)\r
+                     jjCheckNAdd(41);\r
                   break;\r
                default : break;\r
             }\r
@@ -1175,19 +1269,19 @@ private int jjMoveNfa_0(int startState, int curPos)
                case 4:\r
                case 6:\r
                   if ((jjbitVec0[i2] & l2) != 0L)\r
-                     jjCheckNAddStates(10, 12);\r
+                     jjCheckNAddStates(9, 11);\r
                   break;\r
-               case 14:\r
-               case 16:\r
+               case 21:\r
+               case 23:\r
                   if ((jjbitVec0[i2] & l2) != 0L)\r
-                     jjCheckNAddStates(0, 2);\r
+                     jjCheckNAddStates(12, 14);\r
                   break;\r
-               case 20:\r
+               case 27:\r
                   if ((jjbitVec0[i2] & l2) == 0L)\r
                      break;\r
                   if (kind > 3)\r
                      kind = 3;\r
-                  jjstateSet[jjnewStateCnt++] = 20;\r
+                  jjstateSet[jjnewStateCnt++] = 27;\r
                   break;\r
                default : break;\r
             }\r
@@ -1200,14 +1294,15 @@ private int jjMoveNfa_0(int startState, int curPos)
          kind = 0x7fffffff;\r
       }\r
       ++curPos;\r
-      if ((i = jjnewStateCnt) == (startsAt = 31 - (jjnewStateCnt = startsAt)))\r
+      if ((i = jjnewStateCnt) == (startsAt = 44 - (jjnewStateCnt = startsAt)))\r
          return curPos;\r
       try { curChar = input_stream.readChar(); }\r
       catch(java.io.IOException e) { return curPos; }\r
    }\r
 }\r
 static final int[] jjnextStates = {
-   14, 15, 18, 22, 23, 24, 28, 29, 13, 19, 4, 5, 7, 
+   29, 30, 31, 38, 39, 42, 43, 20, 26, 4, 5, 7, 21, 22, 25, 13, 
+   14, 17, 18, 32, 33, 36, 37, 38, 39, 42, 43, 
 };\r
 \r
 /** Token literal values. */\r
@@ -1232,7 +1327,7 @@ public static final String[] jjstrLiteralImages = {
 "\145\170\164\145\162\156\141\154", "\154\157\157\160", "\162\145\143\157\162\144", "\50", "\51", "\173", "\175", \r
 "\133", "\135", "\56", "\72", "\73", "\54", "\74", "\74\75", "\76", "\76\75", \r
 "\75\75", "\74\76", "\53", "\55", "\56\53", "\56\55", "\52", "\57", "\56\52", "\56\57", \r
-"\136", "\56\136", "\75", "\72\75", null, null, null, null, \r
+"\136", "\56\136", "\75", "\72\75", null, null, null, null, null, \r
 "\157\160\145\162\141\164\157\162\40\146\165\156\143\164\151\157\156", "\157\160\145\162\141\164\157\162\40\162\145\143\157\162\144", };\r
 \r
 /** Lexer state names. */\r
@@ -1240,14 +1335,14 @@ public static final String[] lexStateNames = {
    "DEFAULT",\r
 };\r
 static final long[] jjtoToken = {
-   0xfffffffffffffff1L, 0xffffffffL, 
+   0xfffffffffffffff1L, 0x1ffffffffL, 
 };\r
 static final long[] jjtoSkip = {
    0xeL, 0x0L, 
 };\r
 protected SimpleCharStream input_stream;\r
-private final int[] jjrounds = new int[31];\r
-private final int[] jjstateSet = new int[62];\r
+private final int[] jjrounds = new int[44];\r
+private final int[] jjstateSet = new int[88];\r
 private final StringBuilder jjimage = new StringBuilder();\r
 private StringBuilder image = jjimage;\r
 private int jjimageLen;\r
@@ -1278,7 +1373,7 @@ private void ReInitRounds()
 {\r
    int i;\r
    jjround = 0x80000001;\r
-   for (i = 31; i-- > 0;)\r
+   for (i = 44; i-- > 0;)\r
       jjrounds[i] = 0x80000000;\r
 }\r
 \r
index a6dceb85d65cdb79960463fe08f068fd53bc2f6e..2ba477f3a85ed3191fba293a9daa363f0c2c499d 100644 (file)
@@ -78,11 +78,12 @@ TOKEN:
 | <IDENT: ["a"-"z","A"-"Z","_"] (["a"-"z","A"-"Z","_",".", "0"-"9"])* >\r
 | <STRING: "\"" (~["\"", "\\", "\n"] | "\\" ~["\n"])* "\"">\r
     { matchedToken.image = matchedToken.image.substring(1,matchedToken.image.length()-1); }\r
+| <EXP: "e" | "e-" | "E" | "E-" >\r
 | <UNSIGNED_INTEGER: (["0"-"9"])+ >\r
 | <UNSIGNED_NUMBER:  \r
-    ( <UNSIGNED_INTEGER> "." (<UNSIGNED_INTEGER>)? (["e","E"] <UNSIGNED_INTEGER>)?\r
-    | "." <UNSIGNED_INTEGER> (["e","E"] <UNSIGNED_INTEGER>)?\r
-    | <UNSIGNED_INTEGER> ["e","E"] <UNSIGNED_INTEGER>\r
+    ( <UNSIGNED_INTEGER> "." (<UNSIGNED_INTEGER>)? (<EXP> <UNSIGNED_INTEGER>)?\r
+    | "." <UNSIGNED_INTEGER> (<EXP> <UNSIGNED_INTEGER>)?\r
+    | <UNSIGNED_INTEGER> <EXP> <UNSIGNED_INTEGER>\r
     ) >\r
 }\r
 \r
index 422e38fdb919627fb17737d09d5b9b1fc05eb3a9..0296fd88e30c78d960d9ee2e7c6a664ca2a8556a 100644 (file)
@@ -74,11 +74,12 @@ TOKEN:
 | <IDENT: ["a"-"z","A"-"Z","_"] (["a"-"z","A"-"Z","_",".", "0"-"9"])* >\r
 | <STRING: "\"" (~["\"", "\\", "\n"] | "\\" ~["\n"])* "\"">\r
     { matchedToken.image = matchedToken.image.substring(1,matchedToken.image.length()-1); }\r
+| <EXP: "e" | "e-" | "E" | "E-" >\r
 | <UNSIGNED_INTEGER: (["0"-"9"])+ >\r
 | <UNSIGNED_NUMBER:  \r
-    ( <UNSIGNED_INTEGER> "." (<UNSIGNED_INTEGER>)? (["e","E"] <UNSIGNED_INTEGER>)?\r
-    | "." <UNSIGNED_INTEGER> (["e","E"] <UNSIGNED_INTEGER>)?\r
-    | <UNSIGNED_INTEGER> ["e","E"] <UNSIGNED_INTEGER>\r
+    ( <UNSIGNED_INTEGER> "." (<UNSIGNED_INTEGER>)? (<EXP> <UNSIGNED_INTEGER>)?\r
+    | "." <UNSIGNED_INTEGER> (<EXP> <UNSIGNED_INTEGER>)?\r
+    | <UNSIGNED_INTEGER> <EXP> <UNSIGNED_INTEGER>\r
     ) >\r
 }\r
 \r
index da4bae8ca8eea43d1bd19b0f3f174b402608b556..7fffd394d5ecc2ee2e4d121229288b32e2fb9dd2 100644 (file)
@@ -30,6 +30,7 @@ public abstract class AdjustableTab extends LabelPropertyTabContributor {
        private Composite spp;\r
        private ControlListener controlListener;\r
        private static final int WIDE_SCREEN_WIDTH = 1100;\r
+       protected Composite composite;\r
        \r
        @Override\r
        public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport _support) {\r
@@ -47,7 +48,7 @@ public abstract class AdjustableTab extends LabelPropertyTabContributor {
 \r
                        @Override\r
                        public void controlResized(ControlEvent e) {\r
-                               createLayout();                         \r
+                               createLayout();\r
                        }\r
                });\r
                \r
@@ -70,6 +71,9 @@ public abstract class AdjustableTab extends LabelPropertyTabContributor {
         *  Create layout for controls.\r
         */\r
        protected void createLayout() {\r
+               if (composite == null || composite.isDisposed())\r
+                       return;\r
+               \r
                Point size = spp.getSize();\r
                if (size.x > size.y) {\r
                        createControlLayoutHorizontal((size.x > WIDE_SCREEN_WIDTH));\r
@@ -98,10 +102,10 @@ public abstract class AdjustableTab extends LabelPropertyTabContributor {
         */\r
        protected abstract void createControlLayoutHorizontal(boolean wideScreen);\r
 \r
-       @Override\r
-       public void dispose() {\r
-               if(controlListener != null && spp != null)\r
-                       spp.removeControlListener(controlListener);\r
-       }\r
+//     @Override\r
+//     public void dispose() {\r
+//             if(controlListener != null && spp != null)\r
+//                     spp.removeControlListener(controlListener);\r
+//     }\r
 \r
 }\r
index 045b4d3147f8ed504bd6ec4cdfa6e75d0dbfa200..8c0441c48b42ee73c745a9d6f30665d51d51aa9d 100644 (file)
 package org.simantics.jfreechart.chart.properties;\r
 \r
 import org.eclipse.jface.viewers.ISelection;\r
-import org.eclipse.swt.events.DisposeEvent;\r
-import org.eclipse.swt.events.DisposeListener;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.ui.IWorkbenchSite;\r
-import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupportImpl;\r
-import org.simantics.db.AsyncReadGraph;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.layer0.variable.Variable;\r
-import org.simantics.db.management.ISessionContext;\r
-import org.simantics.db.procedure.AsyncListener;\r
 import org.simantics.db.request.Read;\r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.selectionview.PropertyTabContributorImpl;\r
-import org.simantics.ui.SimanticsUI;\r
-import org.simantics.utils.datastructures.Callback;\r
 import org.simantics.utils.ui.AdaptionUtils;\r
 \r
 public abstract class LabelPropertyTabContributor extends PropertyTabContributorImpl {\r
 \r
-    private boolean isDisposed = false;\r
-\r
-\r
-    public void createControl(Composite parent, final IWorkbenchSite site, final ISessionContext context, final WidgetSupportImpl support) {\r
-        super.createControl(parent, site, context, support);\r
-\r
-        // Add dispose listener to make sure name listening receives the correct isDisposed -value\r
-        parent.addDisposeListener(new DisposeListener() {\r
-\r
-            @Override\r
-            public void widgetDisposed(DisposeEvent e) {\r
-                LabelPropertyTabContributor.this.dispose();\r
-            }\r
-        });\r
-    }\r
-\r
     @Override\r
-    public void updatePartName(ISelection forSelection, final Callback<String> updateCallback) {\r
-               final Variable variable = AdaptionUtils.adaptToSingle(forSelection, Variable.class);\r
-        final Resource resource = AdaptionUtils.adaptToSingle(forSelection, Resource.class);\r
-        if(resource == null && variable == null) {\r
-            updateCallback.run("Selection properties");\r
-            return;\r
-        }\r
+    public Read<String> getPartNameReadRequest(final ISelection forSelection) {\r
 \r
-        SimanticsUI.getSession().asyncRequest(new Read<String>() {\r
+        return new Read<String>() {\r
 \r
             @Override\r
             public String perform(ReadGraph graph) throws DatabaseException {\r
                 Layer0 l0 = Layer0.getInstance(graph);\r
                 ModelingResources mr = ModelingResources.getInstance(graph);\r
+\r
+                       final Variable variable = AdaptionUtils.adaptToSingle(forSelection, Variable.class);\r
+                final Resource resource = AdaptionUtils.adaptToSingle(forSelection, Resource.class);\r
+                if(resource == null && variable == null) {\r
+                       return "Selection";\r
+                }\r
                 \r
                 Resource r;\r
                 if(variable != null) {\r
@@ -84,27 +58,9 @@ public abstract class LabelPropertyTabContributor extends PropertyTabContributor
                     return label;\r
                 return "No name for selection";\r
             }\r
-        }, new AsyncListener<String>() {\r
-\r
-            @Override\r
-            public void execute(AsyncReadGraph graph, String result) {\r
-                updateCallback.run(result);\r
-            }\r
-\r
-            @Override\r
-            public void exception(AsyncReadGraph graph, Throwable throwable) {\r
-\r
-            }\r
-\r
-            @Override\r
-            public boolean isDisposed() {\r
-                return isDisposed;\r
-            }\r
-        });\r
+            \r
+        };\r
+        \r
     }\r
 \r
-    @Override\r
-    protected void dispose() {\r
-        this.isDisposed = true;\r
-    }\r
 }\r
index d82284924c92d7455584fad55aba0e4fa9bfa534..38f7d21ef28223ba58ca4dc91ff8390149e4c915 100644 (file)
@@ -67,7 +67,6 @@ public class BarAxisTab extends AdjustableTab implements Widget {
     private WidgetSupportImpl rangeAxisSupport = new WidgetSupportImpl();\r
     private TrackedText rangelabel, rangemin, rangemax;\r
     private ScrolledComposite sc;\r
-    private Composite composite;\r
        private Group domainGroup;\r
        private Label labelLabel;\r
        private AxisHidePropertyComposite axisHide;\r
index 9d669b6c1c692dd71e43abda75bff99777cdd7c7..fa60a3e5fd3cb5806df12978983fe3ba3e5e9e65 100644 (file)
@@ -64,7 +64,6 @@ import org.simantics.sysdyn.JFreeChartResource;
 public class BarGeneralPropertiesTab extends AdjustableTab {\r
 \r
     private ScrolledComposite sc;\r
-    private Composite composite;\r
     private Button hgrid, htitle, hlegend;\r
     private TrackedText name, title, time;\r
     private TrackedCombo type;\r
index 51eefa75abcb27c2025da8e013b9a885f8fe499e..5a9c55a25fd158f91f01c38e4e19d83abf816b39 100644 (file)
@@ -61,7 +61,6 @@ public class BarSeriesTab extends AdjustableTab implements Widget {
     private Resource chartResource;\r
     private BarSeriesPropertyComposite spc;\r
     private int options;\r
-       private Composite composite;\r
        private Composite buttonComposite;\r
 \r
     public BarSeriesTab(int options) {\r
index e32a1c7ff2c29bad6a52be8d416583aa59faaea7..3e2b2d2d02d71bd0b55dc25851ec561a6aea9f9e 100644 (file)
@@ -51,7 +51,6 @@ import org.simantics.sysdyn.JFreeChartResource;
 public class PieGeneralPropertiesTab extends AdjustableTab {\r
 \r
     private ScrolledComposite sc;\r
-    private Composite composite;\r
     private Button htitle, hlegend, hlabels;\r
     private TrackedText name, title, time;\r
     \r
index ad0ca64538c7d0474a3b0504239a7024c40d925e..d5cf346a84280367fbfbb69943cbd7c367d5a7ae 100644 (file)
@@ -60,7 +60,6 @@ public class PieSeriesTab extends AdjustableTab implements Widget {
     private Button add, remove;\r
     private Resource chartResource;\r
     private int options;\r
-       private Composite composite;\r
        private Composite buttonComposite;\r
     \r
     public PieSeriesTab(int options) {\r
index 92d4f9e05b488d8c61d394e69e74f09369e3fbbe..98d7107e27a4409161123876c8c7b1ea780a4c8f 100644 (file)
@@ -63,7 +63,6 @@ public class XYLineAxisAndVariablesTab extends AdjustableTab {
     private ScrolledComposite propertyContainer;\r
     private Button addAxis, addVariable, remove;\r
     private WidgetSupportImpl additionalSupport;\r
-       private Composite composite;\r
        private Composite buttonComposite;\r
 \r
     public XYLineAxisAndVariablesTab() {\r
index 2ab8ae98ba3348f359f69864cd72e55ee2aec7cf..495a36e11a32da8faa74d3b4e55edadaf1ab5b69 100644 (file)
@@ -72,7 +72,6 @@ import org.simantics.utils.ui.AdaptionUtils;
 public class XYLineGeneralPropertiesTab extends AdjustableTab implements Widget {\r
 \r
     private ScrolledComposite sc;\r
-    private Composite composite;\r
     private TrackedText name, title, xlabel, xvariable, xmin, xmax;\r
     private TrackedCombo type;\r
     private Button hgrid, htitle, hlegend;\r
index 7af5e56704ca7fd21be45af9b8a565c716198412..def1fc4c08b182826ba6b97a35391bf2a22fd7b3 100644 (file)
Binary files a/org.simantics.sysdyn.feature/rootfiles/sampleModels/Tourists Environments And Hotel Facilities.sysdyn and b/org.simantics.sysdyn.feature/rootfiles/sampleModels/Tourists Environments And Hotel Facilities.sysdyn differ
index 37bbc783792c29bddb184129cd537704d14ed2a2..7b31d5bc1a974664a03f4191763baa7cd35da067 100644 (file)
Binary files a/org.simantics.sysdyn.ontology/graph.tg and b/org.simantics.sysdyn.ontology/graph.tg differ
index c52fecbcab078a48813cb195873ba6d7b3ded573..cf2c2db9426264fe0f5ed8f80c2ad950a67739dd 100644 (file)
@@ -34,6 +34,7 @@ FROM16TO17 = MIGRATION."from1.6to1.7" : L0.MigrationSequence
         FROM16TO17.Spreadsheets\r
         FROM16TO17.SysdynChanges\r
         FROM16TO17.OrderedSetsToLists\r
+        FROM16TO17.Custom : L0.MigrationStep\r
 \r
 FROM16TO17.Ontologies : L0.NamespaceMigrationStep\r
   @L0.list\r
@@ -74,7 +75,50 @@ FROM16TO17.Ontologies : L0.NamespaceMigrationStep
     _\r
       @move"http://www.simantics.org/User-" "1.0" "1.1"\r
     _\r
-      @move"http://www.simantics.org/Documentation-" "1.0" "1.1"\r
+      @move"http://" "www.simantics.org/Documentation-1.1/Components" "www.semantum.fi/Simupedia-1.0/Components"\r
+    _\r
+      @move"http://" "www.simantics.org/Documentation-1.1/Symbols" "www.semantum.fi/Simupedia-1.0/Symbols"\r
+    _\r
+      @move"http://" "www.simantics.org/Documentation-1.1/Properties" "www.semantum.fi/Simupedia-1.0/Properties"\r
+    _\r
+      @move"http://" "www.simantics.org/Documentation-1.1/DiagramRelations" "www.simantics.org/Documentation-1.2/DiagramRelations"\r
+    _\r
+      @move"http://" "www.simantics.org/Documentation-1.1/Relations" "www.simantics.org/Documentation-1.2/Relations"\r
+    _\r
+      @move"http://" "www.simantics.org/Documentation-1.1/Terminals" "www.simantics.org/Documentation-1.2/Terminals"\r
+    _\r
+      @move"http://" "www.simantics.org/Documentation-1.1/Role" "www.semantum.fi/Simupedia-1.0/Role"\r
+    _\r
+      @move"http://" "www.simantics.org/Documentation-1.1/RelationTypeConstraint" "www.simantics.org/Documentation-1.2/RelationTypeConstraint"\r
+    _\r
+      @move"http://" "www.simantics.org/Documentation-1.1/Component" "www.semantum.fi/Simupedia-1.0/Components/Component"\r
+    _\r
+      @move"http://" "www.simantics.org/Documentation-1.1/DocumentComponent" "www.simantics.org/Documentation-1.2/DocumentComponent"\r
+    _\r
+      @move"http://" "www.simantics.org/Documentation-1.1/roleList" "www.semantum.fi/Simupedia-1.0/roleList"\r
+    _\r
+      @move"http://" "www.simantics.org/Documentation-1.1/CommandConnectionType" "www.simantics.org/Documentation-1.2/CommandConnectionType"\r
+    _\r
+      @move"http://" "www.simantics.org/Documentation-1.1/DataDefinitionConnectionType" "www.simantics.org/Documentation-1.2/DataDefinitionConnectionType"\r
+    _\r
+      @move"http://" "www.simantics.org/Documentation-1.1/DataConnectionType" "www.simantics.org/Documentation-1.2/DataConnectionType"\r
+    _\r
+      @move"http://" "www.simantics.org/Documentation-1.1/Functions" "www.semantum.fi/Simupedia-1.0/Functions"\r
+    _\r
+      @move"http://" "www.simantics.org/Documentation-1.1/DocumentDiagram" "www.simantics.org/Documentation-1.2/DocumentDiagram"\r
+    _\r
+      @move"http://" "www.simantics.org/Documentation-1.1/ConnectionType" "www.simantics.org/Documentation-1.2/ConnectionType"\r
+    _\r
+      @move"http://" "www.simantics.org/Documentation-1.1/Document/IsConnectedToChild" "www.simantics.org/Documentation-1.2/Document/IsConnectedToChild"\r
+    _\r
+      @move"http://" "www.simantics.org/Documentation-1.1/Document" "www.semantum.fi/Simupedia-1.0/Document"\r
+    _\r
+      @move"http://" "www.simantics.org/Documentation-1.1" "www.simantics.org/Documentation-1.2"\r
+    _\r
+      @move"http://" "www.simantics.org/DocumentWorkbench-1.0" "www.semantum.fi/SimupediaWorkbench-1.0"\r
+      \r
+      \r
+      \r
     _\r
       @move"http://www.simantics.org/Document-" "1.1" "1.2"\r
     _\r
index 1ad68f5d00c9ca77e2d59e2e7465d826e70adda1..e5f3463536c9dfc923b48a61c5901e808dbfed29 100644 (file)
@@ -147,6 +147,12 @@ SYSDYN.Variable <T SYSDYN.Component
         _ : L0.Value    
             L0.domainProperties FUNCTIONS.valuePropertyProperties : L0.ExternalValue
             L0.valueAccessor FUNCTIONS.valuePropertyValue : L0.ExternalValue
+
+    >-- SYSDYN.Variable.equation <R L0.HasProperty : L0.FunctionalRelation
+        L0.valueAccessor FUNCTIONS.equationPropertyValue : L0.ExternalValue
+    @L0.assert SYSDYN.Variable.equation 
+        _ : L0.Value
+
     
 FUNCTIONS.runChildren : L0.ExternalValue
     
@@ -602,8 +608,6 @@ SYSDYN.DependencyConnection <T DIA.Connection <T DIA.FontProvider <T DIA.ColorPr
     MOD.DiagramConnectionTypeToConnectionType
         SYSDYN.Dependency
     @L0.assert G2D.HasFont SYSDYN.DefaultFont
-    @L0.assert G2D.HasColor 
-        [0.0,0.0,1.0,1.0] : G2D.Color        
 
 // TODO: Browser URIs
 
index 2f37ffee9082f961150e3d165e4022ec56999aca..00869113032e52243224cd0c2b8794120b758503 100644 (file)
@@ -402,6 +402,7 @@ public class SysdynResource {
     public final Resource FlowConnection_width_Inverse;\r
     public final Resource FunctionTree;\r
     public final Resource Functions;\r
+    public final Resource Functions_equationPropertyValue;\r
     public final Resource Functions_runChildren;\r
     public final Resource Functions_runProperties;\r
     public final Resource Functions_valuePropertyProperties;\r
@@ -481,6 +482,7 @@ public class SysdynResource {
     public final Resource Loop_Items_Inverse;\r
     public final Resource Migration;\r
     public final Resource Migration_from1$6to1$7;\r
+    public final Resource Migration_from1$6to1$7_Custom;\r
     public final Resource Migration_from1$6to1$7_Ontologies;\r
     public final Resource Migration_from1$6to1$7_OrderedSetsToLists;\r
     public final Resource Migration_from1$6to1$7_Spreadsheets;\r
@@ -751,6 +753,8 @@ public class SysdynResource {
     public final Resource Variable_arrayIndexesList;\r
     public final Resource Variable_arrayIndexesList_Inverse;\r
     public final Resource Variable_arrayIndexes_Inverse;\r
+    public final Resource Variable_equation;\r
+    public final Resource Variable_equation_Inverse;\r
     public final Resource Variable_expressionList;\r
     public final Resource Variable_expressionList_Inverse;\r
     public final Resource Variable_expressions;\r
@@ -1177,6 +1181,7 @@ public class SysdynResource {
         public static final String FlowConnection_width_Inverse = "http://www.simantics.org/Sysdyn-1.1/FlowConnection/width/Inverse";\r
         public static final String FunctionTree = "http://www.simantics.org/Sysdyn-1.1/FunctionTree";\r
         public static final String Functions = "http://www.simantics.org/Sysdyn-1.1/Functions";\r
+        public static final String Functions_equationPropertyValue = "http://www.simantics.org/Sysdyn-1.1/Functions/equationPropertyValue";\r
         public static final String Functions_runChildren = "http://www.simantics.org/Sysdyn-1.1/Functions/runChildren";\r
         public static final String Functions_runProperties = "http://www.simantics.org/Sysdyn-1.1/Functions/runProperties";\r
         public static final String Functions_valuePropertyProperties = "http://www.simantics.org/Sysdyn-1.1/Functions/valuePropertyProperties";\r
@@ -1256,6 +1261,7 @@ public class SysdynResource {
         public static final String Loop_Items_Inverse = "http://www.simantics.org/Sysdyn-1.1/Loop/Items/Inverse";\r
         public static final String Migration = "http://www.simantics.org/Sysdyn-1.1/Migration";\r
         public static final String Migration_from1$6to1$7 = "http://www.simantics.org/Sysdyn-1.1/Migration/from1.6to1.7";\r
+        public static final String Migration_from1$6to1$7_Custom = "http://www.simantics.org/Sysdyn-1.1/Migration/from1.6to1.7/Custom";\r
         public static final String Migration_from1$6to1$7_Ontologies = "http://www.simantics.org/Sysdyn-1.1/Migration/from1.6to1.7/Ontologies";\r
         public static final String Migration_from1$6to1$7_OrderedSetsToLists = "http://www.simantics.org/Sysdyn-1.1/Migration/from1.6to1.7/OrderedSetsToLists";\r
         public static final String Migration_from1$6to1$7_Spreadsheets = "http://www.simantics.org/Sysdyn-1.1/Migration/from1.6to1.7/Spreadsheets";\r
@@ -1526,6 +1532,8 @@ public class SysdynResource {
         public static final String Variable_arrayIndexesList = "http://www.simantics.org/Sysdyn-1.1/Variable/arrayIndexesList";\r
         public static final String Variable_arrayIndexesList_Inverse = "http://www.simantics.org/Sysdyn-1.1/Variable/arrayIndexesList/Inverse";\r
         public static final String Variable_arrayIndexes_Inverse = "http://www.simantics.org/Sysdyn-1.1/Variable/arrayIndexes/Inverse";\r
+        public static final String Variable_equation = "http://www.simantics.org/Sysdyn-1.1/Variable/equation";\r
+        public static final String Variable_equation_Inverse = "http://www.simantics.org/Sysdyn-1.1/Variable/equation/Inverse";\r
         public static final String Variable_expressionList = "http://www.simantics.org/Sysdyn-1.1/Variable/expressionList";\r
         public static final String Variable_expressionList_Inverse = "http://www.simantics.org/Sysdyn-1.1/Variable/expressionList/Inverse";\r
         public static final String Variable_expressions = "http://www.simantics.org/Sysdyn-1.1/Variable/expressions";\r
@@ -1962,6 +1970,7 @@ public class SysdynResource {
         FlowConnection_width_Inverse = getResourceOrNull(graph, URIs.FlowConnection_width_Inverse);\r
         FunctionTree = getResourceOrNull(graph, URIs.FunctionTree);\r
         Functions = getResourceOrNull(graph, URIs.Functions);\r
+        Functions_equationPropertyValue = getResourceOrNull(graph, URIs.Functions_equationPropertyValue);\r
         Functions_runChildren = getResourceOrNull(graph, URIs.Functions_runChildren);\r
         Functions_runProperties = getResourceOrNull(graph, URIs.Functions_runProperties);\r
         Functions_valuePropertyProperties = getResourceOrNull(graph, URIs.Functions_valuePropertyProperties);\r
@@ -2041,6 +2050,7 @@ public class SysdynResource {
         Loop_Items_Inverse = getResourceOrNull(graph, URIs.Loop_Items_Inverse);\r
         Migration = getResourceOrNull(graph, URIs.Migration);\r
         Migration_from1$6to1$7 = getResourceOrNull(graph, URIs.Migration_from1$6to1$7);\r
+        Migration_from1$6to1$7_Custom = getResourceOrNull(graph, URIs.Migration_from1$6to1$7_Custom);\r
         Migration_from1$6to1$7_Ontologies = getResourceOrNull(graph, URIs.Migration_from1$6to1$7_Ontologies);\r
         Migration_from1$6to1$7_OrderedSetsToLists = getResourceOrNull(graph, URIs.Migration_from1$6to1$7_OrderedSetsToLists);\r
         Migration_from1$6to1$7_Spreadsheets = getResourceOrNull(graph, URIs.Migration_from1$6to1$7_Spreadsheets);\r
@@ -2311,6 +2321,8 @@ public class SysdynResource {
         Variable_arrayIndexesList = getResourceOrNull(graph, URIs.Variable_arrayIndexesList);\r
         Variable_arrayIndexesList_Inverse = getResourceOrNull(graph, URIs.Variable_arrayIndexesList_Inverse);\r
         Variable_arrayIndexes_Inverse = getResourceOrNull(graph, URIs.Variable_arrayIndexes_Inverse);\r
+        Variable_equation = getResourceOrNull(graph, URIs.Variable_equation);\r
+        Variable_equation_Inverse = getResourceOrNull(graph, URIs.Variable_equation_Inverse);\r
         Variable_expressionList = getResourceOrNull(graph, URIs.Variable_expressionList);\r
         Variable_expressionList_Inverse = getResourceOrNull(graph, URIs.Variable_expressionList_Inverse);\r
         Variable_expressions = getResourceOrNull(graph, URIs.Variable_expressions);\r
index 2a977039ba2a16453e9b14a054bcffc2c7766f4c..eadf6cee2c29e63d23762751e8816ebe32fe0ac8 100644 (file)
                         </equals>\r
                      </iterate>\r
                      <and>\r
-                        <not>\r
-                           <count\r
-                                 value="0">\r
-                           </count>\r
-                        </not>\r
+                        <count\r
+                              value="0">\r
+                        </count>\r
                      </and>\r
                   </with>\r
                </visibleWhen>\r
             <command\r
                   commandId="org.simantics.sysdyn.ui.newModuleNode"\r
                   id="org.simantics.sysdyn.ui.browser.newModule"\r
-                  label="Module"\r
+                  label="Module type"\r
                   style="push">\r
                <visibleWhen\r
                      checkEnabled="true">\r
                </visibleWhen>\r
             </command>\r
             <command\r
-                  commandId="org.simantics.sysdyn.ui.newBarChart"\r
-                  icon="platform:/plugin/com.famfamfam.silk/icons/chart_bar.png"\r
-                  id="org.simantics.sysdyn.ui.browser.newBarChart"\r
-                  label="Bar Chart"\r
+                  commandId="org.simantics.sysdyn.ui.newSensitivityChart"\r
+                  icon="platform:/plugin/com.famfamfam.silk/icons/rainbow.png"\r
+                  id="org.simantics.sysdyn.ui.browser.newSensitivityChart"\r
+                  label="Sensitivity Chart"\r
                   style="push">\r
                <visibleWhen\r
                      checkEnabled="true">\r
                </visibleWhen>\r
             </command>\r
             <command\r
-                  commandId="org.simantics.sysdyn.ui.newPieChart"\r
-                  icon="platform:/plugin/com.famfamfam.silk/icons/chart_pie.png"\r
-                  id="org.simantics.sysdyn.ui.browser.newPieChart"\r
-                  label="Pie Chart"\r
+                  commandId="org.simantics.sysdyn.ui.newBarChart"\r
+                  icon="platform:/plugin/com.famfamfam.silk/icons/chart_bar.png"\r
+                  id="org.simantics.sysdyn.ui.browser.newBarChart"\r
+                  label="Bar Chart"\r
                   style="push">\r
                <visibleWhen\r
                      checkEnabled="true">\r
                </visibleWhen>\r
             </command>\r
             <command\r
-                  commandId="org.simantics.sysdyn.ui.newSensitivityChart"\r
-                  icon="platform:/plugin/com.famfamfam.silk/icons/rainbow.png"\r
-                  id="org.simantics.sysdyn.ui.browser.newSensitivityChart"\r
-                  label="Sensitivity Chart"\r
+                  commandId="org.simantics.sysdyn.ui.newPieChart"\r
+                  icon="platform:/plugin/com.famfamfam.silk/icons/chart_pie.png"\r
+                  id="org.simantics.sysdyn.ui.browser.newPieChart"\r
+                  label="Pie Chart"\r
                   style="push">\r
                <visibleWhen\r
                      checkEnabled="true">\r
             type="radio"\r
             value="flow">\r
       </command>\r
+      <!--<command\r
+            commandId="org.simantics.sysdyn.ui.diagramTool"\r
+            image="platform:/plugin/com.famfamfam.silk/icons/textfield_add.png"\r
+            name="Create Auxiliary (Shift+A)"\r
+            toolbarId="org.simantics.sysdyn.ui.diagramToolbar"\r
+            type="radio"\r
+            value="auxiliary">\r
+      </command>-->\r
    </extension>\r
    <extension\r
          point="org.simantics.project.feature">\r
index 90079b1145608ef675b4f3b67fec7526d5390153..805f6e1829d8b265aa968822e510a4336ad904bb 100644 (file)
@@ -57,7 +57,7 @@ public class Model  extends ViewpointContributor<ModelNode> {
         result.add(new ModulesNode(model.data));\r
         result.add(new FunctionsFolder(model.data));\r
         result.add(new ChartsFolder(model.data));\r
-//        result.add(new SCLModulesFolder(model.data));\r
+        result.add(new SCLModulesFolder(model.data));\r
         return result;\r
     }\r
 \r
index 0b83ef3fbf910721c7f42e09dd739aa0195d7882..473ee7a17b769b1867a521335245630e13bdae90 100644 (file)
@@ -282,8 +282,10 @@ public class LoopFactory extends SysdynElementFactory {
                                        Alignment alignment = Alignment.CENTER;\r
 \r
                                        name.setTransform(at2);\r
-                                       if(alignment != null)\r
+                                       if(alignment != null) {\r
                                                name.setHorizontalAlignment((byte) alignment.ordinal());\r
+                                               name.setVerticalAlignment((byte) alignment.ordinal());\r
+                                       }\r
                                }\r
                        }\r
                }\r
@@ -295,7 +297,7 @@ public class LoopFactory extends SysdynElementFactory {
 \r
                private static double getYCoordShift(IElement e) {\r
                        //String location = e.getHint(SysdynElementHints.KEY_LOCATION);\r
-                       return 10.7;\r
+                       return 9.7;\r
                }\r
 \r
                @Override\r
index a94c8a14905c4508e3e7e6847dd471b803fe0763..bd1c1bfd910f63936894de89f1c89a5a5add6c85 100644 (file)
@@ -33,7 +33,7 @@ import org.simantics.db.Resource;
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.management.ISessionContext;\r
-import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
+import org.simantics.jfreechart.chart.properties.AdjustableTab;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.ui.elements.connections.DependencyEdgeClass;\r
 import org.simantics.sysdyn.ui.elements.connections.DependencyNode;\r
@@ -47,95 +47,18 @@ import org.simantics.utils.datastructures.Triple;
  * @author Tuomas Miettinen\r
  *\r
  */\r
-public class ArrayDependencyTab  extends LabelPropertyTabContributor {\r
+public class ArrayDependencyTab  extends AdjustableTab {\r
 \r
     Button none, plus, minus, other, inside, outside;\r
     TrackedText polarityText, polarityLocationText;\r
     private DelayMarkWidget delayMark;\r
     private ArrowHeadWidget arrowhead;\r
        private Scale lineThicknessScale;\r
-    \r
-    @Override\r
-    public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport support) {\r
-        Composite composite = new Composite(body, SWT.NONE);\r
-        GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
-        GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(composite);\r
-        \r
-        /* Add a dummy button at the begin to suck in the nonsense selection events that\r
-         * the first radio button in the group of ALL the radio buttons receives when no\r
-         * radio is selected and then one is selected in other group than where the first \r
-         * radio button lies.  \r
-         */\r
-        Group hiddenDefaultbuttonGroup = new Group(composite, SWT.NONE);\r
-        GridDataFactory.fillDefaults().exclude(true).applyTo(hiddenDefaultbuttonGroup);\r
-        GridLayoutFactory.fillDefaults().applyTo(hiddenDefaultbuttonGroup);\r
-        new Button(hiddenDefaultbuttonGroup, support, SWT.RADIO);\r
-        \r
-        Group polarityGroup = new Group(composite, SWT.NONE);\r
-        polarityGroup.setText("Polarity");\r
-        GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityGroup);\r
-        GridLayoutFactory.fillDefaults().numColumns(5).applyTo(polarityGroup);\r
-        \r
-        none = new Button(polarityGroup, support, SWT.RADIO);\r
-        none.setText("None");\r
-        none.setSelectionFactory(new PolarityRadioSelectionFactory(""));\r
-        none.addSelectionListener(new PolaritySelectionListener(context, ""));\r
-        \r
-        plus = new Button(polarityGroup, support, SWT.RADIO);\r
-        plus.setText("+");\r
-        plus.setSelectionFactory(new PolarityRadioSelectionFactory("+"));\r
-        plus.addSelectionListener(new PolaritySelectionListener(context, "+"));\r
-        \r
-        minus = new Button(polarityGroup, support, SWT.RADIO);\r
-        minus.setText("-");\r
-        minus.setSelectionFactory(new PolarityRadioSelectionFactory("-"));\r
-        minus.addSelectionListener(new PolaritySelectionListener(context, "-"));\r
-        \r
-        other = new Button(polarityGroup, support, SWT.RADIO);\r
-        other.setText("other");\r
-        other.setSelectionFactory(new OtherPolaritySelectionFactory(new String[] {null, "+", "-", ""}));\r
-        \r
-        polarityText = new TrackedText(polarityGroup, support, SWT.BORDER);\r
-        polarityText.setTextFactory(new OtherPolarityStringPropertyFactory());\r
-        polarityText.addModifyListener(new OtherPolarityStringPropertyModifier());\r
-        GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityText.getWidget());\r
-        \r
-        Group locationGroup = new Group(composite, SWT.NONE);\r
-        GridDataFactory.fillDefaults().applyTo(locationGroup);\r
-        GridLayoutFactory.fillDefaults().applyTo(locationGroup);\r
-        locationGroup.setText("Location");\r
-        \r
-        inside = new Button(locationGroup, support, SWT.RADIO);\r
-        inside.setText("Inside");\r
-        inside.setSelectionFactory(new PolarityLocationRadioSelectionFactory(DependencyNode.INSIDE));\r
-        inside.addSelectionListener(new PolarityLocationSelectionListener(context, DependencyNode.INSIDE));\r
-        \r
-        outside = new Button(locationGroup, support, SWT.RADIO);\r
-        outside.setText("Outside");\r
-        outside.setSelectionFactory(new PolarityLocationRadioSelectionFactory(DependencyNode.OUTSIDE));\r
-        outside.addSelectionListener(new PolarityLocationSelectionListener(context, DependencyNode.OUTSIDE));\r
-\r
-        Composite misc = new Composite(composite, SWT.NONE);\r
-        GridDataFactory.fillDefaults().grab(true, true).applyTo(misc);\r
-        GridLayoutFactory.fillDefaults().numColumns(3).applyTo(misc);\r
-        \r
-        arrowhead = new ArrowHeadWidget(misc, support, SWT.NULL);\r
-        GridDataFactory.fillDefaults().applyTo(arrowhead.getWidget());\r
-        delayMark = new DelayMarkWidget(misc, support, SWT.NULL);\r
-        GridDataFactory.fillDefaults().applyTo(delayMark.getWidget());\r
-        \r
-        Group lineThicknessGroup = new Group(misc, SWT.NONE);\r
-        GridDataFactory.fillDefaults().applyTo(lineThicknessGroup);\r
-        GridLayoutFactory.fillDefaults().applyTo(lineThicknessGroup);\r
-        lineThicknessGroup.setText("Line thickness:");\r
-        lineThicknessScale = new Scale(lineThicknessGroup, support, SWT.HORIZONTAL);\r
-        lineThicknessScale.getWidget().setMinimum(1);\r
-        lineThicknessScale.getWidget().setMaximum(15);\r
-        lineThicknessScale.getWidget().setPageIncrement(1);\r
-        lineThicknessScale.getWidget().setIncrement(1);\r
-        lineThicknessScale.setSelectionFactory(new LineThicknessRadioSelectionFactory());\r
-        lineThicknessScale.addSelectionListener(new LineThicknessSelectionListener(context, lineThicknessScale));\r
-    }\r
+       private Group hiddenDefaultbuttonGroup;\r
+       private Group polarityGroup;\r
+       private Group locationGroup;\r
+       private Composite misc;\r
+       private Group lineThicknessGroup;\r
     \r
     class LineThicknessSelectionListener extends SelectionListenerImpl<ArrayList<Resource>> {\r
        Scale scale;\r
@@ -345,4 +268,124 @@ public class ArrayDependencyTab  extends LabelPropertyTabContributor {
         }\r
     }\r
 \r
+       @Override\r
+       protected void createAndAddControls(Composite body, IWorkbenchSite site,\r
+                       ISessionContext context, WidgetSupport support) {\r
+               composite = new Composite(body, SWT.NONE);\r
+        \r
+        /* Add a dummy button at the begin to suck in the nonsense selection events that\r
+         * the first radio button in the group of ALL the radio buttons receives when no\r
+         * radio is selected and then one is selected in other group than where the first \r
+         * radio button lies.  \r
+         */\r
+        hiddenDefaultbuttonGroup = new Group(composite, SWT.NONE);\r
+        new Button(hiddenDefaultbuttonGroup, support, SWT.RADIO);\r
+        \r
+        polarityGroup = new Group(composite, SWT.NONE);\r
+        polarityGroup.setText("Polarity");\r
+        \r
+        none = new Button(polarityGroup, support, SWT.RADIO);\r
+        none.setText("None");\r
+        none.setSelectionFactory(new PolarityRadioSelectionFactory(""));\r
+        none.addSelectionListener(new PolaritySelectionListener(context, ""));\r
+        \r
+        plus = new Button(polarityGroup, support, SWT.RADIO);\r
+        plus.setText("+");\r
+        plus.setSelectionFactory(new PolarityRadioSelectionFactory("+"));\r
+        plus.addSelectionListener(new PolaritySelectionListener(context, "+"));\r
+        \r
+        minus = new Button(polarityGroup, support, SWT.RADIO);\r
+        minus.setText("-");\r
+        minus.setSelectionFactory(new PolarityRadioSelectionFactory("-"));\r
+        minus.addSelectionListener(new PolaritySelectionListener(context, "-"));\r
+        \r
+        other = new Button(polarityGroup, support, SWT.RADIO);\r
+        other.setText("other");\r
+        other.setSelectionFactory(new OtherPolaritySelectionFactory(new String[] {null, "+", "-", ""}));\r
+        \r
+        polarityText = new TrackedText(polarityGroup, support, SWT.BORDER);\r
+        polarityText.setTextFactory(new OtherPolarityStringPropertyFactory());\r
+        polarityText.addModifyListener(new OtherPolarityStringPropertyModifier());\r
+        \r
+        locationGroup = new Group(composite, SWT.NONE);\r
+        locationGroup.setText("Location");\r
+        \r
+        inside = new Button(locationGroup, support, SWT.RADIO);\r
+        inside.setText("Inside");\r
+        inside.setSelectionFactory(new PolarityLocationRadioSelectionFactory(DependencyNode.INSIDE));\r
+        inside.addSelectionListener(new PolarityLocationSelectionListener(context, DependencyNode.INSIDE));\r
+        \r
+        outside = new Button(locationGroup, support, SWT.RADIO);\r
+        outside.setText("Outside");\r
+        outside.setSelectionFactory(new PolarityLocationRadioSelectionFactory(DependencyNode.OUTSIDE));\r
+        outside.addSelectionListener(new PolarityLocationSelectionListener(context, DependencyNode.OUTSIDE));\r
+\r
+        misc = new Composite(composite, SWT.NONE);\r
+        \r
+        arrowhead = new ArrowHeadWidget(misc, support, SWT.NULL);\r
+        delayMark = new DelayMarkWidget(misc, support, SWT.NULL);\r
+        \r
+        lineThicknessGroup = new Group(misc, SWT.NONE);\r
+        lineThicknessGroup.setText("Line thickness:");\r
+        lineThicknessScale = new Scale(lineThicknessGroup, support, SWT.HORIZONTAL);\r
+        lineThicknessScale.getWidget().setMinimum(1);\r
+        lineThicknessScale.getWidget().setMaximum(15);\r
+        lineThicknessScale.getWidget().setPageIncrement(1);\r
+        lineThicknessScale.getWidget().setIncrement(1);\r
+        lineThicknessScale.setSelectionFactory(new LineThicknessRadioSelectionFactory());\r
+        lineThicknessScale.addSelectionListener(new LineThicknessSelectionListener(context, lineThicknessScale));\r
+       }\r
+\r
+       @Override\r
+       protected void createControlLayoutVertical() {\r
+               GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+        GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(1).applyTo(composite);\r
+        \r
+        GridDataFactory.fillDefaults().exclude(true).applyTo(hiddenDefaultbuttonGroup);\r
+        GridLayoutFactory.fillDefaults().applyTo(hiddenDefaultbuttonGroup);\r
+        \r
+        GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityGroup);\r
+        GridLayoutFactory.fillDefaults().numColumns(5).applyTo(polarityGroup);\r
+        \r
+        GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityText.getWidget());\r
+        \r
+        GridDataFactory.fillDefaults().applyTo(locationGroup);\r
+        GridLayoutFactory.fillDefaults().applyTo(locationGroup);\r
+        \r
+        GridDataFactory.fillDefaults().grab(true, true).applyTo(misc);\r
+        GridLayoutFactory.fillDefaults().numColumns(2).applyTo(misc);\r
+\r
+        GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(arrowhead.getWidget());\r
+        GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(delayMark.getWidget());\r
+        \r
+        GridDataFactory.fillDefaults().span(2, 1).applyTo(lineThicknessGroup);\r
+        GridLayoutFactory.fillDefaults().applyTo(lineThicknessGroup);\r
+       }\r
+\r
+       @Override\r
+       protected void createControlLayoutHorizontal(boolean wideScreen) {\r
+               GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+        GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(composite);\r
+        \r
+        GridDataFactory.fillDefaults().exclude(true).applyTo(hiddenDefaultbuttonGroup);\r
+        GridLayoutFactory.fillDefaults().applyTo(hiddenDefaultbuttonGroup);\r
+        \r
+        GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityGroup);\r
+        GridLayoutFactory.fillDefaults().numColumns(5).applyTo(polarityGroup);\r
+        \r
+        GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityText.getWidget());\r
+        \r
+        GridDataFactory.fillDefaults().applyTo(locationGroup);\r
+        GridLayoutFactory.fillDefaults().applyTo(locationGroup);\r
+        \r
+        GridDataFactory.fillDefaults().grab(true, true).applyTo(misc);\r
+        GridLayoutFactory.fillDefaults().numColumns(3).applyTo(misc);\r
+\r
+        GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(arrowhead.getWidget());\r
+        GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(delayMark.getWidget());\r
+        \r
+        GridDataFactory.fillDefaults().span(1, 1).applyTo(lineThicknessGroup);\r
+        GridLayoutFactory.fillDefaults().applyTo(lineThicknessGroup);\r
+       }\r
+\r
 }\r
index 3d7183e610e68e448b9bae0cb86d61aa16d8690d..0b6c00c10031eed1bb4fa0a49f88d3e0c3bacaea 100644 (file)
@@ -25,7 +25,6 @@ import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;
 import org.simantics.db.management.ISessionContext;\r
 import org.simantics.diagram.stubs.DiagramResource;\r
 import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
-import org.simantics.utils.datastructures.Callback;\r
 \r
 /**\r
  * Tab for editing diagram comments\r
@@ -35,10 +34,10 @@ import org.simantics.utils.datastructures.Callback;
  */\r
 public class CommentTab extends LabelPropertyTabContributor {\r
 \r
-    @Override\r
-    public void updatePartName(ISelection forSelection, final Callback<String> updateCallback) {\r
-        updateCallback.run("Comment");\r
-    }\r
+       @Override\r
+       public String getPartName(ISelection forSelection) {\r
+               return "Comment";\r
+       }\r
         \r
     @Override\r
     public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport support) {\r
index afee67e9a9702edf8d032cd56b38b0bdb60d72c3..33ad0ea6310db36e136a65d172974a9b67275bfb 100644 (file)
@@ -60,7 +60,6 @@ import org.simantics.sysdyn.ui.properties.widgets.factories.ModelNameInputValida
 public class ConfigurationTab extends AdjustableTab {\r
 \r
        private ScrolledComposite sc;\r
-       private Composite composite;\r
        private Label nameLabel, startTimeLabel, stopTimeLabel, stepLengthLabel, \r
                outputIntervalLabel, methodLabel, toleranceLabel, variableFilterLabel;\r
        private TrackedText name, startTime, stopTime, stepLength, outputInterval, tolerance, variableFilter;\r
@@ -279,7 +278,9 @@ public class ConfigurationTab extends AdjustableTab {
                        "To include variables Auxiliary1, Auxiliary2 and Auxiliary3: \n" +\r
                        "Auxiliary[1-3]\n" +\r
                        "or\n" +\r
-                       "Auxiliary1|Auxiliary2|Auxiliary3");\r
+                       "Auxiliary1|Auxiliary2|Auxiliary3\n" +\r
+                       "NOTE: whitespace must be replaced with an underscore ('_') character" +\r
+                       "e.g. 'Growth Rate' -> 'Growth_Rate'");\r
 \r
         variableFilter = new TrackedText(composite, support, SWT.BORDER);\r
         variableFilter.setTextFactory(new StringPropertyFactory(SysdynResource.URIs.SysdynModel_variableFilter, ""));\r
@@ -288,7 +289,9 @@ public class ConfigurationTab extends AdjustableTab {
                 "To include variables Auxiliary1, Auxiliary2 and Auxiliary3: \n" +\r
                 "Auxiliary[1-3]\n" +\r
                 "or\n" +\r
-                "Auxiliary1|Auxiliary2|Auxiliary3");\r
+                "Auxiliary1|Auxiliary2|Auxiliary3\n" +\r
+                       "NOTE: whitespace must be replaced with an underscore ('_') character" +\r
+                       "e.g. 'Growth Rate' -> 'Growth_Rate'");\r
         \r
         sc.setExpandHorizontal(true);\r
         sc.setExpandVertical(true);\r
index 6cb813fa5a42122a5c2a45f2a65093eb99ea9c7b..1acc02126ddd35cfa09d5c89f74f663c267d0c4a 100644 (file)
@@ -55,7 +55,6 @@ public class DependencyTab  extends AdjustableTab {
     Scale lineThicknessScale;\r
     private DelayMarkWidget delayMark;\r
     private ArrowHeadWidget arrowhead;\r
-       private Composite composite;\r
        private Group polarityGroup;\r
        private Group locationGroup;\r
        private Composite misc;\r
index c022808d6785296482119a0818950f0d94e8dc07..633cdfa3df877678dd47127b35af3b4ebf285bdf 100644 (file)
@@ -98,7 +98,6 @@ public class EquationTab extends AdjustableTab implements Widget {
        private WidgetSupportImpl support;\r
        private ExpressionComposite expressionComposite;\r
        private final WidgetSupportImpl expressionSupport = new WidgetSupportImpl();\r
-       private Composite composite;\r
        private Composite nameComposite;\r
        private Composite TypeAndUnit;\r
        private Label typeLabel;\r
index de7994bebeaa94c36a69b5a7ff93279b0c9132f7..c20ede211a543439d3f5ec07e20ebe3d9a189c2d 100644 (file)
@@ -33,7 +33,6 @@ import org.simantics.sysdyn.ui.properties.widgets.functions.FunctionCodeWidget;
 public class FunctionTab extends AdjustableTab {\r
        \r
        ExpressionField modelicaCode;\r
-       private Composite composite;\r
        private TrackedText nameText;\r
        private Group modelicaGroup;\r
        private Label startLabel;\r
index cc4bd43d6328c8d35cbeff5544aa7973f0b23a72..ee43cbb41ce1bf911988fb94fd8236a95be24a9a 100644 (file)
@@ -60,7 +60,7 @@ public class LoopTab extends AdjustableTab {
        private TrackedCombo loopItemsDropdown;\r
        Button auto, balancing, reinforcing, other, inside, outside;\r
     TrackedText loopComment, polarityLocationText;\r
-    Composite composite, loopItems;\r
+    Composite loopItems;\r
     Group commentGroup, rotationGroup;\r
        protected Resource resource;\r
        public static final String AUTO = "$$AUTO$$";\r
index 1fb36162a2c5dd822dbacfcca4d94fd03f6afa94..49407d6bbd459f0590427f117e4d0207f17a8632 100644 (file)
@@ -32,6 +32,7 @@ import org.simantics.db.layer0.request.PossibleActiveVariableFromVariable;
 import org.simantics.db.layer0.variable.Variable;\r
 import org.simantics.diagram.stubs.DiagramResource;\r
 import org.simantics.jfreechart.ChartSelectionTabContributor;\r
+import org.simantics.jfreechart.chart.properties.ChartTab;\r
 import org.simantics.jfreechart.chart.properties.xyline.XYLineGeneralPropertiesTab;\r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.modeling.ModelingResources;\r
@@ -527,6 +528,11 @@ public class ResourceSelectionProcessor implements SelectionProcessor<Object, Re
                             9,\r
                             r,\r
                             "Axis and Variables"));\r
+                    tabs.add(new ComparableTabContributor(\r
+                            new ChartTab(),\r
+                            1,\r
+                            r,\r
+                            "Chart"));\r
                     return true;\r
                 }\r
             }\r
index 409471cfdec6105c6aced25155f6f20bdfd6600f..ee1a45557a907e69313ceeb08fc284ef106804ef 100644 (file)
@@ -107,7 +107,6 @@ public class SensitivityAnalysisExperimentTab extends AdjustableTab implements W
     private boolean dirtyMethod = false;\r
     \r
     private DisposableListener<Collection<Resource>> contentListener;\r
-       private RemoveFocusBeforeExperimentComposite composite;\r
        private Composite labelComposite;\r
        private Label labelName;\r
        private Label labelNumber;\r
index c5b1851648a7b6a122fc17fc81b9616ec9476176..2e4fc80143161a57c5e6d248f80b9e2242886e37 100644 (file)
@@ -86,7 +86,6 @@ public class VariableInformationTab extends AdjustableTab implements Widget {
     }\r
 \r
     private Read<Pair<Font, Color>> fontAndColorRead;\r
-       private Composite composite;\r
        private Group informationGroup;\r
        private TrackedText information;\r
        private Group rangeGroup;\r
index 51bcf324ca90479b3b43ffa595c4bf54a712aaec..8bf97ce6da5eb685c1ce2b313cbfe3620cca3c38 100644 (file)
@@ -19,6 +19,8 @@ import java.util.Map;
 import org.eclipse.jface.dialogs.Dialog;\r
 import org.eclipse.jface.layout.GridDataFactory;\r
 import org.eclipse.jface.layout.GridLayoutFactory;\r
+import org.eclipse.jface.preference.IPreferenceStore;\r
+import org.eclipse.jface.preference.PreferenceConverter;\r
 import org.eclipse.jface.resource.FontDescriptor;\r
 import org.eclipse.jface.resource.JFaceResources;\r
 import org.eclipse.jface.resource.LocalResourceManager;\r
@@ -38,6 +40,8 @@ import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;\r
 import org.eclipse.swt.widgets.Table;\r
 import org.eclipse.swt.widgets.TableItem;\r
+import org.simantics.sysdyn.ui.Activator;\r
+import org.simantics.sysdyn.ui.preferences.SysdynDiagramPreferences;\r
 import org.simantics.utils.ui.gfx.ColorImageDescriptor;\r
 \r
 /**\r
@@ -345,6 +349,20 @@ public class CustomFontDialog extends Dialog {
         int code;\r
         RGB color;\r
         Display display = Display.getCurrent();\r
+        \r
+        //IWorkbenchPage iwp = SysdynWorkbenchUtils.getActivePageOfEditor();\r
+               //final ICanvasContext context = (ICanvasContext)iwp.getActiveEditor().getAdapter(ICanvasContext.class);\r
+        \r
+        IPreferenceStore store = Activator.getDefault().getPreferenceStore();\r
+        color = PreferenceConverter.getColor(store, SysdynDiagramPreferences.ARROW_COLOR);\r
+        image = resourceManager.createImage(new ColorImageDescriptor(color.red, color.green, color.blue, 25, 15, false));\r
+        \r
+        ti = new TableItem(table, SWT.NONE);\r
+        ti.setImage(0, image);\r
+        ti.setText(1, "Default Arrow");\r
+        ti.setForeground(display.getSystemColor(SWT.COLOR_BLACK));\r
+        ti.setData(color);\r
+        \r
         for(String text : systemColors.keySet()) {\r
             code = systemColors.get(text);\r
             color = display.getSystemColor(code).getRGB();\r
index 2f9571460cc3a031b86f763c1cf4d503a47038c3..ab53b0f848129ba6137d01b212db63bb16006818 100644 (file)
@@ -47,7 +47,6 @@ public class SensitivityChartAxisAndVariablesTab extends AdjustableTab {
     private GraphExplorerComposite explorer;\r
     private ScrolledComposite propertyContainer;\r
     private WidgetSupportImpl additionalSupport;\r
-       private Composite composite;\r
 \r
     public SensitivityChartAxisAndVariablesTab() {\r
         additionalSupport = new WidgetSupportImpl();\r
@@ -111,8 +110,6 @@ public class SensitivityChartAxisAndVariablesTab extends AdjustableTab {
        protected void createAndAddControls(Composite body, IWorkbenchSite site,\r
                        final ISessionContext context, WidgetSupport support) {\r
                composite = new Composite(body, SWT.NONE);\r
-        GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
-        GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
 \r
         // (Ontology-based) GraphExplorer displaying range axis and variables mapped to those axis\r
         explorer = new AxisAndVariablesExplorerComposite(ArrayMap.keys(\r
@@ -128,12 +125,9 @@ public class SensitivityChartAxisAndVariablesTab extends AdjustableTab {
                 updateSelection(context);\r
             }\r
         });\r
-        GridDataFactory.fillDefaults().hint(250, SWT.DEFAULT).grab(false, true).applyTo(explorer);\r
 \r
         // Scrolled composite for displaying properties of a selection in explorer\r
         propertyContainer = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);\r
-        GridDataFactory.fillDefaults().span(1, 2).grab(true, true).applyTo(propertyContainer);\r
-        GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
         propertyContainer.setExpandHorizontal(true);\r
         propertyContainer.setExpandVertical(true);\r
 \r
index d6f024e1256152ab47ac954a3765ae0582232a49..73663c77e1022698c19d646c8b45aa5400662e2b 100644 (file)
@@ -1,3 +1,14 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2014 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
 package org.simantics.sysdyn.ui.utils;\r
 \r
 import java.util.ArrayList;\r
@@ -59,74 +70,91 @@ public class ArrayVariableUtils {
             result.put(elements.length > 0 ? elements.length - 1 : 0, error);\r
         }\r
 \r
-\r
         for(int i = 0; i < elements.length && i < enumerations.size(); i++) {\r
-            if(elements[i].trim().equals(":"))\r
-                continue;\r
-            if(elements[i].indexOf(":") != elements[i].lastIndexOf(":")) {\r
+               String trimmedElement = elements[i].trim();\r
+            if (trimmedElement.charAt(0) == '{' && trimmedElement.charAt(trimmedElement.length() - 1) == '}') {\r
+               // Something like "{a, b, c}"\r
+               String[] rangeComponents = trimmedElement.substring(1, trimmedElement.length() - 1).split(",");\r
+               // Single range component, equals to the enumeration at that index\r
+                if(rangeComponents.length == 1 && rangeComponents[0].trim().equals(enumerations.get(i).getName()))\r
+                       continue;\r
+                   // more than one range component, they all equal to individual indexes in the enumeration\r
+                result.putAll(areRangeComponentsValid(rangeComponents, enumerations, i));\r
+            } else if(trimmedElement.equals(":")) {\r
+                continue; // Just a ":"\r
+               } else if(elements[i].indexOf(":") != elements[i].lastIndexOf(":")) {\r
+                       // Something like "a : b : c"\r
                 error = new SyntaxError();\r
                 error.setMessage( "Too many ':' elements");\r
                 error.setType(ExpressionField.SYNTAX_ERROR);\r
                 result.put(i, error);\r
                 continue;\r
+            } else {\r
+               // Something like "a : c" OR "a"\r
+                   String[] rangeComponents = elements[i].split(":");\r
+                   if(rangeComponents.length > 2){\r
+                       error = new SyntaxError();\r
+                       error.setMessage( "Too many ':' elements");\r
+                       error.setType(ExpressionField.SYNTAX_ERROR);\r
+                       result.put(i, error);\r
+                       continue;\r
+                   }\r
+                   // Single range component, equals to the enumeration at that index\r
+                   if(rangeComponents.length == 1 && rangeComponents[0].trim().equals(enumerations.get(i).getName()))\r
+                       continue;\r
+                   // one or two range components, they all equal to individual indexes in the enumeration\r
+                   result.putAll(areRangeComponentsValid(rangeComponents, enumerations, i));\r
             }\r
+        }\r
+        if(result.isEmpty())\r
+            return null;\r
+        else\r
+            return result;\r
+    }\r
 \r
-            String[] rangeComponents = elements[i].split(":");\r
-            if(rangeComponents.length > 2){\r
-                error = new SyntaxError();\r
-                error.setMessage( "Too many ':' elements");\r
-                error.setType(ExpressionField.SYNTAX_ERROR);\r
-                result.put(i, error);\r
-                continue;\r
+    private static Map<Integer, SyntaxError> areRangeComponentsValid(String[] rangeComponents, ArrayList<Enumeration> enumerations, int i) {\r
+       SyntaxError error;\r
+       Map<Integer, SyntaxError> result = new HashMap<Integer, SyntaxError>();\r
+        for(String r : rangeComponents) {\r
+            r = r.trim();\r
+            boolean componentIsValid = false;\r
+            Enumeration enumeration = enumerations.get(i);\r
+            for(EnumerationIndex ei : enumeration.getEnumerationIndexes()) {\r
+                if(ei.getName().equals(r)) {\r
+                    componentIsValid = true;\r
+                    break;\r
+                }\r
             }\r
-            // Single range component, equals to the enumeration at that index\r
-            if(rangeComponents.length == 1 && rangeComponents[0].trim().equals(enumerations.get(i).getName()))\r
-                continue;\r
-            // one or two range components, they all equal to individual indexes in the enumeration\r
-            for(String r : rangeComponents) {\r
-                r = r.trim();\r
-                boolean componentIsValid = false;\r
-                Enumeration enumeration = enumerations.get(i);\r
-                for(EnumerationIndex ei : enumeration.getEnumerationIndexes()) {\r
-                    if(ei.getName().equals(r)) {\r
+            if(!componentIsValid  && r.length() > 0) {\r
+                // Check if the range is an integer that is between 0 and enumeration indexes size\r
+                try {\r
+                    int index = Integer.parseInt(r);\r
+                    int min = 1;\r
+                    int max = enumeration.getEnumerationIndexes().size();\r
+                    if(index >= min && index <= max || enumeration.isReplaceable()) {\r
                         componentIsValid = true;\r
-                        break;\r
-                    }\r
-                }\r
-                if(!componentIsValid  && r.length() > 0) {\r
-                    // Check if the range is an integer that is between 0 and enumeration indexes size\r
-                    try {\r
-                        int index = Integer.parseInt(r);\r
-                        int min = 1;\r
-                        int max = enumeration.getEnumerationIndexes().size();\r
-                        if(index >= min && index <= max || enumeration.isReplaceable()) {\r
-                            componentIsValid = true;\r
-                            error = new SyntaxError();\r
-                            error.setMessage("Using numbers as array indexes is not encouraged");\r
-                            error.setType(ExpressionField.SYNTAX_WARNING);\r
-                            result.put(i, error);\r
-                        } else {\r
-                            error = new SyntaxError();\r
-                            error.setMessage("Invalid array index " + index + ". Numbered index must be between " + min + " and " + max);\r
-                            error.setType(ExpressionField.SYNTAX_ERROR);\r
-                            result.put(i, error);\r
-                        }\r
-                    } catch (NumberFormatException e) {\r
                         error = new SyntaxError();\r
-                        error.setMessage("Invalid range");\r
+                        error.setMessage("Using numbers as array indexes is not encouraged");\r
+                        error.setType(ExpressionField.SYNTAX_WARNING);\r
+                        result.put(i, error);\r
+                    } else {\r
+                        error = new SyntaxError();\r
+                        error.setMessage("Invalid array index " + index + ". Numbered index must be between " + min + " and " + max);\r
                         error.setType(ExpressionField.SYNTAX_ERROR);\r
                         result.put(i, error);\r
                     }\r
+                } catch (NumberFormatException e) {\r
+                    error = new SyntaxError();\r
+                    error.setMessage("Invalid range");\r
+                    error.setType(ExpressionField.SYNTAX_ERROR);\r
+                    result.put(i, error);\r
                 }\r
             }\r
         }\r
-        if(result.isEmpty())\r
-            return null;\r
-        else\r
-            return result;\r
-    }\r
+               return result;\r
+       }\r
 \r
-    /**\r
+       /**\r
      * Checks if the given range can be applied to the given variable.\r
      * \r
      * @param graph ReadGraph\r
@@ -139,13 +167,30 @@ public class ArrayVariableUtils {
         if(variable == null)\r
             return true;\r
         String[] elements = range.split(",");\r
+        // Connect arrays, e.g. {a,b,c}\r
+        ArrayList<String> connectedElements = new ArrayList<String>();\r
+        for (int i = 0; i < elements.length; ++i) {\r
+               String lastElement = elements[i];\r
+               String fullElement = new String();\r
+               if (lastElement.length() > 0 && lastElement.charAt(0) == '{') {\r
+                       while (lastElement.charAt(lastElement.length() - 1) != '}' && i < elements.length - 1) {\r
+                               fullElement += lastElement + ",";\r
+                               ++i;\r
+                               lastElement = elements[i];\r
+                       }\r
+               }\r
+               fullElement += lastElement;\r
+               connectedElements.add(fullElement);\r
+        }\r
+        String fullElements[] = connectedElements.toArray(new String[connectedElements.size()]);\r
+        \r
         SysdynModel model = ModelUtils.getModel(graph, variable);\r
         if(model == null)\r
             return false;\r
         IElement e = model.getElement(variable);\r
         if(e != null && e instanceof Variable) {\r
             Variable v = (Variable) e;\r
-            if(isRangeValid(graph, v, elements) == null)\r
+            if(isRangeValid(graph, v, fullElements) == null)\r
                 return true;\r
             else\r
                 return false;\r
index 509cd5eaf7518807ce9556b3d7857a769dea2cde..c01c1f802d0c98de8298faaf1b944dd2ac4f948d 100644 (file)
                        adapterClass="org.simantics.sysdyn.adapter.RunVariableAdapter"/>\r
        </target>\r
        -->\r
+\r
+    <target\r
+        interface="org.simantics.db.layer0.migration.MigrationStep">\r
+        <resource\r
+            uri="http://www.simantics.org/Sysdyn-0.0/Migration/from1.6to1.7/Custom"\r
+            class="org.simantics.sysdyn.adapter.CustomMigrationStep">\r
+        </resource>\r
+    </target>\r
     \r
 </adapters>
\ No newline at end of file
index b32a845a27caa419680124c6a7f9c06563e0bb97..148fe0fbd41ae01f747f1366826b5b495ac107c6 100644 (file)
@@ -91,6 +91,8 @@ importJava "org.simantics.sysdyn.utils.DocumentationUtils" where
     isParameter :: Variable -> <ReadGraph> Boolean\r
 \r
     lastValue :: Resource -> String -> String -> Double\r
+    lastValue2 :: Variable -> String -> <ReadGraph> Variable\r
+    equation :: Variable -> String -> <ReadGraph> Variable\r
 \r
 importJava "org.simantics.sysdyn.manager.SysdynExperiments" where\r
     \r
index 002925aa564a47e816242b907940ac18bb6b9d5a..04c2b623103ab0501757d79a153dce219ef9d674 100644 (file)
@@ -1,14 +1,18 @@
 package org.simantics.sysdyn;\r
 \r
+import java.util.Collection;\r
 import java.util.HashMap;\r
 import java.util.Map;\r
 \r
+import org.simantics.databoard.Bindings;\r
 import org.simantics.databoard.binding.Binding;\r
+import org.simantics.databoard.binding.mutable.Variant;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.common.request.ResourceRead;\r
 import org.simantics.db.common.uri.UnescapedChildMapOfResource;\r
+import org.simantics.db.common.utils.ListUtils;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.layer0.function.All;\r
 import org.simantics.db.layer0.variable.StandardGraphChildVariable;\r
@@ -25,6 +29,7 @@ import org.simantics.sysdyn.adapter.NamesIndexVariable;
 import org.simantics.sysdyn.adapter.TimeIndexVariable;\r
 import org.simantics.sysdyn.adapter.TimesIndexVariable;\r
 import org.simantics.sysdyn.adapter.ValueIndexVariable;\r
+import org.simantics.sysdyn.adapter.ValueIndexVariableI;\r
 import org.simantics.sysdyn.adapter.ValuesIndexVariable;\r
 \r
 public class Functions {\r
@@ -68,6 +73,68 @@ public class Functions {
                }\r
        \r
        };\r
+\r
+    @SCLValue(type = "ValueAccessor")\r
+       public static ValueAccessor equationPropertyValue = new ValueAccessor() {\r
+\r
+               @Override\r
+               public Object getValue(ReadGraph graph, Variable context) throws DatabaseException {\r
+                       return getValue(graph, context, Bindings.STRING);\r
+               }\r
+\r
+               @Override\r
+               public Object getValue(ReadGraph graph, Variable context, Binding binding) throws DatabaseException {\r
+                       \r
+                       Variable v = context.getParent(graph);\r
+                       \r
+                       Resource represents = v.getPossibleRepresents(graph);\r
+                       if(represents != null) {\r
+                               SysdynResource SYSDYN = SysdynResource.getInstance(graph);\r
+                               Collection<Resource> res = ListUtils.toList(graph, graph.getSingleObject(represents, SYSDYN.Variable_expressionList));\r
+                               if(res.size() == 1) {\r
+                                       Resource exp = res.iterator().next();\r
+                                       String text = graph.getRelatedValue(exp, SYSDYN.Expression_equation, Bindings.STRING);\r
+                                       return text;\r
+                               }\r
+                       }\r
+\r
+                       return null;\r
+                       \r
+               }\r
+\r
+               @Override\r
+               public void setValue(WriteGraph graph, Variable context, Object value) throws DatabaseException {\r
+                       \r
+                       if(value instanceof Variant) value = ((Variant)value).getValue();\r
+                       \r
+                       if(!(value instanceof String)) throw new DatabaseException("Unexpected value " + value + ", expected String");\r
+                       \r
+                       setValue(graph, context, value, Bindings.STRING);\r
+                       \r
+               }\r
+\r
+               @Override\r
+               public void setValue(WriteGraph graph, Variable context, Object value, Binding binding) throws DatabaseException {\r
+                       \r
+                       if(value instanceof Variant) value = ((Variant)value).getValue();\r
+                       \r
+                       if(!(value instanceof String)) throw new DatabaseException("Unexpected value " + value + ", expected String");\r
+\r
+                       Variable v = context.getParent(graph);\r
+                       \r
+                       Resource represents = v.getPossibleRepresents(graph);\r
+                       if(represents != null) {\r
+                               SysdynResource SYSDYN = SysdynResource.getInstance(graph);\r
+                               Collection<Resource> res = ListUtils.toList(graph, graph.getSingleObject(represents, SYSDYN.Variable_expressionList));\r
+                               if(res.size() == 1) {\r
+                                       Resource exp = res.iterator().next();\r
+                                       graph.claimLiteral(exp, SYSDYN.Expression_equation, value, Bindings.STRING);\r
+                               }\r
+                       }\r
+                       \r
+               }\r
+       \r
+       };\r
        \r
 \r
        @SCLValue(type = "VariableMap")\r
@@ -97,7 +164,12 @@ public class Functions {
                        \r
                        String property = context.getName(graph);\r
                        if(VALUE.equals(property))\r
-                               return new ValueIndexVariable(graph, context, name);\r
+                               if(name.startsWith("$")) {\r
+                                       Integer index = Integer.parseInt(name.substring(1));\r
+                                       return new ValueIndexVariableI(graph, context, index);\r
+                               } else {\r
+                                       return new ValueIndexVariable(graph, context, name);\r
+                               }\r
                        else if(VALUES.equals(property))\r
                                return new ValuesIndexVariable(graph, context, name);\r
                        else if(TIMES.equals(property))\r
diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/CustomMigrationStep.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/CustomMigrationStep.java
new file mode 100644 (file)
index 0000000..dce49fa
--- /dev/null
@@ -0,0 +1,58 @@
+package org.simantics.sysdyn.adapter;\r
+\r
+import org.eclipse.core.runtime.IProgressMonitor;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.Session;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.ObjectsWithType;\r
+import org.simantics.db.common.request.WriteRequest;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.migration.MigrationState;\r
+import org.simantics.db.layer0.migration.MigrationStateKeys;\r
+import org.simantics.db.layer0.migration.MigrationStep;\r
+import org.simantics.db.layer0.util.Layer0Utils;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.layer0.utils.direct.GraphUtils;\r
+import org.simantics.simulation.ontology.SimulationResource;\r
+import org.simantics.spreadsheet.resource.SpreadsheetResource;\r
+\r
+public class CustomMigrationStep implements MigrationStep {\r
+\r
+       @Override\r
+       public void applyTo(IProgressMonitor monitor, Session session, MigrationState state) throws DatabaseException {\r
+               \r
+               final Resource res = state.getProperty(MigrationStateKeys.CURRENT_RESOURCE);\r
+               \r
+               session.syncRequest(new WriteRequest() {\r
+\r
+                       @Override\r
+                       public void perform(WriteGraph graph) throws DatabaseException {\r
+\r
+                               Layer0 l0 = Layer0.getInstance(graph);\r
+                               SimulationResource SIMU = SimulationResource.getInstance(graph);\r
+\r
+                               for(Resource model : graph.syncRequest(new ObjectsWithType(res, l0.ConsistsOf, SIMU.Model))) {\r
+\r
+                                       Resource sheetExperiment = Layer0Utils.getPossibleChild(graph, model, "SheetExperiment");\r
+                                       if(sheetExperiment != null) return;\r
+       \r
+                                       SpreadsheetResource SHEET = SpreadsheetResource.getInstance(graph);\r
+                                       sheetExperiment = GraphUtils.create2(graph, SHEET.Experiment,\r
+                                                       l0.HasName, "SheetExperiment",\r
+                                                       l0.HasLabel, "Sheet Experiment",\r
+                                                       l0.PartOf, model);\r
+       \r
+                                       Resource sheetRun = GraphUtils.create2(graph, SHEET.Run,\r
+                                                       l0.HasName, "Default",\r
+                                                       l0.PartOf, sheetExperiment);\r
+                                                       \r
+\r
+                               }\r
+                               \r
+                       }\r
+                       \r
+               });\r
+               \r
+       }\r
+\r
+}\r
index 71ea423e1d9563618e40bd0160a5b5f5fb0144a1..3b05dd71791a48400589be5d09642d98dd958e61 100644 (file)
 package org.simantics.sysdyn.adapter;\r
 \r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-\r
 import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.common.utils.NameUtils;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.layer0.variable.Variable;\r
-import org.simantics.fmu.FMUControlJNI;\r
-import org.simantics.fmu.FMUJNIException;\r
-import org.simantics.simulation.experiment.ExperimentState;\r
-import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.manager.SysdynDataSet;\r
-import org.simantics.sysdyn.manager.SysdynGameExperiment;\r
-import org.simantics.sysdyn.manager.SysdynResult;\r
 \r
-public class ValueIndexVariable extends IndexVariable<double[]> {\r
+public class ValueIndexVariable extends ValueIndexVariableBase<double[]> {\r
 \r
        public ValueIndexVariable(ReadGraph graph, Variable parent, String indexes)\r
                        throws DatabaseException {\r
            super(graph, parent, indexes);\r
        }\r
-\r
-       public static double[] UNRESOLVED = new double[0];\r
        \r
        @Override\r
        public double[] getValue() {\r
-           if(experiment == null)\r
-               return UNRESOLVED;\r
-\r
-        Collection<SysdynResult> results = experiment.getActiveResults();\r
-               ArrayList<String> variableNames = getVariableNamesWithIndexNumbers();\r
-\r
-               double[] result = new double[variableNames.size()];\r
-               for(int i = 0; i < variableNames.size(); i++) {\r
-                   for(SysdynResult r : results) {            \r
-                       if(experiment instanceof SysdynGameExperiment) {\r
-                           Double d = ((SysdynGameExperiment)experiment).getCurrentValue(variableNames.get(i)); \r
-                           result[i] = d != null ? d : 0;\r
-                       } else {\r
-                           SysdynDataSet ds = r.getDataSet(variableNames.get(i));\r
-                           if(ds != null && ds.values != null && ds.values.length > 0) {\r
-                               result[i] =  ds.values[ds.values.length-1];\r
-                           } else {\r
-                               return UNRESOLVED;\r
-                           }\r
-                       }\r
-                   }\r
-               }\r
-               return result;\r
+               return getValueFull();\r
        }\r
-\r
-       @Override\r
-       public void setIndexedValue(WriteGraph graph, Object value)\r
-                       throws DatabaseException {\r
-               Variable var = parent.getParent(graph);\r
-               Resource resource = var.getRepresents(graph);\r
-               \r
-               if(!(value instanceof double[]) || resource == null)\r
-                       return;\r
-               \r
-               double[] values = (double[]) value;\r
-               \r
-               FMUControlJNI control = null;\r
-               if(experiment instanceof SysdynGameExperiment) { // Support only game experiments for now..\r
-                   \r
-                   SysdynGameExperiment exp = (SysdynGameExperiment)experiment;\r
-                   ExperimentState state = exp.getSysdynExperimentState();\r
-                   // Set value to control only if the simulation is running or stopped, not before initialization\r
-                   if(!(ExperimentState.RUNNING.equals(state) || ExperimentState.STOPPED.equals(state)))\r
-                       return;\r
-                   \r
-                   control = ((SysdynGameExperiment)this.experiment).getFMUControl();\r
-                   if(control == null) \r
-                       return;\r
-                       \r
-                       \r
-\r
-                       ArrayList<String> variableNames = getVariableNamesWithIndexNumbers();\r
-                       for(int i = 0; i < variableNames.size() && i < values.length; i++) {\r
-                               if(values[i] == Double.NaN)\r
-                                       continue;\r
-                               \r
-                               try {\r
-                                       String name = variableNames.get(i);\r
-                                       control.setRealValue(name, values[i]);\r
-                                       \r
-                                       // Set value for all referred variables in modules\r
-                                       SysdynResource sr = SysdynResource.getInstance(graph);\r
-                                       for(Resource dependency : graph.getObjects(resource, sr.Variable_isTailOf)) {\r
-                                               Resource head = graph.getPossibleObject(dependency, sr.Variable_HasHead);\r
-                                               Resource ref = graph.getPossibleObject(dependency, sr.Dependency_refersTo);\r
-                                               if(ref != null && head != null) {\r
-                                                       String module = "";\r
-                                                       if(name.indexOf(".") > 0)\r
-                                                               module = name.substring(0, name.lastIndexOf(".") + 1);\r
-                                                       String refName = module + NameUtils.getSafeName(graph, head) + "." + NameUtils.getSafeName(graph, ref);\r
-                                                       control.setRealValue(refName, values[i]);\r
-                                               } \r
-                                       }\r
-                               } catch (FMUJNIException e) {\r
-                               }\r
-                       }\r
-                       exp.updateSubscriptions();\r
-               }\r
-       }\r
-\r
+       \r
 }\r
diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableBase.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableBase.java
new file mode 100644 (file)
index 0000000..83bfbba
--- /dev/null
@@ -0,0 +1,110 @@
+package org.simantics.sysdyn.adapter;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.utils.NameUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.fmu.FMUControlJNI;\r
+import org.simantics.fmu.FMUJNIException;\r
+import org.simantics.simulation.experiment.ExperimentState;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.manager.SysdynDataSet;\r
+import org.simantics.sysdyn.manager.SysdynGameExperiment;\r
+import org.simantics.sysdyn.manager.SysdynResult;\r
+\r
+abstract public class ValueIndexVariableBase<T> extends IndexVariable<T> {\r
+\r
+       public ValueIndexVariableBase(ReadGraph graph, Variable parent, String indexes)\r
+                       throws DatabaseException {\r
+           super(graph, parent, indexes);\r
+       }\r
+\r
+       public static double[] UNRESOLVED = new double[0];\r
+       \r
+       public double[] getValueFull() {\r
+           if(experiment == null)\r
+               return UNRESOLVED;\r
+\r
+        Collection<SysdynResult> results = experiment.getActiveResults();\r
+               ArrayList<String> variableNames = getVariableNamesWithIndexNumbers();\r
+\r
+               double[] result = new double[variableNames.size()];\r
+               for(int i = 0; i < variableNames.size(); i++) {\r
+                   for(SysdynResult r : results) {            \r
+                       if(experiment instanceof SysdynGameExperiment) {\r
+                           Double d = ((SysdynGameExperiment)experiment).getCurrentValue(variableNames.get(i)); \r
+                           result[i] = d != null ? d : 0;\r
+                       } else {\r
+                           SysdynDataSet ds = r.getDataSet(variableNames.get(i));\r
+                           if(ds != null && ds.values != null && ds.values.length > 0) {\r
+                               result[i] =  ds.values[ds.values.length-1];\r
+                           } else {\r
+                               return UNRESOLVED;\r
+                           }\r
+                       }\r
+                   }\r
+               }\r
+               return result;\r
+       }\r
+\r
+       @Override\r
+       public void setIndexedValue(WriteGraph graph, Object value)\r
+                       throws DatabaseException {\r
+               Variable var = parent.getParent(graph);\r
+               Resource resource = var.getRepresents(graph);\r
+               \r
+               if(!(value instanceof double[]) || resource == null)\r
+                       return;\r
+               \r
+               double[] values = (double[]) value;\r
+               \r
+               FMUControlJNI control = null;\r
+               if(experiment instanceof SysdynGameExperiment) { // Support only game experiments for now..\r
+                   \r
+                   SysdynGameExperiment exp = (SysdynGameExperiment)experiment;\r
+                   ExperimentState state = exp.getSysdynExperimentState();\r
+                   // Set value to control only if the simulation is running or stopped, not before initialization\r
+                   if(!(ExperimentState.RUNNING.equals(state) || ExperimentState.STOPPED.equals(state)))\r
+                       return;\r
+                   \r
+                   control = ((SysdynGameExperiment)this.experiment).getFMUControl();\r
+                   if(control == null) \r
+                       return;\r
+                       \r
+                       \r
+\r
+                       ArrayList<String> variableNames = getVariableNamesWithIndexNumbers();\r
+                       for(int i = 0; i < variableNames.size() && i < values.length; i++) {\r
+                               if(values[i] == Double.NaN)\r
+                                       continue;\r
+                               \r
+                               try {\r
+                                       String name = variableNames.get(i);\r
+                                       control.setRealValue(name, values[i]);\r
+                                       \r
+                                       // Set value for all referred variables in modules\r
+                                       SysdynResource sr = SysdynResource.getInstance(graph);\r
+                                       for(Resource dependency : graph.getObjects(resource, sr.Variable_isTailOf)) {\r
+                                               Resource head = graph.getPossibleObject(dependency, sr.Variable_HasHead);\r
+                                               Resource ref = graph.getPossibleObject(dependency, sr.Dependency_refersTo);\r
+                                               if(ref != null && head != null) {\r
+                                                       String module = "";\r
+                                                       if(name.indexOf(".") > 0)\r
+                                                               module = name.substring(0, name.lastIndexOf(".") + 1);\r
+                                                       String refName = module + NameUtils.getSafeName(graph, head) + "." + NameUtils.getSafeName(graph, ref);\r
+                                                       control.setRealValue(refName, values[i]);\r
+                                               } \r
+                                       }\r
+                               } catch (FMUJNIException e) {\r
+                               }\r
+                       }\r
+                       exp.updateSubscriptions();\r
+               }\r
+       }\r
+\r
+}\r
diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableI.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableI.java
new file mode 100644 (file)
index 0000000..b50195b
--- /dev/null
@@ -0,0 +1,23 @@
+package org.simantics.sysdyn.adapter;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.variable.Variable;\r
+\r
+public class  ValueIndexVariableI extends ValueIndexVariableBase<Double> {\r
+\r
+       final int index;\r
+       \r
+       public ValueIndexVariableI(ReadGraph graph, Variable parent, int index) throws DatabaseException {\r
+           super(graph, parent, "");\r
+           this.index = index;\r
+       }\r
+       \r
+       @Override\r
+       public Double getValue() {\r
+               double[] array = getValueFull();\r
+               if(array == null || array.length < index+1) return Double.NaN;\r
+               return array[0];\r
+       }\r
+       \r
+}\r
index 7a87c0b50c43e1a78d9908efad9c80f36719401e..7a27fd24b3404db12ec433ae0e87f26c19052324 100644 (file)
@@ -68,8 +68,10 @@ public class Sheet extends org.simantics.sysdyn.representation.Variable {
                 String name = child.getName(g);\r
                 try {\r
                     SpreadsheetUtils.decodeCellAbsolute(name);\r
-                    Variant value = child.getPropertyValue(g, SheetVariables.CONTENT, Bindings.VARIANT);\r
-                    newCells.put(name, value.getValue());\r
+                    Object value = child.getPropertyValue(g, SheetVariables.CONTENT);\r
+                    if(value instanceof Variant) {\r
+                        newCells.put(name, ((Variant)value).getValue());\r
+                    }\r
                 } catch (CellParseException e) {\r
                 } catch (MissingVariableException e) {\r
                     System.out.println("missing content for: " + name);\r
index cc79fda73c01d03c9b05b8236055a7c6a185f9fe..360ffe1b8da8b86381c3fdd52337e14c694a64dc 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2011, 2014 Association for Decentralized Information Management in\r
  * Industry THTH ry.\r
  * All rights reserved. This program and the accompanying materials\r
  * are made available under the terms of the Eclipse Public License v1.0\r
@@ -45,15 +45,24 @@ public class IndexUtils {
                if(variable.getArrayIndexes() == null || range == null)\r
                        return "";\r
                ArrayList<Enumeration> enumerations = variable.getArrayIndexes();\r
-               StringTokenizer st = new StringTokenizer(range, "[]:,", true);\r
+               StringTokenizer st = new StringTokenizer(range, "{}[]:,", true);\r
                int index = 0;\r
+               boolean insideCurlyBrackets = false;\r
                while(st.hasMoreTokens()) {\r
                        String rangeToken = st.nextToken().trim();\r
                        if(rangeToken.matches("[\\[\\]:]")) {\r
                                sb.append(rangeToken);\r
+                       } else if(rangeToken.matches("[\\{]")) {\r
+                               sb.append(rangeToken);\r
+                               insideCurlyBrackets = true;\r
+                       } else if(rangeToken.matches("[\\}]")) {\r
+                               sb.append(rangeToken);\r
+                               insideCurlyBrackets = false;\r
                        } else if (rangeToken.equals(",")) {\r
                            sb.append(rangeToken);\r
-                           index++;\r
+                           if (!insideCurlyBrackets) {\r
+                               index++;\r
+                           }\r
                        } else if(index < enumerations.size()) {\r
                            if(rangeToken.equals(enumerations.get(index).getName())) {\r
                                sb.append(":");\r
index b3e3960975acb0bd587829d36c53fa6bdf3cb2b8..725516d3b043cbc3690d9a9a707e203738822793 100644 (file)
@@ -550,5 +550,33 @@ public class DocumentationUtils {
                }\r
        \r
     }\r
+\r
+    public static org.simantics.db.layer0.variable.Variable lastValue2(ReadGraph graph, org.simantics.db.layer0.variable.Variable run, String path) throws DatabaseException {\r
+       \r
+       if(run == null) return null;\r
+\r
+       org.simantics.db.layer0.variable.Variable v = run.browsePossible(graph, "/" + path);\r
+       if(v == null) return null;\r
+\r
+       org.simantics.db.layer0.variable.Variable p = v.browsePossible(graph, "#value#$0");\r
+       if(p == null) return null;\r
+       \r
+       return p;\r
+       \r
+    }\r
+\r
+    public static org.simantics.db.layer0.variable.Variable equation(ReadGraph graph, org.simantics.db.layer0.variable.Variable run, String path) throws DatabaseException {\r
+\r
+       if(run == null) return null;\r
+       \r
+       org.simantics.db.layer0.variable.Variable v = run.browsePossible(graph, "/" + path);\r
+       if(v == null) return null;\r
+\r
+       org.simantics.db.layer0.variable.Variable p = v.browsePossible(graph, "#equation");\r
+       if(p == null) return null;\r
+       \r
+       return p;\r
+       \r
+    }\r
     \r
 }\r
index cfb10396359da444f686df4fd2f01eb1f4a4880f..bd3d9095ea875db5c5a90062a949903b18e80c12 100644 (file)
@@ -23,6 +23,7 @@ import org.simantics.db.ReadGraph;
 import org.simantics.db.Resource;\r
 import org.simantics.db.common.utils.ListUtils;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.exception.NoSingleResultException;\r
 import org.simantics.db.exception.ServiceException;\r
 import org.simantics.db.request.Read;\r
 import org.simantics.layer0.Layer0;\r
@@ -283,8 +284,13 @@ public class LoopUtils {
                                }\r
                                skipBackwardFlows = true;\r
                                \r
-                               Resource dependencyConnection = graph.getSingleObject(dependency, mod.ConnectionToDiagramConnection);\r
-                               String polarity = (String)graph.getPossibleRelatedValue(dependencyConnection, sr.DependencyConnection_polarity, Bindings.STRING);\r
+                               Resource dependencyConnection;\r
+                               try {\r
+                                       dependencyConnection = graph.getSingleObject(dependency, mod.ConnectionToDiagramConnection);\r
+                               } catch (NoSingleResultException e) {\r
+                                       return LoopType.UNDEFINED;\r
+                               }\r
+                           String polarity = (String)graph.getPossibleRelatedValue(dependencyConnection, sr.DependencyConnection_polarity, Bindings.STRING);\r
                                if ("-".equals(polarity)) {\r
                                        oddNumberOfNegativeCausalities = !oddNumberOfNegativeCausalities;\r
                                } else if (polarity != null \r
index 6a77c80b509132ab802cf44cc10f0c6450c816f0..e3212abadf01480148dd62e73eac509b6e5ca839 100644 (file)
@@ -150,6 +150,15 @@ public class ModelUtils {
                     DOC.HasReportFactory, report,\r
                     l0.PartOf, model);\r
 \r
+            Resource sheetExperiment = GraphUtils.create2(g, SHEET.Experiment,\r
+                    l0.HasName, "SheetExperiment",\r
+                    l0.HasLabel, "Sheet Experiment",\r
+                    l0.PartOf, model);\r
+\r
+            Resource sheetRun = GraphUtils.create2(g, SHEET.Run,\r
+                    l0.HasName, "Default",\r
+                    l0.PartOf, sheetExperiment);\r
+\r
             ProjectResource PROJ = ProjectResource.getInstance(g);\r
             for(Resource dep : g.getObjects(library, l0.IsLinkedTo)) {\r
                 if(g.isInstanceOf(dep, PROJ.NamespaceRequirement)) {\r
index f53920c9f126186910190a1bedbaf4a71d7dfabd..cb18b8682bafa6cc414a992296754ee82966d92f 100644 (file)
@@ -17,6 +17,7 @@ import org.simantics.db.exception.DatabaseException;
 import org.simantics.diagram.profile.Profiles;\r
 import org.simantics.diagram.stubs.DiagramResource;\r
 import org.simantics.layer0.Layer0;\r
+import org.simantics.simulation.ontology.SimulationResource;\r
 import org.simantics.sysdyn.SysdynResource;\r
 \r
 public class ProfileEntries  {\r
@@ -43,6 +44,12 @@ public class ProfileEntries  {
 //            public void perform(WriteGraph graph) throws DatabaseException {\r
 //                DiagramResource DIA = DiagramResource.getInstance(graph);\r
                 graph.claim(model, DIA.HasActiveProfile, defaultProfile);\r
+                SimulationResource SIMU = SimulationResource.getInstance(graph);\r
+                graph.claim(defaultProfile, SIMU.IsActive, null, sr.Profiles_IssueWarnings);\r
+                graph.claim(defaultProfile, SIMU.IsActive, null, sr.Profiles_ShadowVisualizations);\r
+                graph.claim(model, DIA.HasActiveProfile, simulationPlaybackProfile);\r
+                graph.claim(simulationPlaybackProfile, SIMU.IsActive, null, sr.Profiles_SimulationPlaybackColours);\r
+                \r
 //            }\r
 //        });\r
 \r