|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectup.Tree
public class Tree
A phrase structure tree.
Constructor Summary | |
---|---|
Tree()
Construct a new tree with a null label. |
|
Tree(java.lang.String label)
Constructs a new tree with the specified label |
Method Summary | |
---|---|
void |
addAsLeftmostSubtree(Tree tree)
Adds the specified tree as the leftmost subtree of this tree. |
void |
addAsRightmostSubtree(Tree tree)
Adds the specified tree as the rightmost subtree of this tree. |
void |
addLeftSibling(Tree tree)
Adds the specified tree as a left sibling to this tree. |
void |
addRightSibling(Tree tree)
Adds the specified tree as a right sibling to this tree. |
Tree |
getCopy()
Returns a copy of this tree. |
Tree |
getCopy(TreePredicate predicate)
Returns a copy of this tree, ignoring subtrees to which the specified predicate applies. |
java.lang.String |
getLabel()
Returns the label of the root node of this tree. |
java.util.List<Tree> |
getLeaves()
Returns the leaves of this tree. |
Tree |
getLeftmostSubtree()
Returns the leftmost immediate subtree of this tree. |
Tree |
getLeftSibling()
Returns the left sibling tree of this tree. |
int |
getNSubtrees()
Returns the number of immediate subtrees of this tree. |
Tree |
getRightmostSubtree()
Returns the rightmost immediate subtree of this tree. |
Tree |
getRightSibling()
Returns the right sibling tree of this tree. |
java.util.Deque<Tree> |
getSubtrees()
Returns the subtrees of this tree. |
Tree |
getSupertree()
Returns the immediate supertree of this tree. |
java.util.List<java.lang.String> |
getYield()
Returns the yield of this tree. |
boolean |
isInitial()
Tests whether this tree has any immediate supertrees. |
boolean |
isLeftmost()
Tests whether this tree is at the leftmost periphery. |
boolean |
isRightmost()
Tests whether this tree is at the rightmost periphery. |
boolean |
isTerminal()
Tests whether this tree has any immediate subtrees. |
void |
setLabel(java.lang.String label)
Replaces the label of the root node of this tree with the specified label. |
Tree |
splice(TreePredicate predicate)
Returns a copy of this tree, with all nodes to which the specified predicate applies spliced out. |
java.lang.String |
toString()
Returns a string representation of this tree. |
void |
traverseLeftToRight(TraversalHandler handler)
Traverses this tree left-to-right, sending notifications to the specified handler. |
void |
traverseLeftToRight(TreePredicate predicate,
TraversalHandler handler)
Traverses this tree left-to-right, sending notifications to the specified handler. |
void |
traverseRightToLeft(TraversalHandler handler)
Traverses this tree right-to-left, sending notifications to the specified handler. |
void |
traverseRightToLeft(TreePredicate predicate,
TraversalHandler handler)
Traverses this tree right-to-left, sending notifications to the specified handler. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Tree(java.lang.String label)
label
- the label of the new treepublic Tree()
Method Detail |
---|
public java.lang.String getLabel()
public Tree getSupertree()
public boolean isInitial()
true
iff this tree has no immediate supertreespublic Tree getLeftSibling()
null
if this
tree does not have any left sibling treespublic boolean isLeftmost()
true
iff this tree is at the leftmost peripherypublic Tree getRightSibling()
null
if this
tree does not have any right sibling treespublic boolean isRightmost()
true
iff this tree is at the rightmost peripherypublic int getNSubtrees()
public Tree getLeftmostSubtree()
public Tree getRightmostSubtree()
public boolean isTerminal()
true
iff this tree has no immediate subtreespublic java.util.Deque<Tree> getSubtrees()
public void setLabel(java.lang.String label)
label
- the new label of the root node of this treepublic void addLeftSibling(Tree tree)
tree
- the tree to be a added as the left sibling of this treepublic void addRightSibling(Tree tree)
tree
- the tree to be added as the right sibling of this treepublic void addAsLeftmostSubtree(Tree tree)
tree
- the tree to be added as the leftmost subtree of this treepublic void addAsRightmostSubtree(Tree tree)
tree
- the tree to be added as the rightmost subtree of this treepublic void traverseLeftToRight(TraversalHandler handler)
handler
- the handler to be notified during the traversal of this
treepublic void traverseLeftToRight(TreePredicate predicate, TraversalHandler handler)
predicate
- specifies subtrees that should be ignored during the
traversalhandler
- the handler to be notified during the traversal of this
treepublic void traverseRightToLeft(TraversalHandler handler)
handler
- the handler to be notified during the traversal of this
treepublic void traverseRightToLeft(TreePredicate predicate, TraversalHandler handler)
predicate
- specifies subtrees that should be ignored during the
traversalhandler
- the handler to be notified during the traversal of this
treepublic Tree getCopy()
public Tree getCopy(TreePredicate predicate)
predicate
- specifies subtrees that should not be copied
public Tree splice(TreePredicate predicate)
predicate
- specifies subtrees whose root nodes should be spliced
out
public java.util.List<java.lang.String> getYield()
public java.util.List<Tree> getLeaves()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |