|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
T - the type of an element maintained by this tree nodepublic interface TreeNode<T>
An interface for a tree node.
| Method Summary | |
|---|---|
void |
addChild(TreeNode<T> child)
Appends the specified node to the children of this node. |
java.util.List<TreeNode<T>> |
getAncestors()
Returns a list of all the ancestors of this node, i.e., all the nodes on the unique simple path from the root to this node. |
java.util.Collection<TreeNode<T>> |
getChildren()
Returns all the children of this node. |
int |
getDepth()
Returns the depth of this node. |
TreeNode<T> |
getDescendant(java.lang.Object o)
Returns the descendant of this node with the specified element. |
java.util.Set<TreeNode<T>> |
getDescendants()
Returns a set of all the descendants of this node. |
int |
getHeight()
Returns the height of this node. |
TreeNode<T> |
getParent()
Returns the parent of this node. |
java.util.List<TreeNode<T>> |
getProperAncestors()
Returns a list of all the proper ancestors of this node, i.e., all the nodes on the unique simple path from the root to the parent of this node. |
java.util.List<TreeNode<T>> |
getSiblings()
Returns a list of all the siblings of this node. |
boolean |
hasAncestor(java.lang.Object o)
Returns true if this node has an ancestor with the specified element; otherwise returns false. |
boolean |
hasChild()
Returns true if this node has some child; otherwise returns false. |
boolean |
hasChild(java.lang.Object o)
Returns true if this node has a child with the specified element; otherwise returns false. |
boolean |
hasDescendant(java.lang.Object o)
Returns true if this node has a descendant with the specified element; otherwise returns false. |
boolean |
hasParent()
Returns true if this node has some parent; otherwise returns false. |
boolean |
hasParent(java.lang.Object o)
Returns true if this node has a parent with the specified element; otherwise returns false. |
boolean |
hasProperAncestor(java.lang.Object o)
Returns true if this node has a proper ancestor with the specified element; otherwise returns false. |
boolean |
hasSibling()
Returns true if this node has some sibling; otherwise returns false. |
boolean |
hasSibling(java.lang.Object o)
Returns true if this node has a sibling with the specified element; otherwise returns false. |
boolean |
isLeaf()
Returns true if this node is a leaf node; otherwise returns false. |
void |
setChildren(java.util.Collection<TreeNode<T>> children)
Sets the collection of the specified nodes to the children of this node. |
void |
setParent(TreeNode<T> parent)
Sets the specified node to the parent of this node. |
int |
size()
Returns the size of this node, i.e., the number of its descendants including itself. |
| Methods inherited from interface net.junaraki.libtree.Node |
|---|
getDegree, getElement, hasElement, hasElement, setElement |
| Method Detail |
|---|
int size()
boolean isLeaf()
int getDepth()
int getHeight()
TreeNode<T> getParent()
void setParent(TreeNode<T> parent)
parent - boolean hasParent(java.lang.Object o)
o -
boolean hasParent()
java.util.Collection<TreeNode<T>> getChildren()
void setChildren(java.util.Collection<TreeNode<T>> children)
children - void addChild(TreeNode<T> child)
child - boolean hasChild(java.lang.Object o)
o -
boolean hasChild()
java.util.List<TreeNode<T>> getAncestors()
java.util.List<TreeNode<T>> getProperAncestors()
boolean hasAncestor(java.lang.Object o)
o -
boolean hasProperAncestor(java.lang.Object o)
o -
java.util.Set<TreeNode<T>> getDescendants()
TreeNode<T> getDescendant(java.lang.Object o)
boolean hasDescendant(java.lang.Object o)
o -
java.util.List<TreeNode<T>> getSiblings()
boolean hasSibling(java.lang.Object o)
o -
boolean hasSibling()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||