totally hid all the ugly JVM stuff, created a pretty ADT
[sbp.git] / src / edu / berkeley / sbp / Tree.java
index 558d234..d655aa4 100644 (file)
@@ -14,13 +14,10 @@ public class Tree<NodeType>
     implements Iterable<Tree<NodeType>> {
 
     private final Input.Region location;
-    private final NodeType     head;
+    private final NodeType     ihead;
     private final Tree<NodeType>[]    children;
     private final boolean      lift;
 
-    /** the element at the head of the tree */
-    public NodeType                 head()        { return head; }
-
     private Tree<NodeType> lifted() { return children[children.length-1]; }
 
     /** the number of children the tree has */
@@ -30,6 +27,10 @@ public class Tree<NodeType>
             : 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<Tree<NodeType>> children()    { return this; }
 
@@ -57,7 +58,7 @@ public class Tree<NodeType>
     /** package-private constructor, allows setting the "lift" bit */
     Tree(Input.Region loc, NodeType head, Tree<NodeType>[] 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);
     }