From e14f41fe193ceef8dfd8b4bc2f327e3550231a4c Mon Sep 17 00:00:00 2001 From: adam Date: Sun, 8 Jan 2006 04:43:09 -0500 Subject: [PATCH] misc updates darcs-hash:20060108094309-5007d-06d99764e554c3a3cd6fb1b4b64a8e736c80c132.gz --- src/edu/berkeley/sbp/Forest.java | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/src/edu/berkeley/sbp/Forest.java b/src/edu/berkeley/sbp/Forest.java index 705208f..dbcd3c0 100644 --- a/src/edu/berkeley/sbp/Forest.java +++ b/src/edu/berkeley/sbp/Forest.java @@ -71,43 +71,32 @@ public abstract class Forest { } return h; } - void addTo(HashSet h) { - if (!singleton) h.add(this); - else for(Body b : (IterableForest)tokens[0]) b.addTo(h); - } + void addTo(FastSet h) { if (!singleton) h.add(this, true); else for(Body b : (IterableForest)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 0) { - ret.append(q); - ret.append(" "); - } + StringBuffer ret = new StringBuffer(); + for(int i=0; i 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 extends Forest implements Iterable> { + private static abstract class IterableForest extends Forest implements Iterable> { public abstract Iterator> iterator(); } @@ -184,6 +173,5 @@ public abstract class Forest { // 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]; } -- 1.7.10.4