- public Tree(Input.Region loc, T head) { this(loc, head, null); }
- public Tree(Input.Region loc, T head, Tree<T>[] children) { this(loc, head, children, false); }
- public Tree(Input.Region loc, T head, Tree<T>[] children, boolean lift) {
+ public Tree(Input.Region loc, NodeType head) {
+ location = loc;
+ ihead = head;
+ children = emptyTree;
+ }
+ public Tree(Input.Region loc, NodeType head, List<Tree<NodeType>> kids){
+ location = loc;
+ ihead = head;
+ if (kids.size() == 0)
+ children = emptyTree;
+ else {
+ children = new Tree[kids.size()];
+ kids.toArray(children);
+ }
+ }
+ public Tree(Input.Region loc, NodeType head, Tree<NodeType>[] kids) {
+ location = loc;
+ ihead = head;
+ children = (kids == null ? emptyTree : kids.clone());
+ }
+
+ // FIXME: fairly inefficient because we keep copying arrays
+ /** package-private constructor, allows setting the "lift" bit */
+ Tree(Input.Region loc, NodeType head, Tree<NodeType>[] children, boolean[] lifts) {