]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@15964 ac1ea38d-2e2b...
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 27 May 2010 14:27:17 +0000 (14:27 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 27 May 2010 14:27:17 +0000 (14:27 +0000)
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/dependencies/CreateDependencyGraph.java

index 2d6f5e0072ee2340672893ba15727c0cd5dae5be..ea27809044d4fe6b893e1e919f6b7a3204262cf1 100644 (file)
@@ -23,13 +23,13 @@ public class CreateDependencyGraph implements Read<Graph> {
 \r
     public CreateDependencyGraph(Resource root, int levels, boolean isInverted) {\r
         this.root = root;\r
-        this.nodes = new HashMap<Resource, Node>();\r
         this.isInverted = isInverted;    \r
         this.levels = levels;\r
     }\r
 \r
     @Override\r
     public Graph perform(ReadGraph g) throws DatabaseException {\r
+        nodes = new HashMap<Resource, Node>();\r
         Graph graph = new Graph();\r
         graph.setRankdir("LR");\r
         if (g.isInstanceOf(root, SysdynResource.getInstance(g).IndependentVariable)) {\r
@@ -67,7 +67,9 @@ public class CreateDependencyGraph implements Read<Graph> {
         Collection<Resource> dependencies = g.getObjects(r, headRelation);\r
         Collection<Resource> dependants = new ArrayList<Resource>();\r
         for(Resource d : dependencies) {\r
-            Resource dependant = g.getSingleObject(d, tailRelation);\r
+            Resource dependant = g.getPossibleObject(d, tailRelation);\r
+            if(dependant == null)\r
+                continue;\r
             if(!g.isInstanceOf(dependant, sr.IndependentVariable)) {\r
                 break;\r
             }\r