fixes to Node.toGraphViz()
authoradam <adam@megacz.com>
Mon, 26 Feb 2007 01:20:09 +0000 (20:20 -0500)
committeradam <adam@megacz.com>
Mon, 26 Feb 2007 01:20:09 +0000 (20:20 -0500)
darcs-hash:20070226012009-5007d-e0abf5a2250a725af1bc7c74eac4adfb4c1e5a21.gz

src/edu/berkeley/sbp/Node.java

index 14114b9..8710863 100644 (file)
@@ -58,7 +58,6 @@ final class Node
                 if (pos>0)  child.reduce(r, pos-1, target, null);
                 else new Reduction(child, r, r.rewrite(child.phase().getLocation().createRegion(target.getLocation())), target);
             }
                 if (pos>0)  child.reduce(r, pos-1, target, null);
                 else new Reduction(child, r, r.rewrite(child.phase().getLocation().createRegion(target.getLocation())), target);
             }
-
         holder[pos] = old;
     }
 
         holder[pos] = old;
     }
 
@@ -87,14 +86,14 @@ final class Node
     // GraphViz //////////////////////////////////////////////////////////////////////////////
 
     public GraphViz.Node toGraphViz(GraphViz gv) {
     // GraphViz //////////////////////////////////////////////////////////////////////////////
 
     public GraphViz.Node toGraphViz(GraphViz gv) {
+        if (results.size()==0) return null;
         if (gv.hasNode(this)) return gv.createNode(this);
         GraphViz.Node n = gv.createNode(this);
         n.label = ""+state.toStringx();
         n.shape = "rectangle";
         boolean hasparents = false;
         if (gv.hasNode(this)) return gv.createNode(this);
         GraphViz.Node n = gv.createNode(this);
         n.label = ""+state.toStringx();
         n.shape = "rectangle";
         boolean hasparents = false;
-        //for(Node parent : parents()) { hasparents = true; n.edge(parent, ""); }
-        //for(Forest result : resultMap) n.edge(result, "");
-        n.color = !hasparents ? "blue" : /*state.evil ? "red" :*/ "green";
+        for(Result r : results) n.edge(r, "");
+        n.color = state.doomed ? "red" : "green";
         ((GraphViz.Group)phase().toGraphViz(gv)).add(n);
         return n;
     }
         ((GraphViz.Group)phase().toGraphViz(gv)).add(n);
         return n;
     }