checkpoint
authoradam <adam@megacz.com>
Sat, 15 Jul 2006 06:07:29 +0000 (02:07 -0400)
committeradam <adam@megacz.com>
Sat, 15 Jul 2006 06:07:29 +0000 (02:07 -0400)
darcs-hash:20060715060729-5007d-d54f655169659f6dec9ed89d90a0ed015a75961a.gz

src/edu/berkeley/sbp/Forest.java

index afe0a85..634d6ad 100644 (file)
@@ -136,10 +136,11 @@ public abstract class Forest<T> /*extends PrintableTree<Forest.MyBody<T>>*/
         }
         private void gather(TaskList tl, HashSet<Tree<T>>[] ht, HashSet<Tree<T>> target, Tree[] trees, int i) {
             if (i==ht.length) {
-                target.add(new Tree<T>(location, tag, trees));
+                target.add(new Tree<T>(location, tag, trees, unwrap));
                 return;
             }
             for(Tree<T> tree : ht[i]) {
+                /*
                 if (unwrap && i==trees.length-1) {
                     // I think this is wrong
                     Tree[] trees2 = new Tree[trees.length - 1 + tree.numChildren()];
@@ -148,10 +149,11 @@ public abstract class Forest<T> /*extends PrintableTree<Forest.MyBody<T>>*/
                         trees2[trees.length-1+j] = tree.child(j);
                     target.add(new Tree<T>(location, tag, trees2));
                 } else {
+                */
                     trees[i] = tree;
                     gather(tl, ht, target, trees, i+1);
                     trees[i] = null;
-                }
+                    //}
             }
         }
         public void expand(TaskList tl, HashSet<Tree<T>> ht) {
@@ -169,9 +171,11 @@ public abstract class Forest<T> /*extends PrintableTree<Forest.MyBody<T>>*/
             if (i==tokens.length) {
                 h.finish(tag, location);
 
+                /*
             } else if (unwrap && i==tokens.length-1) {
                 if (tokens[i] != null)
                     tokens[i].visit(h, null, 0);
+                */
 
             } else {
                 tokens[i].visit(new TreeBuilder<T>(h.toss) {
@@ -179,7 +183,7 @@ public abstract class Forest<T> /*extends PrintableTree<Forest.MyBody<T>>*/
                     public void addTree(Tree<T> t) { toks.add(t); }
                     public void finish(T head, Input.Region loc) {
                         int old = h.toks.size();
-                        h.addTree(new Tree<T>(loc, head, toks.toArray(tree_hint)));
+                        h.addTree(new Tree<T>(loc, head, toks.toArray(tree_hint), unwrap));
                         expand(i+1, h);
                         while(h.toks.size() > old) h.toks.remove(h.toks.size()-1);
                     }