|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.trees.TreeGraph
public class TreeGraph
A TreeGraph
is a tree with additional directed,
labeled arcs between arbitrary pairs of nodes. (So, it's a graph
with a tree skeleton.) This class is a container for the complete
treegraph structure, and does not inherit from
. Individual nodes in the treegraph are
represented by Tree
,
which do inherit from TreeGraphNode
sTree
, and the additional
labeled arcs are represented in the TreeGraphNode
s.
TreeGraphNode
Field Summary | |
---|---|
protected TreeGraphNode |
root
The root node of this treegraph. |
Constructor Summary | |
---|---|
TreeGraph(Tree t)
Construct a new TreeGraph having the same tree
structure and label values as an existing tree (but no shared
storage). |
Method Summary | |
---|---|
void |
addNodeToIndexMap(int index,
TreeGraphNode node)
Store a mapping from an arbitrary integer index to a node in this treegraph. |
TreeGraphNode |
getNodeByIndex(int index)
Return the node in the this treegraph corresponding to the specified integer index. |
static void |
main(String[] args)
Just for testing. |
TreeGraphNode |
root()
Return the root node of this treegraph. |
String |
toString()
Return a String representing this treegraph. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected TreeGraphNode root
Constructor Detail |
---|
public TreeGraph(Tree t)
TreeGraph
having the same tree
structure and label values as an existing tree (but no shared
storage). This constructor also assigns integer indices to
all the nodes, beginning with 0 and using a preorder tree
traversal.
t
- the tree to copyMethod Detail |
---|
public TreeGraphNode root()
public void addNodeToIndexMap(int index, TreeGraphNode node)
TreeGraph
constructor.
index
- the arbitrary integer indexnode
- the TreeGraphNode
to be indexedpublic TreeGraphNode getNodeByIndex(int index)
index
- the integer index of the node you want
TreeGraphNode
having the specified
index (or null
if such does not exist)public String toString()
String
representing this treegraph. By
default, the nodes of the treegraph are printed in Lispy
(parenthesized) format, with one node per line, indented
according to depth.
toString
in class Object
String
representation of this treegraphpublic static void main(String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |