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 ParseNodeVector getChildren(String label) { int i; ParseNodeVector v = new ParseNodeVector(); for (i = 0; i < children.size(); i++) { ParseNode pn = children.elementAt(i); if (pn.getLabel().equals(label)) v.addElement(pn); } return v; }