|
|||||||||
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
,
Serialized FormField 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). |
|
TreeGraph(TreeGraphNode root)
|
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. |
java.util.Collection<TreeGraphNode> |
getNodes()
|
static void |
main(java.lang.String[] args)
Just for testing. |
TreeGraphNode |
root()
Return the root node of this treegraph. |
java.lang.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 copypublic TreeGraph(TreeGraphNode root)
Method 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 java.util.Collection<TreeGraphNode> getNodes()
public java.lang.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 java.lang.Object
String
representation of this treegraphpublic static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |