]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
(refs #5417) Standard variable performance optimization and API refinement
authorvillberg <villberg@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Sat, 18 Oct 2014 18:57:58 +0000 (18:57 +0000)
committervillberg <villberg@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Sat, 18 Oct 2014 18:57:58 +0000 (18:57 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@30449 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/drop/ChartDropAction.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/childrules/VariableChildRule.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Configuration.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/imagerules/VariableImageRule.java

index e5e308acf4d64a9c60f7a3d8989f5e1c513a3088..72d6a34d76165b49b7dc34f1fcb22edabb1bd840 100644 (file)
@@ -69,7 +69,7 @@ public class ChartDropAction implements DropActionFactory {
                             if(variable == null)\r
                                 continue;\r
 \r
-                            Resource represents = (Resource)variable.getPropertyValue(graph, Variables.REPRESENTS);\r
+                            Resource represents = (Resource)variable.getRepresents(graph);\r
                             if(represents == null || \r
                                     !(graph.isInstanceOf(represents, sr.IndependentVariable) || \r
                                             graph.isInstanceOf(represents, sr.Input)))\r
index 270ad2280390c35b3ea413a4378203ec9ef37918..783961af6d17aba70cdb170ae176793733eef01c 100644 (file)
@@ -59,7 +59,7 @@ public class VariableChildRule implements ChildRule {
         ArrayList<Variable> variables = new ArrayList<Variable>();\r
 \r
         for(Variable child : variable.getChildren(graph)) {\r
-            Resource represents = (Resource)child.getPropertyValue(graph, Variables.REPRESENTS);\r
+            Resource represents = child.getRepresents(graph);\r
             if(graph.isInstanceOf(represents, sr.IndependentVariable)) {\r
                 variables.add(child);\r
             } else if (graph.isInstanceOf(represents, sr.Input)) {\r
index fdb9ee0b608cd9fa8e77b622b1dc5d336f5ef412..659f63f24a55010b225504c68caf15c0a9f6b25e 100644 (file)
@@ -52,7 +52,7 @@ public class Configuration extends ViewpointContributor<ConfigurationNode<Resour
 \r
 \r
                for(Variable child : variable.getChildren(graph)) {\r
-                       Resource represents = (Resource)child.getPropertyValue(graph, Variables.REPRESENTS);\r
+                       Resource represents = child.getRepresents(graph);\r
                        if(graph.isInstanceOf(represents, sr.IndependentVariable)) {\r
                                variables.put(child.getName(graph), child);\r
                        } else if (graph.isInstanceOf(represents, sr.Input)) {\r
@@ -66,25 +66,25 @@ public class Configuration extends ViewpointContributor<ConfigurationNode<Resour
                \r
                for (String s : variables.keySet()) {\r
                        Variable v = variables.get(s);\r
-                       Resource represents = (Resource)v.getPropertyValue(graph, Variables.REPRESENTS);\r
+                       Resource represents = v.getRepresents(graph);\r
                        result.add(new VariableNode<Variable>(v, represents));\r
                }\r
                \r
                for (String s : inputs.keySet()) {\r
                        Variable v = inputs.get(s);\r
-                       Resource represents = (Resource)v.getPropertyValue(graph, Variables.REPRESENTS);\r
+                       Resource represents = v.getRepresents(graph);\r
                        result.add(new InputNode(v, represents));\r
                }\r
                \r
                for (String s : modules.keySet()) {\r
                        Variable v = modules.get(s);\r
-                       Resource represents = (Resource)v.getPropertyValue(graph, Variables.REPRESENTS);\r
+                       Resource represents = v.getRepresents(graph);\r
                        result.add(new ModuleNode(v, represents));\r
                }\r
                \r
                for (String s : enumerations.keySet()) {\r
                        Variable v = enumerations.get(s);\r
-                       Resource represents = (Resource)v.getPropertyValue(graph, Variables.REPRESENTS);\r
+                       Resource represents = v.getRepresents(graph);\r
                        result.add(new EnumerationNode(v, represents));\r
                }\r
                \r
index ba780a646d131d297aa037c45963bb8e9bc2f75f..7c1b577952d76f3084c1e80f90b5069ddb520dc7 100644 (file)
@@ -21,7 +21,6 @@ import org.simantics.db.ReadGraph;
 import org.simantics.db.Resource;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.layer0.variable.Variable;\r
-import org.simantics.db.layer0.variable.Variables;\r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.ui.Activator;\r
@@ -40,7 +39,7 @@ public class VariableImageRule implements ImageRule {
 \r
         String image =  "icons/brick.png";\r
         \r
-        Resource r =  (Resource)var.getPropertyValue(graph, Variables.REPRESENTS);\r
+        Resource r =  var.getRepresents(graph);\r
         if(r != null) {\r
             Layer0 L0 = Layer0.getInstance(graph);\r
             SysdynResource sr = SysdynResource.getInstance(graph);\r