|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ed.inf.tree.GeneralTree<T>
public final class GeneralTree<T extends ITreeNode<T>>
Constructor Summary | |
---|---|
GeneralTree(T rootNode)
|
Method Summary | |
---|---|
boolean |
containsNode(int testIndex)
|
boolean |
containsNode(T testNode)
|
T |
get(int testIndex)
|
T |
getLowestCommonAncestor(T thisNode,
T thatNode)
|
T |
getRootNode()
Get the root node of this tree. |
boolean |
isAncestor(T startNode,
T testNode)
Tests if testNode is an anscestor of startNode . |
boolean |
isDescendant(T startNode,
T testNode)
Tests if testNode is a descendant of startNode . |
java.util.Iterator<T> |
levelOrderIterator()
|
ITreeWalker<T> |
levelOrderTreeWalker(ITreeNodeAction<T> visitorAction)
Obtain a visitor that will traverse the tree from the root node in level-order. |
int |
size()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GeneralTree(T rootNode)
Method Detail |
---|
public T getRootNode()
ITree
getRootNode
in interface ITree<T extends ITreeNode<T>>
public boolean containsNode(T testNode)
containsNode
in interface ITree<T extends ITreeNode<T>>
public boolean containsNode(int testIndex)
containsNode
in interface ITree<T extends ITreeNode<T>>
public T get(int testIndex)
get
in interface ITree<T extends ITreeNode<T>>
public T getLowestCommonAncestor(T thisNode, T thatNode)
getLowestCommonAncestor
in interface ITree<T extends ITreeNode<T>>
public java.util.Iterator<T> levelOrderIterator()
levelOrderIterator
in interface ITree<T extends ITreeNode<T>>
public boolean isDescendant(T startNode, T testNode)
testNode
is a descendant of startNode
. This means traversing
from the startNode
until it finds the testNode
.
isDescendant
in interface ITree<T extends ITreeNode<T>>
startNode
- the node to start from, can be null.testNode
- the node to be tested, can be null.
true
if testNode
is an descendant of startNode
,
false
otherwise.public int size()
size
in interface ITree<T extends ITreeNode<T>>
public boolean isAncestor(T startNode, T testNode)
ITree
testNode
is an anscestor of startNode
. This means traversing
from the startNode
until it finds the testNode
.
isAncestor
in interface ITree<T extends ITreeNode<T>>
startNode
- the node to start from, can be null.testNode
- the node to be tested, can be null.
true
if testNode
is an ancestor of startNode
,
false
otherwise.public ITreeWalker<T> levelOrderTreeWalker(ITreeNodeAction<T> visitorAction)
ITree
visitorAction
will be performed.
levelOrderTreeWalker
in interface ITree<T extends ITreeNode<T>>
visitorAction
- the action to be executed at each node visited.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |