From: lempinen Date: Mon, 11 Jan 2010 14:51:11 +0000 (+0000) Subject: New expression types X-Git-Tag: simantics-1.0~107 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=849b17d0416e1a5d245ad4d5a14a90e5b623fd49;p=simantics%2Fsysdyn.git New expression types git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@13475 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/SysdynSchema.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/SysdynSchema.java index b2294c38..393190ba 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/SysdynSchema.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/SysdynSchema.java @@ -4,9 +4,12 @@ import org.simantics.db.ReadGraph; import org.simantics.db.exception.DatabaseException; import org.simantics.objmap.schema.MappingSchemas; import org.simantics.objmap.schema.SimpleSchema; +import org.simantics.sysdyn.representation.expressions.ConstantExpression; +import org.simantics.sysdyn.representation.expressions.LookupExpression; import org.simantics.sysdyn.representation.expressions.NormalExpression; import org.simantics.sysdyn.representation.expressions.ParameterExpression; import org.simantics.sysdyn.representation.expressions.StockExpression; +import org.simantics.sysdyn.representation.expressions.WithLookupExpression; public class SysdynSchema extends SimpleSchema { @@ -22,6 +25,10 @@ public class SysdynSchema extends SimpleSchema { addLinkType(MappingSchemas.fromAnnotations(g, NormalExpression.class)); addLinkType(MappingSchemas.fromAnnotations(g, ParameterExpression.class)); addLinkType(MappingSchemas.fromAnnotations(g, StockExpression.class)); + addLinkType(MappingSchemas.fromAnnotations(g, ConstantExpression.class)); + addLinkType(MappingSchemas.fromAnnotations(g, WithLookupExpression.class)); + addLinkType(MappingSchemas.fromAnnotations(g, LookupExpression.class)); + } catch (DatabaseException e) { // TODO Auto-generated catch block 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 index 00000000..86f26e1c --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/ConstantExpression.java @@ -0,0 +1,18 @@ +package org.simantics.sysdyn.representation.expressions; + +import org.simantics.objmap.annotations.GraphType; +import org.simantics.objmap.annotations.RelatedValue; +import org.simantics.sysdyn.representation.Variable; + +@GraphType("http://www.simantics.org/Sysdyn#ConstantExpression") +public class ConstantExpression extends Expression { + + @RelatedValue("http://www.simantics.org/Sysdyn#HasEquation") + private String equation; + + @Override + public String getDeclaration(Variable variable) { + return " constant " + variable.getType() + " " + variable.getName() + " = " + equation + ";\n"; + } + +} 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 index 00000000..ae090efc --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/DelayExpression.java @@ -0,0 +1,5 @@ +package org.simantics.sysdyn.representation.expressions; + +public class DelayExpression { + +} 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 index 00000000..65f19449 --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/LookupExpression.java @@ -0,0 +1,5 @@ +package org.simantics.sysdyn.representation.expressions; + +public class LookupExpression { + +} diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/ParameterExpression.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/ParameterExpression.java index 0c541fb6..26d5d09f 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/ParameterExpression.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/ParameterExpression.java @@ -12,6 +12,6 @@ public class ParameterExpression extends Expression { @Override public String getDeclaration(Variable variable) { - return " " + variable.getType() + " " + variable.getName() + " = " + equation + ";\n"; + return " parameter " + variable.getType() + " " + variable.getName() + " = " + equation + ";\n"; } } 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 index 00000000..e337fa66 --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/WithLookupExpression.java @@ -0,0 +1,5 @@ +package org.simantics.sysdyn.representation.expressions; + +public class WithLookupExpression { + +}