|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.hendrix.grambler.Tree
public abstract class Tree
Constructor Summary | |
---|---|
Tree(java.lang.String name,
edu.hendrix.grambler.Input in,
int start,
int length)
|
Method Summary | |
---|---|
Tree |
getChild(int n)
Returns the nth child from this Tree. |
int |
getEndingIndex()
Returns the index into the parsed text of the final character matched by this Tree. |
abstract java.lang.String |
getErrorMessage()
Returns an error message. |
int |
getFirstLine()
Returns the line number of the first input character matched by this Tree. |
Tree |
getLastChild()
Returns the rightmost child of this Tree. |
int |
getLength()
Returns the number of characters matched by this Tree. |
java.lang.String |
getName()
Returns the name of the nonterminal or terminal that corresponds to this node. |
Tree |
getNamedChild(java.lang.String name)
Returns the first child with the given name. |
Tree |
getNamedChild(java.lang.String name,
int n)
Returns the nth child with the given name. |
int |
getNumChildren()
Returns number of child nodes. |
int |
getNumNamed(java.lang.String name)
Returns the number of children for whom getName().equals(name). |
int |
getStartingIndex()
Returns the index into the parsed text of the first character matched by this Tree. |
boolean |
hasNamed(java.lang.String name)
Returns whether there are any children for whom name().equals(name). |
boolean |
isEmpty()
Indicates whether this Tree matches a zero-length input. |
abstract boolean |
isError()
Indicates whether this is a syntax error. |
boolean |
isLeaf()
Indicates whether this is a leaf. |
boolean |
isNamed(java.lang.String name)
Returns true if getName().equals(name); returns false otherwise |
java.lang.String |
toString()
Returns the substring of the input text matched by this Tree. |
java.lang.String |
toTextTree()
Returns a String corresponding to a preorder traversal of this Tree. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Tree(java.lang.String name, edu.hendrix.grambler.Input in, int start, int length)
Method Detail |
---|
public java.lang.String getName()
public boolean isNamed(java.lang.String name)
public int getFirstLine()
public int getStartingIndex()
public int getEndingIndex()
public int getLength()
public boolean isLeaf()
public abstract boolean isError()
public abstract java.lang.String getErrorMessage()
java.lang.IllegalStateException
- if isError() is falsepublic boolean isEmpty()
public java.lang.String toString()
toString
in class java.lang.Object
public int getNumChildren()
public boolean hasNamed(java.lang.String name)
name
- name of a terminal or nonterminal symbol
public int getNumNamed(java.lang.String name)
name
- name of a terminal or nonterminal symbol
public Tree getChild(int n)
n
- index value, 0 <= n < getNumChildren()
java.lang.UnsupportedOperationException
- if not an Interior node
java.lang.ArrayIndexOutOfBoundsException
- if n is out of boundspublic Tree getLastChild()
java.lang.UnsupportedOperationException
- if not an Interior node
java.lang.ArrayIndexOutOfBoundsException
- if there are no childrenpublic Tree getNamedChild(java.lang.String name)
name
- name of a terminal or nonterminal symbol
public Tree getNamedChild(java.lang.String name, int n)
name
- name of a terminal or nonterminal symboln
- 0 <= n < numNamed(name)
java.lang.UnsupportedOperationException
- if not an Interior node
java.lang.ArrayIndexOutOfBoundsException
- if n is out of boundspublic java.lang.String toTextTree()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |