|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--jdsl.core.ref.PostOrderIterator
The postorder iterator gives a postorder traversal of any tree. Creating this iterator takes O(N) where N = the number of positions in the tree, assuming that root, rightChild, leftChild, isInternal are O(1) in the tree implementation. All other methods take O(1) time.
| Constructor Summary | |
PostOrderIterator(InspectableBinaryTree tree)
Constructs a new PostOrderIterator to iterate over the given container Puts a reference to each position into the array -- takes O(N) time where N = the number of positions in the container |
|
PostOrderIterator(InspectableTree tree)
Constructs a new PostOrderIterator to iterate over the given container Puts a reference to each position into the array -- takes O(N) time where N = the number of positions in the container |
|
| Method Summary | |
java.lang.Object |
element()
Takes O(1) time |
void |
first()
Takes O(1) time Sets the current node to the first node. |
boolean |
hasNext()
Takes O(1) time |
java.lang.Object |
nextObject()
Takes O(1) time |
Position |
nextPosition()
Takes O(1) time |
java.lang.Object |
object()
Takes O(1) time |
Position |
position()
Takes O(1) time |
void |
reset()
Takes O(1) time Sets the current node to the first node. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PostOrderIterator(InspectableBinaryTree tree)
tree - The tree to iterate overpublic PostOrderIterator(InspectableTree tree)
tree - The tree to iterate over| Method Detail |
public boolean hasNext()
hasNext in interface ObjectIteratorjdsl.core.api.ObjectIteratorpublic java.lang.Object nextObject()
nextObject in interface ObjectIteratorjdsl.core.api.ObjectIteratorjava.util.NoSuchElementException - if iterator has moved past
the last objectpublic java.lang.Object object()
object in interface ObjectIteratorjdsl.core.api.ObjectIteratorjava.util.NoSuchElementException - When the iterator is in its
initial, before-the-first-object statepublic void reset()
reset in interface ObjectIterator
public java.lang.Object element()
throws java.util.NoSuchElementException
element in interface PositionIteratorjdsl.core.api.PositionIteratorjava.util.NoSuchElementException - When the iterator is in its
initial, before-the-first-position statepublic Position nextPosition()
nextPosition in interface PositionIteratorjdsl.core.api.PositionIteratorjava.util.NoSuchElementException - if iterator has moved past
the last position to be seen
public Position position()
throws java.util.NoSuchElementException
position in interface PositionIteratorjdsl.core.api.PositionIteratorjava.util.NoSuchElementException - When the iterator is in its
initial, before-the-first-position statepublic void first()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||