public static class EvtreeNode_FBcl.IteratorEvoutTree extends java.lang.Object implements java.lang.Iterable<EvtreeNode_FBcl>, java.util.Iterator<EvtreeNode_FBcl>
Iterator for the tree for all EvtreeNode_FBcl.nodes starting from the given node as root.
It is offered also as Iterable:
A normal LinkedList etc. is also an Iterable.
Whereas an Iterator is a specific instance with some data for iteration.
This class is immediately the Iterator instance.
A for statement needs first an Iterable which is also given with this class.
See iterator().| Modifier and Type | Field and Description |
|---|---|
(package private) boolean |
bHasNextDone |
(package private) EvtreeNode_FBcl |
currNode |
(package private) java.util.ListIterator<EvtreeNode_FBcl> |
iterCurrNode |
(package private) java.util.Stack<java.util.ListIterator<EvtreeNode_FBcl>> |
stackIter |
| Constructor and Description |
|---|
IteratorEvoutTree(EvtreeNode_FBcl rootNode,
boolean bAlsoRootNode)
Creates the iterator from the given rootNode
|
| Modifier and Type | Method and Description |
|---|---|
EvtreeNode_FBcl |
getNextSibling()
Sets the iterator to the next sibling in the tree and returns this sibling for test.
|
EvtreeNode_FBcl |
getSibling()
|
boolean |
hasNext()
Standard quest, see
Iterator.hasNext() |
java.util.Iterator<EvtreeNode_FBcl> |
iterator()
Returns this as
Iterator if this is presented as Iterable. |
EvtreeNode_FBcl |
next() |
EvtreeNode_FBcl currNode
java.util.ListIterator<EvtreeNode_FBcl> iterCurrNode
java.util.Stack<java.util.ListIterator<EvtreeNode_FBcl>> stackIter
boolean bHasNextDone
public IteratorEvoutTree(EvtreeNode_FBcl rootNode, boolean bAlsoRootNode)
rootNode - bAlsoRootNode - returns also the rootNode itself as first for iteration.public java.util.Iterator<EvtreeNode_FBcl> iterator()
Iterator if this is presented as Iterable.
Note: An Iterable has exact only this operation.iterator in interface java.lang.Iterable<EvtreeNode_FBcl>public boolean hasNext()
Iterator.hasNext()hasNext in interface java.util.Iterator<EvtreeNode_FBcl>public EvtreeNode_FBcl next()
next in interface java.util.Iterator<EvtreeNode_FBcl>public EvtreeNode_FBcl getSibling()
next()
respectively which is current after hasNext().
It uses the internal iterCurrNode in the last stackIter level
to get the next EvTreeNode_FBcl#nodes as sibling, but restore the iterator to the point before after them
so that the normal iteration is restored, not disturbed.public EvtreeNode_FBcl getNextSibling()
hasNext() can be called or not, next() delivers this next sibling.next() or null if it has not a next sibling