import org.simantics.db.WriteGraph;\r
import org.simantics.db.common.request.WriteRequest;\r
import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.sysdyn.modelImport.MdlParser;\r
import org.simantics.sysdyn.modelImport.MdlParser2;\r
-import org.simantics.sysdyn.modelImport.model.Model;\r
import org.simantics.sysdyn.modelImport.model.Model2;\r
import org.simantics.sysdyn.modelImport.model.WriteContext;\r
import org.simantics.sysdyn.ui.Activator;\r
Activator.getDefault().getPreferenceStore().setValue(IMPORTMDLTPATH, (new File(selected)).getParent());\r
\r
// Convert Vensim model to Simantics SysDyn format using MdlParser\r
- MdlParser2 parser = new MdlParser2();\r
- final Model2 model = parser.parse(file);\r
+ final Model2 model = MdlParser2.parse(file);\r
\r
SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
\r
import org.simantics.db.WriteGraph;\r
import org.simantics.db.common.request.WriteRequest;\r
import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.sysdyn.modelImport.MdlParser;\r
-import org.simantics.sysdyn.modelImport.model.Model;\r
+import org.simantics.sysdyn.modelImport.MdlParser2;\r
+import org.simantics.sysdyn.modelImport.model.Model2;\r
+import org.simantics.sysdyn.modelImport.model.WriteContext;\r
import org.simantics.ui.SimanticsUI;\r
\r
public class WizardMdlImportPage extends WizardPage{\r
\r
File file = new File(selected);\r
\r
- final Model model = MdlParser.parse(file);\r
+ final Model2 model = MdlParser2.parse(file);\r
\r
SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
- model.write(graph, project);\r
+ model.write(graph, project, new WriteContext());\r
}\r
});\r
\r
\r
import org.simantics.sysdyn.modelImport.MdlUtils.CommentIcon;\r
import org.simantics.sysdyn.modelImport.mdl.MdlModel;\r
-import org.simantics.sysdyn.modelImport.mdl.Sketch2;\r
+import org.simantics.sysdyn.modelImport.mdl.Sketch;\r
import org.simantics.sysdyn.modelImport.mdl.SketchComment;\r
import org.simantics.sysdyn.modelImport.mdl.SketchConnection;\r
import org.simantics.sysdyn.modelImport.mdl.SketchElement;\r
import org.simantics.sysdyn.modelImport.mdl.SketchObject;\r
import org.simantics.sysdyn.modelImport.mdl.SketchValve;\r
import org.simantics.sysdyn.modelImport.mdl.SketchVariable;\r
+import org.simantics.sysdyn.modelImport.mdl.Subscript2;\r
import org.simantics.sysdyn.modelImport.model.Model2;\r
-import org.simantics.sysdyn.modelImport.model.element.Auxiliary2;\r
-import org.simantics.sysdyn.modelImport.model.element.Cloud2;\r
-import org.simantics.sysdyn.modelImport.model.element.Comment2;\r
-import org.simantics.sysdyn.modelImport.model.element.Connection2;\r
-import org.simantics.sysdyn.modelImport.model.element.Element2;\r
-import org.simantics.sysdyn.modelImport.model.element.Shadow2;\r
-import org.simantics.sysdyn.modelImport.model.element.Stock2;\r
-import org.simantics.sysdyn.modelImport.model.element.Valve2;\r
+import org.simantics.sysdyn.modelImport.model.element.Auxiliary;\r
+import org.simantics.sysdyn.modelImport.model.element.Cloud;\r
+import org.simantics.sysdyn.modelImport.model.element.Comment;\r
+import org.simantics.sysdyn.modelImport.model.element.Connection;\r
+import org.simantics.sysdyn.modelImport.model.element.Element;\r
+import org.simantics.sysdyn.modelImport.model.element.Shadow;\r
+import org.simantics.sysdyn.modelImport.model.element.Stock;\r
+import org.simantics.sysdyn.modelImport.model.element.Valve;\r
import org.simantics.sysdyn.modelImport.model.expression.IntegralExpression;\r
-import org.simantics.sysdyn.modelImport.model.support.Subscript2;\r
-import org.simantics.sysdyn.modelImport.model.support.Variable2;\r
+import org.simantics.sysdyn.modelImport.model.support.Variable;\r
\r
public class MdlParser2 {\r
\r
\r
// do this in several passes\r
\r
- HashMap<Variable2, Element2> variableToElement = new HashMap<Variable2, Element2>();\r
+ HashMap<Variable, Element> variableToElement = new HashMap<Variable, Element>();\r
ArrayList<SketchVariable> shadows = new ArrayList<SketchVariable>();\r
\r
for (Subscript2 ss : mdl.getSubscripts()) {\r
}\r
\r
// add sketch labels and independent elements\r
- for (Sketch2 sketch : mdl.getSketches()) {\r
+ for (Sketch sketch : mdl.getSketches()) {\r
sketch.setEdges();\r
\r
sketch.hOffset = 0;\r
sketch.vOffset = 0 - sketch.topEdge + 10 + offset;\r
\r
- model.addElement(new Comment2(0, offset, -1, -1, sketch.getName()));\r
+ model.addElement(new Comment(0, offset, -1, -1, sketch.getName()));\r
\r
for (SketchComment comment : sketch.getComments()) {\r
if (comment.isInputOutput()) {\r
continue;\r
}\r
\r
- Element2 modelElement = comment.getModelElement(sketch.hOffset, sketch.vOffset);\r
+ Element modelElement = comment.getModelElement(sketch.hOffset, sketch.vOffset);\r
model.addElement(modelElement);\r
sketch.elements.put(comment.getId(), modelElement);\r
}\r
\r
for (SketchValve valve : sketch.getValves()) {\r
- Element2 modelElement = valve.getModelElement(sketch.hOffset, sketch.vOffset);\r
+ Element modelElement = valve.getModelElement(sketch.hOffset, sketch.vOffset);\r
model.addElement(modelElement);\r
sketch.elements.put(valve.getId(), modelElement);\r
sketch.elements.put(valve.getAttachedVariable().getId(), modelElement);\r
continue;\r
}\r
\r
- Element2 modelElement = variable.getModelElement(sketch.hOffset, sketch.vOffset);\r
+ Element modelElement = variable.getModelElement(sketch.hOffset, sketch.vOffset);\r
model.addElement(modelElement);\r
sketch.elements.put(variable.getId(), modelElement);\r
variableToElement.put(variable.getVariable(), modelElement);\r
}\r
\r
// add dependent elements\r
- for (Sketch2 sketch : mdl.getSketches()) {\r
+ for (Sketch sketch : mdl.getSketches()) {\r
for (SketchVariable variable : sketch.getVariables()) {\r
if (!variable.allowsIn()) {\r
// the variable is a shadow variable\r
- Element2 original = variableToElement.get(variable.getVariable());\r
+ Element original = variableToElement.get(variable.getVariable());\r
if (original == null) {\r
System.err.println("original not found");\r
continue;\r
}\r
- Shadow2 modelElement = new Shadow2(\r
+ Shadow modelElement = new Shadow(\r
variable.getSysdyndX() + sketch.hOffset, \r
variable.getSysdyndY() + sketch.vOffset, \r
variable.getSysdynWidth(),\r
}\r
\r
for (SketchConnection connection : sketch.getConnections()) {\r
- Element2 head = sketch.elements.get(connection.getTo());\r
- Element2 tail = sketch.elements.get(connection.getFrom());\r
- Connection2 c = connection.getWriteableConnection(head, tail, sketch.vOffset);\r
+ Element head = sketch.elements.get(connection.getTo());\r
+ Element tail = sketch.elements.get(connection.getFrom());\r
+ Connection c = connection.getWriteableConnection(head, tail, sketch.vOffset);\r
if (c != null) {\r
model.addConnection(c);\r
}\r
continue;\r
}\r
\r
- Variable2 var = MdlUtils.getPossibleVariable(str, category);\r
+ Variable var = MdlUtils.getPossibleVariable(str, category);\r
if (var != null) {\r
mdl.addVariable(var, category);\r
continue;\r
}\r
\r
- Variable2 ss = MdlUtils.getPossibleSubscriptVariable(str, category, mdl);\r
+ Variable ss = MdlUtils.getPossibleSubscriptVariable(str, category, mdl);\r
if (ss != null) {\r
- Variable2 original = mdl.getVariable(ss.getName());\r
+ Variable original = mdl.getVariable(ss.getName());\r
if (original == null) {\r
mdl.addVariable(ss, category);\r
}\r
continue;\r
}\r
\r
- Variable2 lu = MdlUtils.getPossibleLookUpVariable(str, category);\r
+ Variable lu = MdlUtils.getPossibleLookUpVariable(str, category);\r
if (lu != null) {\r
System.err.println("found lookup variable "+lu.getName());\r
continue;\r
}\r
\r
- Variable2 plain = MdlUtils.getPossibleNoExpressionVariable(str);\r
+ Variable plain = MdlUtils.getPossibleNoExpressionVariable(str);\r
if (plain != null) {\r
System.err.println("found plain variable "+plain.getName());\r
continue;\r
\r
private static String parseSketches(BufferedReader reader, String line, MdlModel mdl) \r
throws IOException {\r
- Sketch2 sketch = null;\r
+ Sketch sketch = null;\r
\r
do {\r
if (line.isEmpty())\r
SketchObject so;\r
\r
if (line.startsWith(SKETCH_START)) {\r
- sketch = new Sketch2();\r
+ sketch = new Sketch();\r
mdl.addSketch(sketch);\r
}\r
else if (line.startsWith(SKETCH_VERSION)) {\r
import org.simantics.sysdyn.modelImport.mdl.SketchElement;\r
import org.simantics.sysdyn.modelImport.mdl.SketchValve;\r
import org.simantics.sysdyn.modelImport.mdl.SketchVariable;\r
-import org.simantics.sysdyn.modelImport.model.element.Valve2.TextPosition;\r
+import org.simantics.sysdyn.modelImport.mdl.Subscript2;\r
+import org.simantics.sysdyn.modelImport.model.element.Valve.TextPosition;\r
import org.simantics.sysdyn.modelImport.model.expression.DelayExpression;\r
import org.simantics.sysdyn.modelImport.model.expression.IExpression;\r
import org.simantics.sysdyn.modelImport.model.expression.IntegralExpression;\r
import org.simantics.sysdyn.modelImport.model.expression.NormalExpression;\r
import org.simantics.sysdyn.modelImport.model.expression.SubscriptExpression;\r
import org.simantics.sysdyn.modelImport.model.support.Range;\r
-import org.simantics.sysdyn.modelImport.model.support.Subscript2;\r
-import org.simantics.sysdyn.modelImport.model.support.Variable2;\r
+import org.simantics.sysdyn.modelImport.model.support.Variable;\r
\r
public class MdlUtils {\r
\r
private static final int variableUnit = 3;\r
private static final int variableDesc = 4;\r
\r
- public static Variable2 getPossibleVariable(String line, String category) {\r
+ public static Variable getPossibleVariable(String line, String category) {\r
Matcher matcher = Pattern.compile(variablePattern).matcher(line);\r
\r
if (!matcher.matches()) {\r
}\r
String description = matcher.group(variableDesc);\r
\r
- return new Variable2(name, expression, unit, range, description);\r
+ return new Variable(name, expression, unit, range, description);\r
}\r
\r
// a subscript variable is a variable that has a different equation\r
private static final int subscriptVariableUnit = 4;\r
private static final int subscriptVariableDesc = 5;\r
\r
- public static Variable2 getPossibleSubscriptVariable(String line, String category, MdlModel mdl) {\r
+ public static Variable getPossibleSubscriptVariable(String line, String category, MdlModel mdl) {\r
Matcher matcher = Pattern.compile(subscriptVariablePattern).matcher(line);\r
\r
if (!matcher.matches()) {\r
}\r
String description = matcher.group(subscriptVariableDesc);\r
\r
- return new Variable2(name, e, unit, range, description);\r
+ return new Variable(name, e, unit, range, description);\r
}\r
\r
private static final String LOOKUP_NAME =\r
private static final int lookupVariableUnit = 7;\r
private static final int lookupVariableDesc = 8;\r
\r
- public static Variable2 getPossibleLookUpVariable(String line, String category) {\r
+ public static Variable getPossibleLookUpVariable(String line, String category) {\r
Matcher matcher = Pattern.compile(lookupVariablePattern).matcher(line);\r
\r
if (!matcher.matches()) {\r
}\r
String description = matcher.group(lookupVariableDesc);\r
\r
- return new Variable2(name, e, unit, range, description);\r
+ return new Variable(name, e, unit, range, description);\r
}\r
\r
public static final String NO_EXP_PATTERN = \r
private static final int noExpVariableUnit = 2;\r
private static final int noExpVariableDesc = 3;\r
\r
- public static Variable2 getPossibleNoExpressionVariable(String line) {\r
+ public static Variable getPossibleNoExpressionVariable(String line) {\r
Matcher matcher = Pattern.compile(noExpressionVariablePattern).matcher(line);\r
\r
if (!matcher.matches()) {\r
}\r
String description = matcher.group(noExpVariableDesc);\r
\r
- return new Variable2(name, null, unit, range, description);\r
+ return new Variable(name, null, unit, range, description);\r
}\r
\r
private static final String SUBSCRIPT_PATTERN =\r
}\r
\r
int id = Integer.parseInt(matcher.group(elementId));\r
- Variable2 var = mdl.getVariable((normalize(matcher.group(elementName))));\r
+ Variable var = mdl.getVariable((normalize(matcher.group(elementName))));\r
\r
SketchVariable variable = new SketchVariable(id, var);\r
\r
import java.util.HashMap;\r
import java.util.List;\r
\r
-import org.simantics.sysdyn.modelImport.model.support.Subscript2;\r
-import org.simantics.sysdyn.modelImport.model.support.Variable2;\r
+import org.simantics.sysdyn.modelImport.model.support.Variable;\r
\r
public class MdlModel {\r
\r
private String name;\r
\r
- private HashMap<String, Variable2> variables;\r
- private HashMap<String, ArrayList<Variable2>> groups;\r
+ private HashMap<String, Variable> variables;\r
+ private HashMap<String, ArrayList<Variable>> groups;\r
\r
private HashMap<String, Subscript2> subscripts;\r
\r
- private ArrayList<Sketch2> sketches;\r
+ private ArrayList<Sketch> sketches;\r
\r
public MdlModel(String name) {\r
this.name = name;\r
- this.variables = new HashMap<String, Variable2>();\r
- this.groups = new HashMap<String, ArrayList<Variable2>>();\r
+ this.variables = new HashMap<String, Variable>();\r
+ this.groups = new HashMap<String, ArrayList<Variable>>();\r
this.subscripts = new HashMap<String, Subscript2>();\r
- this.sketches = new ArrayList<Sketch2>();\r
+ this.sketches = new ArrayList<Sketch>();\r
}\r
\r
- public void addVariable(Variable2 variable, String group) {\r
+ public void addVariable(Variable variable, String group) {\r
if (variables.get(variable.getName()) != null) {\r
System.err.println("warning, duplicate variable "+variable.getName());\r
}\r
\r
if (group != null) {\r
if (groups.get(group) == null) {\r
- groups.put(group, new ArrayList<Variable2>());\r
+ groups.put(group, new ArrayList<Variable>());\r
}\r
groups.get(group).add(variable);\r
}\r
}\r
\r
- public Variable2 getVariable(String name) {\r
+ public Variable getVariable(String name) {\r
return variables.get(name);\r
}\r
\r
- public List<Variable2> getVariables() {\r
- return new ArrayList<Variable2>(variables.values());\r
+ public List<Variable> getVariables() {\r
+ return new ArrayList<Variable>(variables.values());\r
}\r
\r
public void addSubscript(Subscript2 subscript) {\r
return new ArrayList<Subscript2>(subscripts.values());\r
}\r
\r
- public void addSketch(Sketch2 sketch) {\r
+ public void addSketch(Sketch sketch) {\r
sketches.add(sketch);\r
}\r
\r
- public List<Sketch2> getSketches() {\r
+ public List<Sketch> getSketches() {\r
return sketches;\r
}\r
\r
import java.util.HashMap;\r
import java.util.List;\r
\r
-import org.simantics.sysdyn.modelImport.model.element.Element2;\r
+import org.simantics.sysdyn.modelImport.model.element.Element;\r
\r
-public class Sketch2 {\r
+public class Sketch {\r
\r
private String name;\r
\r
private ArrayList<SketchValve> valves;\r
private ArrayList<SketchVariable> variables;\r
\r
- public Sketch2() {\r
+ public Sketch() {\r
comments = new ArrayList<SketchComment>();\r
connections = new ArrayList<SketchConnection>();\r
valves = new ArrayList<SketchValve>();\r
public double leftEdge = 0;\r
public double rightEdge = 0;\r
\r
- public HashMap<Integer, Element2> elements = new HashMap<Integer, Element2>();\r
+ public HashMap<Integer, Element> elements = new HashMap<Integer, Element>();\r
\r
public void setEdges() {\r
boolean first = true;\r
package org.simantics.sysdyn.modelImport.mdl;\r
\r
import org.simantics.sysdyn.modelImport.MdlUtils.CommentIcon;\r
-import org.simantics.sysdyn.modelImport.model.element.Cloud2;\r
-import org.simantics.sysdyn.modelImport.model.element.Comment2;\r
-import org.simantics.sysdyn.modelImport.model.element.Element2;\r
+import org.simantics.sysdyn.modelImport.model.element.Cloud;\r
+import org.simantics.sysdyn.modelImport.model.element.Comment;\r
+import org.simantics.sysdyn.modelImport.model.element.Element;\r
\r
public class SketchComment extends SketchElement {\r
\r
return icon;\r
}\r
\r
- public Element2 getModelElement(double hOffset, double vOffset) {\r
+ public Element getModelElement(double hOffset, double vOffset) {\r
if (icon.equals(CommentIcon.CLOUD)) {\r
- return new Cloud2(\r
+ return new Cloud(\r
getSysdyndX() + hOffset, \r
getSysdyndY() + vOffset, \r
getSysdynWidth(),\r
getSysdynHeight());\r
}\r
else {\r
- return new Comment2(\r
+ return new Comment(\r
getSysdyndX() + hOffset, \r
getSysdyndY() + vOffset, \r
getSysdynWidth(),\r
package org.simantics.sysdyn.modelImport.mdl;\r
\r
import org.simantics.sysdyn.modelImport.MdlUtils.ConnectionType;\r
-import org.simantics.sysdyn.modelImport.model.element.Connection2;\r
-import org.simantics.sysdyn.modelImport.model.element.Dependency2;\r
-import org.simantics.sysdyn.modelImport.model.element.Element2;\r
-import org.simantics.sysdyn.modelImport.model.element.Flow2;\r
+import org.simantics.sysdyn.modelImport.model.element.Connection;\r
+import org.simantics.sysdyn.modelImport.model.element.Dependency;\r
+import org.simantics.sysdyn.modelImport.model.element.Element;\r
+import org.simantics.sysdyn.modelImport.model.element.Flow;\r
\r
public class SketchConnection extends SketchObject {\r
\r
return type;\r
}\r
\r
- public Connection2 getWriteableConnection(Element2 head, Element2 tail, double offset) {\r
+ public Connection getWriteableConnection(Element head, Element tail, double offset) {\r
if (type.equals(ConnectionType.ARROW)) {\r
- return new Dependency2(head, tail, false, false, getSysdynAngle(tail, head, offset));\r
+ return new Dependency(head, tail, false, false, getSysdynAngle(tail, head, offset));\r
}\r
else if (type.equals(ConnectionType.LINE_ARROW)) {\r
- return new Flow2(head, tail);\r
+ return new Flow(head, tail);\r
}\r
else if (type.equals(ConnectionType.LINE_SEGMENT)) {\r
// TODO: what is this I don't even...\r
- return new Flow2(tail, head);\r
+ return new Flow(tail, head);\r
}\r
return null;\r
}\r
\r
// TODO: comment this?\r
- public double getSysdynAngle(Element2 from, Element2 to, double voffset) {\r
+ public double getSysdynAngle(Element from, Element to, double voffset) {\r
if (points == null || points.length == 0) {\r
return 0;\r
}\r
package org.simantics.sysdyn.modelImport.mdl;\r
\r
-import org.simantics.sysdyn.modelImport.model.element.Element2;\r
+import org.simantics.sysdyn.modelImport.model.element.Element;\r
\r
public abstract class SketchElement extends SketchObject {\r
\r
return textLine;\r
}\r
\r
- public abstract Element2 getModelElement(double hOffset, double vOffset);\r
+ public abstract Element getModelElement(double hOffset, double vOffset);\r
\r
}\r
package org.simantics.sysdyn.modelImport.mdl;\r
\r
-import org.simantics.sysdyn.modelImport.model.element.Element2;\r
-import org.simantics.sysdyn.modelImport.model.element.Valve2;\r
-import org.simantics.sysdyn.modelImport.model.element.Valve2.TextPosition;\r
+import org.simantics.sysdyn.modelImport.model.element.Element;\r
+import org.simantics.sysdyn.modelImport.model.element.Valve;\r
+import org.simantics.sysdyn.modelImport.model.element.Valve.TextPosition;\r
\r
public class SketchValve extends SketchElement {\r
\r
}\r
\r
@Override\r
- public Element2 getModelElement(double hOffset, double vOffset) {\r
- return new Valve2(\r
+ public Element getModelElement(double hOffset, double vOffset) {\r
+ return new Valve(\r
getSysdyndX() + hOffset, \r
getSysdyndY() + vOffset, \r
getSysdynWidth(),\r
package org.simantics.sysdyn.modelImport.mdl;\r
\r
-import org.simantics.sysdyn.modelImport.model.element.Auxiliary2;\r
-import org.simantics.sysdyn.modelImport.model.element.Element2;\r
-import org.simantics.sysdyn.modelImport.model.element.Stock2;\r
+import org.simantics.sysdyn.modelImport.model.element.Auxiliary;\r
+import org.simantics.sysdyn.modelImport.model.element.Element;\r
+import org.simantics.sysdyn.modelImport.model.element.Stock;\r
import org.simantics.sysdyn.modelImport.model.expression.IntegralExpression;\r
-import org.simantics.sysdyn.modelImport.model.support.Variable2;\r
+import org.simantics.sysdyn.modelImport.model.support.Variable;\r
\r
public class SketchVariable extends SketchElement {\r
\r
- private Variable2 variable;\r
+ private Variable variable;\r
\r
- public SketchVariable(int id, Variable2 variable) {\r
+ public SketchVariable(int id, Variable variable) {\r
super(id);\r
this.variable = variable;\r
}\r
\r
- public Variable2 getVariable() {\r
+ public Variable getVariable() {\r
return variable;\r
}\r
\r
@Override\r
- public Element2 getModelElement(double hOffset, double vOffset) {\r
+ public Element getModelElement(double hOffset, double vOffset) {\r
if (variable.getExpression() instanceof IntegralExpression) {\r
- return new Stock2(\r
+ return new Stock(\r
getSysdyndX() + hOffset, \r
getSysdyndY() + vOffset, \r
getSysdynWidth(),\r
variable);\r
}\r
else {\r
- return new Auxiliary2(\r
+ return new Auxiliary(\r
getSysdyndX() + hOffset, \r
getSysdyndY() + vOffset, \r
getSysdynWidth(),\r
-package org.simantics.sysdyn.modelImport.model.support;\r
+package org.simantics.sysdyn.modelImport.mdl;\r
\r
import java.util.ArrayList;\r
import java.util.Arrays;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.modeling.ModelingResources;\r
import org.simantics.simulation.ontology.SimulationResource;\r
-import org.simantics.sysdyn.modelImport.model.element.Connection2;\r
-import org.simantics.sysdyn.modelImport.model.element.Element2;\r
+import org.simantics.sysdyn.modelImport.model.element.Connection;\r
+import org.simantics.sysdyn.modelImport.model.element.Element;\r
import org.simantics.sysdyn.modelImport.model.element.ModelVariable;\r
-import org.simantics.sysdyn.modelImport.model.element.Shadow2;\r
-import org.simantics.sysdyn.modelImport.model.support.Enumeration2;\r
+import org.simantics.sysdyn.modelImport.model.element.Shadow;\r
+import org.simantics.sysdyn.modelImport.model.support.Enumeration;\r
import org.simantics.sysdyn.utils.ModelUtils;\r
\r
public class Model2 implements IWriteableObject {\r
private double start, stop, step;\r
\r
// the structure of the model\r
- private HashMap<String, Enumeration2> enumerations;\r
+ private HashMap<String, Enumeration> enumerations;\r
private HashMap<String, ModelVariable> variables;\r
\r
- private ArrayList<Element2> elements;\r
- private ArrayList<Shadow2> shadows;\r
- private ArrayList<Connection2> connections;\r
+ private ArrayList<Element> elements;\r
+ private ArrayList<Shadow> shadows;\r
+ private ArrayList<Connection> connections;\r
\r
public Model2(String name) {\r
this.name = name;\r
\r
- enumerations = new HashMap<String, Enumeration2>();\r
+ enumerations = new HashMap<String, Enumeration>();\r
variables = new HashMap<String, ModelVariable>();\r
\r
- elements = new ArrayList<Element2>();\r
- shadows = new ArrayList<Shadow2>();\r
- connections = new ArrayList<Connection2>();\r
+ elements = new ArrayList<Element>();\r
+ shadows = new ArrayList<Shadow>();\r
+ connections = new ArrayList<Connection>();\r
}\r
\r
public double getStart() {\r
this.step = step;\r
}\r
\r
- public void addEnumeration(Enumeration2 enumeration) {\r
+ public void addEnumeration(Enumeration enumeration) {\r
if (enumerations.get(enumeration.getName()) != null) {\r
System.err.println("enumeration "+enumeration.getName()+" already defined");\r
}\r
enumerations.put(enumeration.getName(), enumeration);\r
}\r
\r
- public Enumeration2 getEnumeration(String name) {\r
+ public Enumeration getEnumeration(String name) {\r
return enumerations.get(name);\r
}\r
\r
- public Collection<Enumeration2> getEnumerations() {\r
+ public Collection<Enumeration> getEnumerations() {\r
return enumerations.values();\r
}\r
\r
return variables.values();\r
}\r
\r
- public void addElement(Element2 element) {\r
+ public void addElement(Element element) {\r
elements.add(element);\r
}\r
\r
- public void addShadow(Shadow2 shadow) {\r
+ public void addShadow(Shadow shadow) {\r
shadows.add(shadow);\r
}\r
\r
- public void addConnection(Connection2 connection) {\r
+ public void addConnection(Connection connection) {\r
connections.add(connection);\r
}\r
\r
\r
Resource configuration = graph.getSingleObject(model, sim.HasConfiguration);\r
\r
- for (Enumeration2 e : getEnumerations()) {\r
+ for (Enumeration e : getEnumerations()) {\r
e.write(graph, configuration, context);\r
}\r
\r
- for (Element2 e : elements) {\r
+ for (Element e : elements) {\r
e.write(graph, configuration, context);\r
}\r
\r
- for (Shadow2 s : shadows) {\r
+ for (Shadow s : shadows) {\r
s.write(graph, configuration, context);\r
}\r
\r
- for (Connection2 c : connections) {\r
+ for (Connection c : connections) {\r
c.write(graph, configuration, context);\r
}\r
\r
import org.simantics.sysdyn.modelImport.model.WriteContext;\r
import org.simantics.sysdyn.modelImport.model.expression.IExpression;\r
import org.simantics.sysdyn.modelImport.model.support.Range;\r
-import org.simantics.sysdyn.modelImport.model.support.Variable2;\r
+import org.simantics.sysdyn.modelImport.model.support.Variable;\r
\r
-public class Auxiliary2 extends ModelVariable {\r
+public class Auxiliary extends ModelVariable {\r
\r
- public Auxiliary2(double x, double y, double w, double h,\r
+ public Auxiliary(double x, double y, double w, double h,\r
String name, IExpression expression, Range range, String unit, String description) {\r
super(x, y, w, h, name, expression, range, unit, description);\r
}\r
\r
- public Auxiliary2(double x, double y, double w, double h, Variable2 variable) {\r
+ public Auxiliary(double x, double y, double w, double h, Variable variable) {\r
super(x, y, w, h, variable);\r
}\r
\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.modelImport.model.WriteContext;\r
\r
-public class Cloud2 extends Element2 {\r
+public class Cloud extends Element {\r
\r
- public Cloud2(double x, double y, double w, double h) {\r
+ public Cloud(double x, double y, double w, double h) {\r
super(x, y, w, h);\r
}\r
\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.modelImport.model.WriteContext;\r
\r
-public class Comment2 extends Element2 {\r
+public class Comment extends Element {\r
\r
private String text;\r
\r
- public Comment2(double x, double y, double w, double h, String text) {\r
+ public Comment(double x, double y, double w, double h, String text) {\r
super(x, y, w, h);\r
this.text = text;\r
}\r
import org.simantics.sysdyn.modelImport.model.IWriteableObject;\r
import org.simantics.sysdyn.modelImport.model.WriteContext;\r
\r
-public abstract class Connection2 implements IWriteableObject {\r
+public abstract class Connection implements IWriteableObject {\r
\r
- protected Element2 head;\r
- protected Element2 tail;\r
+ protected Element head;\r
+ protected Element tail;\r
\r
- public Connection2(Element2 head, Element2 tail) {\r
+ public Connection(Element head, Element tail) {\r
this.head = head;\r
this.tail = tail;\r
}\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.modelImport.model.WriteContext;\r
\r
-public class Dependency2 extends Connection2 {\r
+public class Dependency extends Connection {\r
\r
private boolean showArrow;\r
private boolean showDelay;\r
private double angle;\r
\r
- public Dependency2(Element2 head, Element2 tail, boolean showArrow, boolean showDelay, double angle) {\r
+ public Dependency(Element head, Element tail, boolean showArrow, boolean showDelay, double angle) {\r
super(head, tail);\r
this.showArrow = showArrow;\r
this.showDelay = showDelay;\r
import org.simantics.sysdyn.modelImport.model.IWriteableObject;\r
import org.simantics.sysdyn.modelImport.model.WriteContext;\r
\r
-public abstract class Element2 implements IWriteableObject {\r
+public abstract class Element implements IWriteableObject {\r
\r
private double x;\r
private double y;\r
\r
private Resource resource;\r
\r
- public Element2(double x, double y, double width, double height) {\r
+ public Element(double x, double y, double width, double height) {\r
this.x = x;\r
this.y = y;\r
this.width = width;\r
this.height = height;\r
}\r
\r
- public Element2(SketchElement element, double hOffset, double vOffset) {\r
+ public Element(SketchElement element, double hOffset, double vOffset) {\r
this.x = element.getSysdyndX() + hOffset;\r
this.y = element.getSysdyndY() + vOffset;\r
this.width = element.getSysdynWidth();\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.modelImport.model.WriteContext;\r
\r
-public class Flow2 extends Connection2 {\r
+public class Flow extends Connection {\r
\r
- public Flow2(Element2 head, Element2 tail) {\r
+ public Flow(Element head, Element tail) {\r
super(head, tail);\r
}\r
\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.modelImport.model.WriteContext;\r
import org.simantics.sysdyn.modelImport.model.expression.IExpression;\r
-import org.simantics.sysdyn.modelImport.model.support.Enumeration2;\r
+import org.simantics.sysdyn.modelImport.model.support.Enumeration;\r
import org.simantics.sysdyn.modelImport.model.support.Range;\r
-import org.simantics.sysdyn.modelImport.model.support.Variable2;\r
+import org.simantics.sysdyn.modelImport.model.support.Variable;\r
\r
-public abstract class ModelVariable extends Element2 {\r
+public abstract class ModelVariable extends Element {\r
\r
protected String name;\r
protected IExpression expression;\r
protected String unit;\r
protected String description;\r
\r
- protected List<Enumeration2> enumerations;\r
+ protected List<Enumeration> enumerations;\r
\r
public ModelVariable(double x, double y, double w, double h, String name, IExpression expression, Range range, String unit, String description) {\r
super(x, y, w, h);\r
this.description = description;\r
}\r
\r
- public ModelVariable(double x, double y, double w, double h, Variable2 variable) {\r
+ public ModelVariable(double x, double y, double w, double h, Variable variable) {\r
super(x, y, w, h);\r
this.name = variable.getName();\r
this.expression = variable.getExpression();\r
import org.simantics.sysdyn.modelImport.mdl.SketchVariable;\r
import org.simantics.sysdyn.modelImport.model.WriteContext;\r
\r
-public class Shadow2 extends Element2 {\r
+public class Shadow extends Element {\r
\r
- private Element2 original;\r
+ private Element original;\r
\r
- public Shadow2(double x, double y, double w, double h, Element2 original) {\r
+ public Shadow(double x, double y, double w, double h, Element original) {\r
super(x, y, w, h);\r
this.original = original;\r
}\r
\r
- public Shadow2(SketchVariable variable, double hOffset, double vOffset, Element2 original) {\r
+ public Shadow(SketchVariable variable, double hOffset, double vOffset, Element original) {\r
super(variable, hOffset, vOffset);\r
this.original = original;\r
}\r
import org.simantics.sysdyn.modelImport.model.WriteContext;\r
import org.simantics.sysdyn.modelImport.model.expression.IntegralExpression;\r
import org.simantics.sysdyn.modelImport.model.support.Range;\r
-import org.simantics.sysdyn.modelImport.model.support.Variable2;\r
+import org.simantics.sysdyn.modelImport.model.support.Variable;\r
\r
-public class Stock2 extends ModelVariable {\r
+public class Stock extends ModelVariable {\r
\r
- public Stock2(double x, double y, double w, double h,\r
+ public Stock(double x, double y, double w, double h,\r
String name, IntegralExpression expression, Range range, String unit, String description) {\r
super(x, y, w, h, name, expression, range, unit, description);\r
}\r
\r
- public Stock2(double x, double y, double w, double h, Variable2 variable) {\r
+ public Stock(double x, double y, double w, double h, Variable variable) {\r
super(x, y, w, h, variable);\r
}\r
\r
import org.simantics.sysdyn.modelImport.model.WriteContext;\r
import org.simantics.sysdyn.modelImport.model.expression.IExpression;\r
import org.simantics.sysdyn.modelImport.model.support.Range;\r
-import org.simantics.sysdyn.modelImport.model.support.Variable2;\r
+import org.simantics.sysdyn.modelImport.model.support.Variable;\r
\r
-public class Valve2 extends ModelVariable {\r
+public class Valve extends ModelVariable {\r
\r
public enum Orientation {\r
HORIZONTAL, VERTICAL\r
\r
private TextPosition position;\r
\r
- public Valve2(double x, double y, double w, double h,\r
+ public Valve(double x, double y, double w, double h,\r
String name, IExpression expression, Range range, String unit, String description, TextPosition position) {\r
super(x, y, w, h, name, expression, range, unit, description);\r
this.position = position;\r
}\r
\r
- public Valve2(double x, double y, double w, double h, Variable2 variable, TextPosition position) {\r
+ public Valve(double x, double y, double w, double h, Variable variable, TextPosition position) {\r
super(x, y, w, h, variable);\r
this.position = position;\r
}\r
import org.simantics.sysdyn.modelImport.model.IWriteableObject;\r
import org.simantics.sysdyn.modelImport.model.WriteContext;\r
\r
-public class Enumeration2 implements IWriteableObject {\r
+public class Enumeration implements IWriteableObject {\r
\r
private String name;\r
private ArrayList<String> values;\r
\r
private Resource resource;\r
\r
- public Enumeration2(String name, ArrayList<String> values) {\r
+ public Enumeration(String name, ArrayList<String> values) {\r
this.name = name;\r
this.values = values;\r
}\r
import org.simantics.sysdyn.modelImport.model.expression.IExpression;\r
import org.simantics.sysdyn.modelImport.model.expression.SubscriptExpression;\r
\r
-public class Variable2 {\r
+public class Variable {\r
\r
private String name;\r
private IExpression expression;\r
private Range range;\r
private String description;\r
\r
- public Variable2(String name, IExpression expression, String unit, Range range, String description) {\r
+ public Variable(String name, IExpression expression, String unit, Range range, String description) {\r
this.name = name;\r
this.expression = expression;\r
this.unit = unit;\r
return description;\r
}\r
\r
- public void mergeExpression(Variable2 variable) {\r
+ public void mergeExpression(Variable variable) {\r
if (expression instanceof SubscriptExpression) {\r
((SubscriptExpression)expression).merge((SubscriptExpression)variable.getExpression());\r
}\r