]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Changed remaining places where InstanceOf statements are claimed to not claim an...
authorlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 16 Mar 2010 21:34:59 +0000 (21:34 +0000)
committerlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 16 Mar 2010 21:34:59 +0000 (21:34 +0000)
This was done because in almost all cases HasInstance statements should not be created.
In general, HasInstance statements can be used only when it is known that there will never be vast amounts of instances of some type.

git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@15007 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedValueAccessor.java
org.simantics.objmap/src/org/simantics/objmap/schema/SimpleLinkType.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/AuxiliaryExpressionViewFactor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/ConstantExpressionViewFactor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/ParameterExpressionViewFactor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/StockExpressionViewFactor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/WithLookupExpressionViewFactor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java

index 8716fab6264f65f562fe5ee620355ca0b06a9493..592d0e0c2b4889ade1b6f994dea5fffbe99d2794 100644 (file)
@@ -57,7 +57,7 @@ public class RelatedValueAccessor implements IDomainAccessor<Object> {
                                if(value == null)\r
                                        return false;\r
                                valueResource = g.newResource();\r
-                               g.claim(valueResource, g.getBuiltins().InstanceOf, \r
+                               g.claim(valueResource, g.getBuiltins().InstanceOf, null,\r
                                                valueType);\r
                                g.claim(element, relation, valueResource);\r
                                g.claimValue(valueResource, value);                             \r
index 0d25d5317f73c9a681d572efa5e0d18ac4861343..f0366ca402b3258ca6d743f41a98a9be2f07288d 100644 (file)
@@ -66,7 +66,7 @@ public class SimpleLinkType implements ILinkType {
                         rangeElement.toString()\r
                 );\r
             Resource result = g.newResource();\r
-            g.claim(result, g.getBuiltins().InstanceOf, domainType);\r
+            g.claim(result, g.getBuiltins().InstanceOf, null, domainType);\r
             return result;\r
         } catch(DatabaseException e) {\r
             throw new MappingException(e);\r
index 96b7e6eac482acd9a0694456952716233b82d3c9..9a74a19c53dec0551b2f0b551b282eab0c15e4be 100644 (file)
@@ -34,15 +34,15 @@ import org.simantics.sysdyn.SysdynResource;
 import org.simantics.ui.SimanticsUI;\r
 \r
 public class AuxiliaryExpressionViewFactor implements IExpressionViewFactor {\r
-    \r
+\r
     private Label equationLabel;\r
     private ExpressionField expression;\r
-    \r
+\r
     @Override\r
     public void createView(Composite parent, Map<String, Object> data) {\r
 \r
         final String equation = data.get("equation") != null ? (String)data.get("equation") : "";\r
-        \r
+\r
         GridLayoutFactory.fillDefaults().numColumns(2).spacing(3, 3).applyTo(parent);\r
         equationLabel = new Label(parent, SWT.NONE);\r
         equationLabel.setFont(FONT);\r
@@ -54,12 +54,12 @@ public class AuxiliaryExpressionViewFactor implements IExpressionViewFactor {
         expression.setFont(FONT);\r
         expression.setExpression(equation);\r
         GridDataFactory.fillDefaults().grab(true, true).applyTo(expression);\r
-        \r
+\r
     }\r
 \r
     @Override\r
     public void readData(final Resource variable, Map<String, Object> data) {\r
-        String equation = null;        \r
+        String equation = null;\r
         if (variable != null && data.get("equation") == null) {\r
             try {\r
                 equation = SimanticsUI.getSession().syncRequest(new Read<String>() {\r
@@ -80,7 +80,7 @@ public class AuxiliaryExpressionViewFactor implements IExpressionViewFactor {
                 e1.printStackTrace();\r
             }\r
             data.put("equation", equation);\r
-        }         \r
+        }\r
     }\r
 \r
     @Override\r
@@ -99,13 +99,13 @@ public class AuxiliaryExpressionViewFactor implements IExpressionViewFactor {
                         g.deny(variable, sr.HasExpression);\r
                     }\r
                     expression = g.newResource();\r
-                    g.claim(expression, b.InstanceOf, sr.NormalExpression);\r
+                    g.claim(expression, b.InstanceOf, null, sr.NormalExpression);\r
                     g.claim(variable, sr.HasExpression, expression);\r
                     g.claimValue(expression, sr.HasEquation, currentText);\r
                 }\r
 \r
             });\r
-        }        \r
+        }\r
     }\r
 \r
     @Override\r
