#include <bintree.h>
Public Member Functions | |
BinTreeBreadthFirstIterator (BinTreeNode< T > *rootNode) | |
virtual | ~BinTreeBreadthFirstIterator () |
virtual bool | hasNext (void) |
virtual T | next (void) throw (OutOfBoundsException) |
virtual void | reset (void) |
BinTreeNode
. One should keep in mind that the behaviour of this iterator is unknown when a binary tree is being resized while the iterator is iterating over the tree. It is best to reset the iterator (with a call to the function BinTreeBreadthFirstIterator::reset
) with every resize operation of the binary tree. seal::BinTreeBreadthFirstIterator< T >::BinTreeBreadthFirstIterator | ( | BinTreeNode< T > * | rootNode | ) | [inline] |
Constructor.
rootNode | The root node of the binary tree which the iterator should iterate over. |
virtual seal::BinTreeBreadthFirstIterator< T >::~BinTreeBreadthFirstIterator | ( | ) | [inline, virtual] |
Destructor.
bool seal::BinTreeBreadthFirstIterator< T >::hasNext | ( | void | ) | [inline, virtual] |
Returns true if there is a next element in the tree to which the iterator can iterate to; False otherwise.
Implements seal::AbstractIterator< T >.
T seal::BinTreeBreadthFirstIterator< T >::next | ( | void | ) | throw (OutOfBoundsException) [inline, virtual] |
Returns the next element in the tree if it exists; Else throws an OutOfBoundsException
.
Implements seal::AbstractIterator< T >.
void seal::BinTreeBreadthFirstIterator< T >::reset | ( | void | ) | [inline, virtual] |
Resets the iterator to the first element, that is to the root node of tree. After a call to this function, the iterator can iterate over the entire tree.
Implements seal::AbstractIterator< T >.