]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
New expression types
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 11 Jan 2010 14:51:11 +0000 (14:51 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 11 Jan 2010 14:51:11 +0000 (14:51 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@13475 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn/src/org/simantics/sysdyn/representation/SysdynSchema.java
org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/ConstantExpression.java [new file with mode: 0644]
org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/DelayExpression.java [new file with mode: 0644]
org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/LookupExpression.java [new file with mode: 0644]
org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/ParameterExpression.java
org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/WithLookupExpression.java [new file with mode: 0644]

index b2294c38a7be917f8e532f4912c13cd52321c277..393190ba0d66fbec99a202c98cee59ee30ebc293 100644 (file)
@@ -4,9 +4,12 @@ import org.simantics.db.ReadGraph;
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.objmap.schema.MappingSchemas;\r
 import org.simantics.objmap.schema.SimpleSchema;\r
+import org.simantics.sysdyn.representation.expressions.ConstantExpression;\r
+import org.simantics.sysdyn.representation.expressions.LookupExpression;\r
 import org.simantics.sysdyn.representation.expressions.NormalExpression;\r
 import org.simantics.sysdyn.representation.expressions.ParameterExpression;\r
 import org.simantics.sysdyn.representation.expressions.StockExpression;\r
+import org.simantics.sysdyn.representation.expressions.WithLookupExpression;\r
 \r
 public class SysdynSchema extends SimpleSchema {\r
     \r
@@ -22,6 +25,10 @@ public class SysdynSchema extends SimpleSchema {
             addLinkType(MappingSchemas.fromAnnotations(g, NormalExpression.class));\r
             addLinkType(MappingSchemas.fromAnnotations(g, ParameterExpression.class));\r
             addLinkType(MappingSchemas.fromAnnotations(g, StockExpression.class));\r
+            addLinkType(MappingSchemas.fromAnnotations(g, ConstantExpression.class));\r
+            addLinkType(MappingSchemas.fromAnnotations(g, WithLookupExpression.class));\r
+            addLinkType(MappingSchemas.fromAnnotations(g, LookupExpression.class));\r
+            \r
             \r
         } catch (DatabaseException e) {\r
             // TODO Auto-generated catch block\r
diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/ConstantExpression.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/ConstantExpression.java
new file mode 100644 (file)
index 0000000..86f26e1
--- /dev/null
@@ -0,0 +1,18 @@
+package org.simantics.sysdyn.representation.expressions;\r
+\r
+import org.simantics.objmap.annotations.GraphType;\r
+import org.simantics.objmap.annotations.RelatedValue;\r
+import org.simantics.sysdyn.representation.Variable;\r
+\r
+@GraphType("http://www.simantics.org/Sysdyn#ConstantExpression")\r
+public class ConstantExpression extends Expression {\r
+    \r
+    @RelatedValue("http://www.simantics.org/Sysdyn#HasEquation")\r
+    private String equation;\r
+    \r
+    @Override\r
+    public String getDeclaration(Variable variable) {\r
+        return "    constant " + variable.getType() + " " + variable.getName() + " = " + equation + ";\n";\r
+    }\r
+\r
+}\r
diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/DelayExpression.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/DelayExpression.java
new file mode 100644 (file)
index 0000000..ae090ef
--- /dev/null
@@ -0,0 +1,5 @@
+package org.simantics.sysdyn.representation.expressions;\r
+\r
+public class DelayExpression {\r
+\r
+}\r
diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/LookupExpression.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/LookupExpression.java
new file mode 100644 (file)
index 0000000..65f1944
--- /dev/null
@@ -0,0 +1,5 @@
+package org.simantics.sysdyn.representation.expressions;\r
+\r
+public class LookupExpression {\r
+\r
+}\r
index 0c541fb660d30480b69e0dc1c64fbbf00bab8826..26d5d09fa5cd5b8baeead303d323f855a9cfadd8 100644 (file)
@@ -12,6 +12,6 @@ public class ParameterExpression extends Expression {
     \r
     @Override\r
     public String getDeclaration(Variable variable) {\r
-        return "    " + variable.getType() + " " + variable.getName() + " = " + equation + ";\n";\r
+        return "    parameter " + variable.getType() + " " + variable.getName() + " = " + equation + ";\n";\r
     }\r
 }\r
diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/WithLookupExpression.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/WithLookupExpression.java
new file mode 100644 (file)
index 0000000..e337fa6
--- /dev/null
@@ -0,0 +1,5 @@
+package org.simantics.sysdyn.representation.expressions;\r
+\r
+public class WithLookupExpression {\r
+\r
+}\r