X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FTree.java;h=d655aa406985258d22beb143242893345b98d7a2;hb=b7cd03704a32c751575472eadfd433ce15694fce;hp=f87c5dc7d6761c054c337fb5e8765a7a04e77c73;hpb=2c1c0293545f3d12c23220fd05c663e6aa3f3de1;p=sbp.git diff --git a/src/edu/berkeley/sbp/Tree.java b/src/edu/berkeley/sbp/Tree.java index f87c5dc..d655aa4 100644 --- a/src/edu/berkeley/sbp/Tree.java +++ b/src/edu/berkeley/sbp/Tree.java @@ -1,3 +1,5 @@ +// Copyright 2006 all rights reserved; see LICENSE file for BSD-style license + package edu.berkeley.sbp; import edu.berkeley.sbp.*; import edu.berkeley.sbp.util.*; @@ -12,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 */ @@ -28,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; } @@ -55,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); }