All Packages Class Hierarchy This Package Previous Next Index
Class DataStructures.TreeIterator
java.lang.Object
|
+----DataStructures.TreeIterator
- public abstract class TreeIterator
- extends java.lang.Object
Tree iterator class.
-
TreeIterator(BinarySearchTree)
- Construct the iterator.
-
advance()
- Advance the current position to the next node in the tree,
according to the traversal scheme.
-
first()
- Set the current position to the first item, according
to the traversal scheme.
-
isValid()
- Test if current position references a valid tree item.
-
main(String[])
-
-
retrieve()
- Return the item stored in the current position.
-
testItr(String, TreeIterator)
-
TreeIterator
public TreeIterator(DataStructures.BinarySearchTree theTree)
- Construct the iterator.
The current position is set to null.
- Parameters:
- theTree - the tree to which the iterator is
permanently bound.
first
public abstract void first()
- Set the current position to the first item, according
to the traversal scheme.
isValid
public final boolean isValid()
- Test if current position references a valid tree item.
- Returns:
- true if the current position is not null; false otherwise.
retrieve
public final java.lang.Object retrieve() throws Exceptions.ItemNotFound
- Return the item stored in the current position.
- Returns:
- the stored item.
- Throws: ItemNotFound
- if the current position is invalid.
advance
public abstract void advance() throws Exceptions.ItemNotFound
- Advance the current position to the next node in the tree,
according to the traversal scheme.
If the current position is null, then throw an exception.
This is the alternate strategy, that we did not use for lists.
- Throws: ItemNotFound
- if the current position is null.
main
public static void main(java.lang.String args[])
testItr
public static void testItr(java.lang.String type,
DataStructures.TreeIterator itr)
All Packages Class Hierarchy This Package Previous Next Index