|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.util.PreorderTreeIterator
public class PreorderTreeIterator
Provides a mechanism for visiting each node in a tree using preorder traversal. Preorder traversal is a common tree traversal algorithm where a node is visited before any of its children are; thus the tree's root is the first node, the root's first child is the second node, the first child's first child would be the third node, etc.
Constructor Summary | |
---|---|
PreorderTreeIterator(com.sas.models.TreeInterface tree)
Constructor. |
Method Summary | |
---|---|
com.sas.models.SimpleNodeInterface |
getNode()
Returns the current node. |
int |
getNodeIndex()
Returns the zero-based index associated with the current node. |
com.sas.models.SimpleNodeInterface[] |
getNodeParents()
Returns the parents of the current node. |
boolean |
hasMoreElements()
Alias for hasMoreNodes() to satisfy
java.util.Enumeration . |
boolean |
hasMoreNodes()
Tests if nextNode() has another node to return. |
java.lang.Object |
nextElement()
Alias for nextNode() to satisfy
java.util.Enumeration . |
com.sas.models.SimpleNodeInterface |
nextNode()
Returns the current node and advances to the next one. |
void |
reset()
Resets the iterator to the beginning of the tree. |
Methods inherited from class com.sas.util.TreeIterator |
---|
equals, equals, getTree, hasNext, next, remove, setNode, setNodeIndex |
Constructor Detail |
---|
public PreorderTreeIterator(com.sas.models.TreeInterface tree)
tree
- The tree to traverse.Method Detail |
---|
public boolean hasMoreNodes()
nextNode()
has another node to return.
true
if there is another node, and
false
otherwise.nextNode()
public com.sas.models.SimpleNodeInterface nextNode()
java.util.NoSuchElementException
if there isn't
a current node;
to avoid check hasMoreNodes()
before calling this.
SimpleNodeInterface
instance; will never be
null
.hasMoreNodes()
public final boolean hasMoreElements()
hasMoreNodes()
to satisfy
java.util.Enumeration
.
true
if there is another node, and
false
otherwise.hasMoreNodes()
public final java.lang.Object nextElement()
nextNode()
to satisfy
java.util.Enumeration
.
null
object that can be cast to
SimpleNodeInterface
.nextNode()
public void reset()
public com.sas.models.SimpleNodeInterface getNode()
TreeIterator.setNode(com.sas.models.SimpleNodeInterface)
,
getNodeIndex()
,
getNodeParents()
public com.sas.models.SimpleNodeInterface[] getNodeParents()
getNode()
public int getNodeIndex()
getNode()
,
TreeIterator.setNodeIndex(int)
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |