/*---------------------------------

  BST_Iterator.java

  (P) 1998 Laurentiu Cristofor

  implementation
  of a binary search tree
  iterator

-----------------------------------*/

class BST_Iterator
{
  private BS_Tree bst;
  private BST_Node current_node;

  public BST_Iterator(BS_Tree bst, BST_Node current)
  {
    this.bst      = bst;
    current_node  = current;
  }

  public boolean atEnd()
  {
    return current_node == null;
  }

  public void next()
  {
    current_node = bst.next(current_node);
  }
  
  public Object current()
  {
    if (current_node == null)
      return null;

    return current_node.value;
  }
}