index 35f411ef4264446e882f18665efc22b344eeb13b..1994fd0c6145e799afca389edeb99df942ed7a79 100644 (file)
@@ -117,7 +117,7 @@ public class ConstantExpressionViewFactor implements IExpressionViewFactor {
                         g.deny(variable, sr.HasExpression);\r
                     }\r
                     expression = g.newResource();\r
-                    g.claim(expression, b.InstanceOf, sr.ConstantExpression);\r
+                    g.claim(expression, b.InstanceOf, null, sr.ConstantExpression);\r
                     g.claim(variable, sr.HasExpression, expression);\r
                     g.claimValue(expression, sr.HasEquation, currentText);\r
                 }\r
index 008a7779da458084b5a551009be5b69c31749410..fe23484823eba18101e6047f9f23a1bafa9b5c43 100644 (file)
@@ -34,16 +34,16 @@ import org.simantics.sysdyn.SysdynResource;
 import org.simantics.ui.SimanticsUI;\r
 \r
 public class ParameterExpressionViewFactor implements IExpressionViewFactor {\r
-    \r
+\r
     private Label equationLabel;\r
     private ExpressionField expression;\r
-    \r
+\r
     @Override\r
     public void createView(Composite parent, Map<String, Object> data) {\r
-        \r
+\r
         final String equation = data.get("equation") != null ? (String)data.get("equation") : "";\r
-        \r
-        \r
+\r
+\r
         GridLayoutFactory.fillDefaults().numColumns(2).spacing(3, 3).applyTo(parent);\r
         equationLabel = new Label(parent, SWT.NONE);\r
         equationLabel.setFont(FONT);\r
@@ -64,7 +64,7 @@ public class ParameterExpressionViewFactor implements IExpressionViewFactor {
 \r
     @Override\r
     public void readData(final Resource variable, Map<String, Object> data) {\r
-        String equation = null;        \r
+        String equation = null;\r
         if (variable != null && data.get("equation") == null) {\r
             try {\r
                 equation = SimanticsUI.getSession().syncRequest(new Read<String>() {\r
@@ -85,7 +85,7 @@ public class ParameterExpressionViewFactor implements IExpressionViewFactor {
                 e1.printStackTrace();\r
             }\r
             data.put("equation", equation);\r
-        } \r
+        }\r
     }\r
 \r
     @Override\r
@@ -118,19 +118,19 @@ public class ParameterExpressionViewFactor implements IExpressionViewFactor {
                         g.deny(variable, sr.HasExpression);\r
                     }\r
                     expression = g.newResource();\r
-                    g.claim(expression, b.InstanceOf, sr.ParameterExpression);\r
+                    g.claim(expression, b.InstanceOf, null, sr.ParameterExpression);\r
                     g.claim(variable, sr.HasExpression, expression);\r
                     g.claimValue(expression, sr.HasEquation, currentText);\r
                 }\r
 \r
             });\r
-        }        \r
+        }\r
     }\r
 \r
     @Override\r
     public void updateData(Map<String, Object> data) {\r
         if(this.expression != null && this.expression.getExpression() != null)\r
-            data.put("equation", this.expression.getExpression());        \r
+            data.put("equation", this.expression.getExpression());\r
     }\r
 \r
     @Override\r
index 411446dd391a4b7f5c6629444270eed139c7f117..ac8b74559e119d88439eb8d8d37448a0aa4cddb2 100644 (file)
@@ -47,7 +47,7 @@ public class StockExpressionViewFactor implements IExpressionViewFactor {
 \r
         final String initialEquation = data.get("initialEquation") != null ? (String)data.get("initialEquation") : "";\r
         final String integralEquation = data.get("integral") != null ? (String)data.get("integral") : "";\r
-        \r
+\r
         GridLayoutFactory.fillDefaults().numColumns(2).spacing(3, 3).applyTo(parent);\r
 \r
         integralLabel = new Label(parent, SWT.NONE);\r
@@ -98,7 +98,7 @@ public class StockExpressionViewFactor implements IExpressionViewFactor {
                 e1.printStackTrace();\r
             }\r
             data.put("initialEquation", initialEquation);\r
-        } \r
+        }\r
 \r
         data.put("integral", getIntegral(variable));\r
     }\r
@@ -119,13 +119,13 @@ public class StockExpressionViewFactor implements IExpressionViewFactor {
                         g.deny(variable, sr.HasExpression);\r
                     }\r
                     expression = g.newResource();\r
-                    g.claim(expression, b.InstanceOf, sr.StockExpression);\r
+                    g.claim(expression, b.InstanceOf, null, sr.StockExpression);\r
                     g.claim(variable, sr.HasExpression, expression);\r
                     g.claimValue(expression, sr.HasInitialEquation, currentText);\r
                 }\r
 \r
             });\r
-        }        \r
+        }\r
     }\r
 \r
     private String getIntegral(final Resource variable) {\r
@@ -147,20 +147,20 @@ public class StockExpressionViewFactor implements IExpressionViewFactor {
                             Resource tail = graph.getPossibleObject(r, sr.HasTail);\r
                             if(tail != null) {\r
                                 Object name = graph.getPossibleRelatedValue(tail, b.HasName);\r
-                                if (name != null) \r
+                                if (name != null)\r
                                     builder.append(" + " + name);\r
                             }\r
-                        }  \r
+                        }\r
                     }\r
                     for (Resource r : tails) {\r
                         if(graph.isInstanceOf(r, sr.Flow)) {\r
                             Resource head = graph.getPossibleObject(r, sr.HasHead);\r
                             if(head != null) {\r
                                 Object name = graph.getPossibleRelatedValue(head, b.HasName);\r
-                                if (name != null) \r
+                                if (name != null)\r
                                     builder.append(" - " + name);\r
                             }\r
-                        }  \r
+                        }\r
                     }\r
                     if (builder.indexOf(" + ") == 0)\r
                         builder.delete(0, 3);\r
@@ -170,7 +170,7 @@ public class StockExpressionViewFactor implements IExpressionViewFactor {
             });\r
         } catch (DatabaseException e) {\r
             e.printStackTrace();\r
-        }      \r
+        }\r
         return integral;\r
     }\r
 \r
@@ -196,7 +196,7 @@ public class StockExpressionViewFactor implements IExpressionViewFactor {
     @Override\r
     public void updateData(Map<String, Object> data) {\r
         if(this.expression != null && this.expression.getExpression() != null)\r
-            data.put("initialEquation", this.expression.getExpression());   \r
+            data.put("initialEquation", this.expression.getExpression());\r
         if(this.integral != null && this.integral.getText() != null)\r
             data.put("integral", this.integral.getText());\r
     }\r
index 81fd4b478c5e87af1d0d4b2cb533a472242f7af1..5a3cda31ffeca646e30c17c096d1721e6cf389ab 100644 (file)
@@ -37,19 +37,19 @@ import org.simantics.ui.SimanticsUI;
 \r
 public class WithLookupExpressionViewFactor implements IExpressionViewFactor {\r
 \r
-    \r
+\r
     private Label expressionLabel;\r
     private ExpressionField expression;\r
     private Label lookupLabel;\r
     private ExpressionField lookup;\r
     private ExpressionField lastSelectedText = expression;\r
-    \r
+\r
     @Override\r
     public void createView(Composite parent, Map<String, Object> data) {\r
 \r
         final String equation = data.get("equation") != null ? (String)data.get("equation") : "";\r
         final String lookupTable = data.get("lookup") != null ? (String)data.get("lookup") : "";\r
-        \r
+\r
         GridLayoutFactory.fillDefaults().numColumns(2).spacing(3, 3).applyTo(parent);\r
 \r
         expressionLabel = new Label(parent, SWT.NONE);\r
@@ -69,7 +69,7 @@ public class WithLookupExpressionViewFactor implements IExpressionViewFactor {
                 lastSelectedText = expression;\r
             }\r
         });\r
-        \r
+\r
         lookupLabel = new Label(parent, SWT.NONE);\r
         lookupLabel.setFont(FONT);\r
         lookupLabel.setText("Lookup\ntable");\r
@@ -91,7 +91,7 @@ public class WithLookupExpressionViewFactor implements IExpressionViewFactor {
 \r
     @Override\r
     public void readData(final Resource variable, Map<String, Object> data) {\r
-        String[] results = null;        \r
+        String[] results = null;\r
         if (variable != null && data.get("equation") == null) {\r
             try {\r
                 results = SimanticsUI.getSession().syncRequest(new Read<String[]>() {\r
@@ -117,14 +117,14 @@ public class WithLookupExpressionViewFactor implements IExpressionViewFactor {
             }\r
             data.put("equation", results[0]);\r
             data.put("lookup", results[1]);\r
-        }         \r
+        }\r
     }\r
 \r
     @Override\r
     public void writeData(final Resource variable, Map<String, Object> data) {\r
         final String currentExpression = expression.getExpression();\r
         final String currentLookupTable = lookup.getExpression();\r
-        \r
+\r
         if(currentExpression != null && currentLookupTable != null) {\r
             data.put("equation", currentExpression);\r
             data.put("lookup", currentLookupTable);\r
@@ -139,14 +139,14 @@ public class WithLookupExpressionViewFactor implements IExpressionViewFactor {
                         g.deny(variable, sr.HasExpression);\r
                     }\r
                     expression = g.newResource();\r
-                    g.claim(expression, b.InstanceOf, sr.WithLookupExpression);\r
+                    g.claim(expression, b.InstanceOf, null, sr.WithLookupExpression);\r
                     g.claim(variable, sr.HasExpression, expression);\r
                     g.claimValue(expression, sr.HasEquation, currentExpression);\r
                     g.claimValue(expression, sr.HasLookup, currentLookupTable);\r
                 }\r
 \r
             });\r
-        }        \r
+        }\r
     }\r
 \r
     @Override\r
@@ -171,9 +171,9 @@ public class WithLookupExpressionViewFactor implements IExpressionViewFactor {
     @Override\r
     public void updateData(Map<String, Object> data) {\r
         if(this.expression != null && this.expression.getExpression() != null)\r
-            data.put("equation", this.expression.getExpression());   \r
+            data.put("equation", this.expression.getExpression());\r
         if(this.lookup != null && this.lookup.getExpression() != null)\r
-            data.put("lookup", this.lookup.getExpression());        \r
+            data.put("lookup", this.lookup.getExpression());\r
     }\r
 \r
     @Override\r
index 9a3c2534a6295456aef306bde1aa0a0797165de8..8cfabfcbfdc0938aa8a8df6aa2e94ca942c59e3b 100644 (file)
@@ -35,7 +35,7 @@ import org.simantics.utils.ui.workbench.WorkbenchUtils;
 \r
 public class SysdynProject extends AbstractProjectFeature {\r
     private static final String DEFAULT_PERSPECTIVE = "org.simantics.sysdyn.ui.perspective";\r
-    \r
+\r
     class ModelManager extends UIModelManagerBase {\r
         @Override\r
         public void create(ProjectElementType kind, Shell parentShell, Session session, Resource container,\r
@@ -73,7 +73,7 @@ public class SysdynProject extends AbstractProjectFeature {
                 SysdynResource sr = SysdynResource.getInstance(g);\r
                 Resource model = g.newResource();\r
                 g.claimValue(model, b.HasName, "Configuration");\r
-                g.claim(model, b.InstanceOf, sr.Configuration);\r
+                g.claim(model, b.InstanceOf, null, sr.Configuration);\r
                 g.claim(model, b.PartOf, library);\r
                 g.claimValue(model, sr.HasStartTime, 0.0);\r
                 g.claimValue(model, sr.HasStopTime, 10.0);\r
@@ -85,13 +85,13 @@ public class SysdynProject extends AbstractProjectFeature {
     };\r
 \r
     ModelManager mm;\r
-    \r
+\r
     @Override\r
     public void configure() throws ProjectException {\r
         addToCollectionHint(ProjectKeys.PERSPECTIVES, DEFAULT_PERSPECTIVE);\r
         addToCollectionHint(ProjectKeys.OPEN_PERSPECTIVES, DEFAULT_PERSPECTIVE);\r
         getProjectElement().setHint(ProjectKeys.DEFAULT_PERSPECTIVE, DEFAULT_PERSPECTIVE);\r
-        \r
+\r
         mm = new ModelManager();\r
         getProjectElement().setHint(UIModelManager.KEY_MODEL_MANAGER, mm);\r
     }\r