checkpoint harmony
[sbp.git] / src / edu / berkeley / sbp / Forest.java
index 705208f..dbcd3c0 100644 (file)
@@ -71,43 +71,32 @@ public abstract class Forest<T> {
             }
             return h;
         }
-        void addTo(HashSet<Body> h) {
-            if (!singleton) h.add(this);
-            else for(Body b : (IterableForest<T>)tokens[0]) b.addTo(h);
-        }
+
         void addTo(FastSet<Body> h) {
             if (!singleton) h.add(this, true);
             else for(Body b : (IterableForest<T>)tokens[0]) b.addTo(h);
         }
 
-
-        private boolean rep = false;
         public String toString() {
-            if (rep) return "***";
-            try {
-                rep = true;
-                StringBuffer ret = new StringBuffer();
-                for(int i=0; i<tokens.length; i++) {
-                    String q = tokens[i]==null ? "null" : tokens[i].toString();
-                    if (q.length() > 0) {
-                        ret.append(q);
-                        ret.append(" ");
-                    }
+            StringBuffer ret = new StringBuffer();
+            for(int i=0; i<tokens.length; i++) {
+                String q = tokens[i]==null ? "null" : tokens[i].toString();
+                if (q.length() > 0) {
+                    ret.append(q);
+                    ret.append(" ");
                 }
-                String tail = ret.toString().trim();
-                String head = (tag!=null && !tag.toString().equals("")) ? (tail.length() > 0 ? tag+":" : tag+"") : "";
-                if (tail.length() > 0) tail = "{" + tail + "}";
-                return head + tail;
-            } finally {
-                rep = false;
             }
+            String tail = ret.toString().trim();
+            String head = (tag!=null && !tag.toString().equals("")) ? (tail.length() > 0 ? tag+":" : tag+"") : "";
+            if (tail.length() > 0) tail = "{" + tail + "}";
+            return head + tail;
         }
     }
 
 
     // Ref //////////////////////////////////////////////////////////////////////////////
 
-    static abstract class IterableForest<T> extends Forest<T> implements Iterable<Forest.Body<T>> {
+    private static abstract class IterableForest<T> extends Forest<T> implements Iterable<Forest.Body<T>> {
         public abstract Iterator<Forest.Body<T>> iterator();
     }
 
@@ -184,6 +173,5 @@ public abstract class Forest<T> {
     // Statics //////////////////////////////////////////////////////////////////////////////
 
     private static Tree[] tree_hint = new Tree[0];
-    private static Body[] body_hint = new Body[0];
     private static final Forest[] emptyForestArray = new Forest[0];
 }