All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jdsl.core.ref.InOrderIterator

java.lang.Object
   |
   +----jdsl.core.ref.InOrderIterator

public class InOrderIterator
extends Object
The inorder iterator tells what, for an inorder traversal of the tree, the first, last, next, prev elements are, and can output a whole traversal of the tree, including the leaves.


Constructor Index

 o InOrderIterator(InspectableBinaryTree)
Constructs a new InOrderIterator to iterate the given container

Method Index

 o current()
Gets the current Position
 o first()
The first position in the in-order traversal
 o last()
The last position in the in-order traversal
 o next()
Gets the next Position
 o prev()
Returns the in-order-previous of the given locator, including the leafs Throws a BoundaryViolationException if c is the first node in inorder traversal
 o setCurrent(Position)
Sets the Iterator's current Locator to newCurrent.
 o traversal()
Generates the inorder traversal of the tree.

Constructors

 o InOrderIterator
 public InOrderIterator(InspectableBinaryTree tree)
Constructs a new InOrderIterator to iterate the given container

Methods

 o current
 public Position current()
Gets the current Position

Returns:
the current Position.
 o setCurrent
 public void setCurrent(Position newCurrent)
Sets the Iterator's current Locator to newCurrent.

Parameters:
newCurrent - the Iterator's new current Locator
 o next
 public Position next() throws BoundaryViolationException
Gets the next Position

Throws: BoundaryViolationException
If the iterator is at the last Position.
 o prev
 public Position prev() throws BoundaryViolationException
Returns the in-order-previous of the given locator, including the leafs Throws a BoundaryViolationException if c is the first node in inorder traversal

Returns:
the in-order-previous of the given locator, including the leaves
Throws: BoundaryViolationException
if called when at the beginning of the tree.
 o first
 public Position first()
The first position in the in-order traversal

Returns:
a locator to the in-order-first element of the tree, which is a leaf goes from left child to left child until reaching a leaf.
 o last
 public Position last()
The last position in the in-order traversal

Returns:
a locator to the in-order-last element of the tree, which is a leaf goes from right child to right child until reaching a leaf.
 o traversal
 public Sequence traversal()
Generates the inorder traversal of the tree.

Returns:
the inorder sequence of locators to the internal AND leaf nodes of the tree

All Packages  Class Hierarchy  This Package  Previous  Next  Index