예제 #1
0
  public ParseNode addChild(String newlabel) {

    ParseNode child = new ParseNode(newlabel, -1);
    children.addElement(child);
    child.setParent(this);
    return child;
  }
예제 #2
0
  public ParseNode addChild(ParseNode child) {

    if (child == null) throw new NullPointerException("Can't add null node to parse tree");

    children.addElement(child);
    child.setParent(this);
    return child;
  }
예제 #3
0
  public ParseNode insertChild(ParseNode child) {
    if (child == null) {
      throw new NullPointerException("Can't add null node to parse tree");
    }

    children.insertElementAt(child, 0);
    child.setParent(this);
    return child;
  }