public class ParseNode extends Object implements Comparable
Modifier and Type | Field and Description |
---|---|
protected int |
end
Ending index (relative to overall file), inclusive, in the phrase of this parse node's subphrase
|
protected ParseNode |
leftChild
Child node of the first sub-subphrase of this node's subphrase
|
protected Parser |
parser
Reference to the invoking phrase parser object
|
protected int |
phraseType
Enumeration indicating what the phrase object of this parse node
|
protected ParseNode |
rightChild
Child node of the second sub-subphrase of this node's subphrase
|
protected int |
start
Beginning index (relative to overall file) in the phrase of this parse node's subphrase
|
Constructor and Description |
---|
ParseNode(Parser p,
int index,
int pos)
Creates a new parse node for a single word subphrase.
|
ParseNode(Parser p,
int start,
int end,
int type)
Creates a new instance of ParseNode for a multi-word subphrase.
|
Modifier and Type | Method and Description |
---|---|
void |
addChildren(ParseNode left,
ParseNode right)
Adds child nodes for A -> BC form parses
|
int |
compareTo(Object parseNode2)
Recursively compares two ParseNode objects for equivalent content
|
int |
depth()
Recursively computes the depth of the tree from the current node down
|
String |
toString()
Converts the parse node (and children) to a String
|
protected Parser parser
protected int phraseType
protected int start
protected int end
protected ParseNode leftChild
protected ParseNode rightChild
public ParseNode(Parser p, int start, int end, int type)
p
- PhraseParser containing the phrase to be parsedstart
- index to the first word of the subphraseend
- index to the last word of the subphrasetype
- subphrase type present in the phrase from start to endpublic ParseNode(Parser p, int index, int pos)
p
- PhraseParser containing the phrase to be parsedindex
- to the first word whose part of speech is being identifiedpos
- enumerated part of speech that maps to the word being identifiedpublic void addChildren(ParseNode left, ParseNode right)
left
- node to be added as the left child (B)right
- node to be added as the right node (C)public int compareTo(Object parseNode2)
compareTo
in interface Comparable
parseNode2
- second parseNode for comparison with firstpublic int depth()