Exemplo n.º 1
0
  public ParseNode addChild(String newlabel) {

    ParseNode child = new ParseNode(newlabel, -1);
    children.addElement(child);
    child.setParent(this);
    return child;
  }
Exemplo n.º 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;
  }
Exemplo n.º 3
0
  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;
  }