use Appendable rather than StringBuffer for toJava()
[sbp.git] / src / edu / berkeley / sbp / util / PrintableTree.java
index 1b5ffc0..108f13e 100644 (file)
@@ -1,3 +1,5 @@
+// Copyright 2006-2007 all rights reserved; see LICENSE file for BSD-style license
+
 package edu.berkeley.sbp.util;
 import edu.berkeley.sbp.*;
 import edu.berkeley.sbp.util.*;
@@ -68,7 +70,7 @@ public abstract class PrintableTree<T extends PrintableTree> implements Iterable
     }
 
     /** append Java code to <tt>sb</tt> which evaluates to this instance */
-    public void toJava(StringBuffer sb) {
+    public void toJava(Appendable sb) throws IOException {
         sb.append("new "+this.getClass().getName()+"(null, ");
         String head = headToJava();
         sb.append(head);
@@ -83,9 +85,11 @@ public abstract class PrintableTree<T extends PrintableTree> implements Iterable
         sb.append("})");
     }
 
-    public GraphViz.Node toGraphViz(GraphViz gv) {
+    // this is here to keep it out of the javadoc for Tree<T>
+    
+    public GraphViz.StateNode toGraphViz(GraphViz gv) {
         if (gv.hasNode(this)) return gv.createNode(this);
-        GraphViz.Node n = gv.createNode(this);
+        GraphViz.StateNode n = gv.createNode(this);
         n.label = head()==null ? "" : head().toString();
         for(T t : this) n.edge(t, null);
         return n;