package org.karaffe.compiler.tree;

import org.karaffe.compiler.util.Position;

public final class TreeFactory {
  public static Tree newTree(NodeType nodeType) {
    return new SimpleTree(nodeType);
  }

  public static Tree newTree(NodeType nodeType, String name) {
    return new NamedTree(nodeType, name);
  }

  public static Tree newTree(NodeType nodeType, Position position) {
    return new PositionedSimpleTree(nodeType, position);
  }

  public static Tree newTree(NodeType nodeType, String name, Position position) {
    return new NamedPositionTree(nodeType, name, position);
  }
}

@@ -73,16 +73,42 @@
 ition;%0A%0A
+import java.util.Arrays;%0A%0A
 public f
@@ -610,11 +610,855 @@
 on);%0A  %7D
+%0A%0A  public static Tree newTree(NodeType nodeType, Tree... children) %7B%0A    Tree tree = TreeFactory.newTree(nodeType);%0A    tree.addAllChildren(Arrays.asList(children));%0A    return tree;%0A  %7D%0A%0A  public static Tree newTree(NodeType nodeType, String name, Tree... children) %7B%0A    Tree tree = TreeFactory.newTree(nodeType, name);%0A    tree.addAllChildren(Arrays.asList(children));%0A    return tree;%0A  %7D%0A%0A  public static Tree newTree(NodeType nodeType, Position position, Tree... children) %7B%0A    Tree tree = TreeFactory.newTree(nodeType, position);%0A    tree.addAllChildren(Arrays.asList(children));%0A    return tree;%0A  %7D%0A%0A  public static Tree newTree(NodeType nodeType, String name, Position position, Tree... children) %7B%0A    Tree tree = TreeFactory.newTree(nodeType, name, position);%0A    tree.addAllChildren(Arrays.asList(children));%0A    return tree;%0A  %7D
 %0A%7D%0A

Add factory method