X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FTree.java;fp=src%2Fedu%2Fberkeley%2Fsbp%2FTree.java;h=d655aa406985258d22beb143242893345b98d7a2;hp=558d23459bcee59296d9111ec7aa784c0bc8c698;hb=a09bae7235677c1b3b77f827bdd6722a9e88a122;hpb=d6c55258bdfa1d46c471773c7f6095a6d1b7c46c diff --git a/src/edu/berkeley/sbp/Tree.java b/src/edu/berkeley/sbp/Tree.java index 558d234..d655aa4 100644 --- a/src/edu/berkeley/sbp/Tree.java +++ b/src/edu/berkeley/sbp/Tree.java @@ -14,13 +14,10 @@ public class Tree implements Iterable> { private final Input.Region location; - private final NodeType head; + private final NodeType ihead; private final Tree[] children; private final boolean lift; - /** the element at the head of the tree */ - public NodeType head() { return head; } - private Tree lifted() { return children[children.length-1]; } /** the number of children the tree has */ @@ -30,6 +27,10 @@ public class Tree : children.length; } + /** the element at the head of the tree */ + public NodeType head() { return ihead; } + public NodeType getHead() { return ihead; } + /** the tree's children */ public Iterable> children() { return this; } @@ -57,7 +58,7 @@ public class Tree /** package-private constructor, allows setting the "lift" bit */ Tree(Input.Region loc, NodeType head, Tree[] children, boolean lift) { this.location = loc; - this.head = head; + this.ihead = head; this.lift = lift && children != null && children.length > 0; this.children = ArrayUtil.clone(children, Tree.class); }