From 33caf3cccd3d404244249113854cdac3f99ec2fb Mon Sep 17 00:00:00 2001 From: adam Date: Sun, 25 Feb 2007 20:07:31 -0500 Subject: [PATCH] make Result implement GraphViz.ToGraphViz darcs-hash:20070226010731-5007d-7f9a23ef5e2dfc1a4a2de56de2315b31d70eb5f8.gz --- src/edu/berkeley/sbp/Result.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/edu/berkeley/sbp/Result.java b/src/edu/berkeley/sbp/Result.java index 8eccf96..cb351eb 100644 --- a/src/edu/berkeley/sbp/Result.java +++ b/src/edu/berkeley/sbp/Result.java @@ -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 -- 1.7.10.4