int closing = expression.indexOf(')', matcher.end());\r
String parameters = expression.substring(matcher.end(), closing);\r
parameters = parameters.replaceAll("\\*", ".*");\r
+ parameters = parameters.replaceAll("/", "./");\r
+ parameters = parameters.replaceAll("\\+", ".+");\r
+ parameters = parameters.replaceAll("-", ".-");\r
result.append(parameters);\r
offset = closing;\r
}\r
import org.simantics.sysdyn.modelImport.model.Auxiliary;\r
import org.simantics.sysdyn.modelImport.model.Variable;\r
import org.simantics.sysdyn.modelImport.model.Stock;\r
-import org.simantics.sysdyn.modelImport.model.expression.IntegralExpression;\r
+import org.simantics.sysdyn.modelImport.model.expression.Expression;\r
\r
public class SketchVariable extends SketchElement {\r
\r
}\r
\r
Variable var;\r
- if ((variable.getExpression() instanceof IntegralExpression)) {\r
+ \r
+ Expression expr = variable.getExpression();\r
+ if (expr != null && expr.getExpressionTypeString().equals("StockExpression"))\r
var = new Stock();\r
- }\r
else\r
var = new Auxiliary();\r
+ \r
var.setDimensions(getDimensions());\r
\r
return variable.initVariable(var);\r
public Resource getExpressionType(ReadGraph graph) {\r
return SysdynResource.getInstance(graph).DelayExpression;\r
}\r
+ \r
+ @Override\r
+ public String getExpressionTypeString() {\r
+ return "DelayExpression";\r
+ }\r
}\r
return subExpressions.get(0).expression.getExpressionType(graph);\r
}\r
\r
+ @Override\r
+ public String getExpressionTypeString() {\r
+ return subExpressions.get(0).expression.getExpressionTypeString();\r
+ }\r
+ \r
@Override\r
public Resource getResource() {\r
return subExpressions.get(0).expression.getResource();\r
}\r
\r
public abstract Resource getExpressionType(ReadGraph graph);\r
+ \r
+ public abstract String getExpressionTypeString();\r
\r
@Override\r
public Resource getResource() {\r
public Resource getExpressionType(ReadGraph graph) {\r
return SysdynResource.getInstance(graph).StockExpression;\r
}\r
+ \r
+ @Override\r
+ public String getExpressionTypeString() {\r
+ return "StockExpression";\r
+ }\r
}\r
public Resource getExpressionType(ReadGraph graph) {\r
return SysdynResource.getInstance(graph).WithLookupExpression;\r
}\r
+ \r
+ @Override\r
+ public String getExpressionTypeString() {\r
+ return "WithLookupExpression";\r
+ }\r
\r
}\r
\r
@Override\r
public Resource getExpressionType(ReadGraph graph) {\r
- return SysdynResource.getInstance(graph).NormalExpression;\r
+ try {\r
+ Double.parseDouble(expression);\r
+ return SysdynResource.getInstance(graph).ParameterExpression;\r
+ }\r
+ catch (NumberFormatException e) {\r
+ return SysdynResource.getInstance(graph).NormalExpression;\r
+ }\r
+ }\r
+ \r
+ @Override\r
+ public String getExpressionTypeString() {\r
+ try {\r
+ Double.parseDouble(expression);\r
+ return "ParameterExpression";\r
+ }\r
+ catch (NumberFormatException e) {\r
+ return "NormalExpression";\r
+ }\r
}\r
}\r