this.location = loc;
this.head = head;
this.lift = lift && children != null && children.length > 0;
-
- Tree<T>[] children2 = children==null ? new Tree[0] : new Tree[children.length];
- if (children != null) System.arraycopy(children, 0, children2, 0, children.length);
- this.children = children2;
+ this.children = ArrayUtil.clone(children, Tree.class);
}
public boolean isTransparent() { return false; }
public boolean isHidden() { return false; }
+
+ // TreeFunctor /////////////////////////////////////////////////////////////////////////////
+
public static interface TreeFunctor<T,R> extends Functor<Iterable<Tree<T>>, R> { }
}
return ret;
}
+ public static <T> T[] clone(T[] source, Class<T> c) {
+ T[] dest = (T[])Array.newInstance(c, source==null ? 0 : source.length);
+ if (source != null) System.arraycopy(source, 0, dest, 0, source.length);
+ return dest;
+ }
+
}