public ParseNode addChild(String newlabel) { ParseNode child = new ParseNode(newlabel, -1); children.addElement(child); child.setParent(this); return child; }
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; }
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; }