make Result implement GraphViz.ToGraphViz
authoradam <adam@megacz.com>
Mon, 26 Feb 2007 01:07:31 +0000 (20:07 -0500)
committeradam <adam@megacz.com>
Mon, 26 Feb 2007 01:07:31 +0000 (20:07 -0500)
darcs-hash:20070226010731-5007d-7f9a23ef5e2dfc1a4a2de56de2315b31d70eb5f8.gz

src/edu/berkeley/sbp/Result.java

index 8eccf96..cb351eb 100644 (file)
@@ -9,7 +9,7 @@ import java.io.*;
 import java.util.*;
 import java.lang.reflect.*;
 
-class Result {
+class Result implements GraphViz.ToGraphViz {
 
     private Forest f;
     private Node parent;
@@ -28,4 +28,20 @@ class Result {
         if (parent != null) phase = parent.phase();
     }
 
+    // GraphViz //////////////////////////////////////////////////////////////////////////////
+
+    public GraphViz.Node toGraphViz(GraphViz gv) {
+        if (gv.hasNode(this)) return gv.createNode(this);
+        GraphViz.Node n = gv.createNode(this);
+        n.label = ""+f;
+        n.shape = "rectangle";
+        if (parent()!=null) n.edge(parent, "");
+        n.color = "blue";
+        if (phase() != null)
+            ((GraphViz.Group)phase().toGraphViz(gv)).add(n);
+        return n;
+    }
+    public boolean isTransparent() { return false; }
+    public boolean isHidden() { return false; }
+
 }
\ No newline at end of file