|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object TreeIterator<T>
public class TreeIterator<T>
Constructor Summary | |
---|---|
TreeIterator(BinaryTreeBasis<T> bTree)
This is the constructor for the TreeIterator . |
Method Summary | |
---|---|
boolean |
hasNext()
This method is used to verify that the TreeIterator has more elements to return. |
T |
next()
This method is used to retrieve the next element from the TreeIterator . |
void |
remove()
This method is not supported in the TreeIterator . |
void |
setInorder()
This method sets the order of retrieval from the TreeIterator to be Inorder. |
void |
setPostorder()
This method sets the order of retrieval from the TreeIterator to be Postorder. |
void |
setPreorder()
This method sets the order of retrieval from the TreeIterator to be Preorder. |
int |
size()
This method is used to obtain the number of elements available in the iterator. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TreeIterator(BinaryTreeBasis<T> bTree)
TreeIterator
.
bTree
- The BinaryTreeBasis
that this iterator will operate on.Method Detail |
---|
public int size()
TreeNode
's available in the iterator.public boolean hasNext()
TreeIterator
has more elements to return.
hasNext
in interface java.util.Iterator<T>
true
if there are more elements to return, false
otherwise.public T next() throws java.util.NoSuchElementException
TreeIterator
.
next
in interface java.util.Iterator<T>
TreeIterator
.
java.util.NoSuchElementException
public void remove() throws java.lang.UnsupportedOperationException
TreeIterator
.
remove
in interface java.util.Iterator<T>
This
- method will always throw a UnsupportedOperationException
java.lang.UnsupportedOperationException
public void setPreorder()
TreeIterator
to be Preorder.
This method will call the private method preorder() in order to populate the queue.
public void setInorder()
TreeIterator
to be Inorder.
This method will call the private method inorder() in order to populate the queue.
public void setPostorder()
TreeIterator
to be Postorder.
This method will call the private method postorder() in order to populate the queue.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |