FORESTER 1.8

forester.tree
Class PreorderTreeIterator

java.lang.Object
  |
  +--forester.tree.PreorderTreeIterator
All Implemented Interfaces:
Iterator

public class PreorderTreeIterator
extends java.lang.Object
implements Iterator

Version:
1.020 -- last modified: 05/04/01
Author:
Christian M. Zmasek

Constructor Summary
PreorderTreeIterator(Tree t)
          Constructor which creates a preorder Iterator for Tree t.
 
Method Summary
 Node currentNode()
          Returns the current Node, unless all Nodes have been visited (isDone() returns true), in which case it returns null.
 void first()
          Resets the Iterator.
 boolean isDone()
          Returns true if all Nodes have been visited.
 void next()
          Advances the Iterator by one.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreorderTreeIterator

public PreorderTreeIterator(Tree t)
                     throws java.lang.Exception
Constructor which creates a preorder Iterator for Tree t. This implements the Iterator pattern as described in Gamma et al. "Design Patterns Elements of Reusable Object-Oriented Software".
Parameters:
t - Tree for which a Iterator is to be constructed.
Method Detail

first

public void first()
Resets the Iterator.
Specified by:
first in interface Iterator

next

public void next()
Advances the Iterator by one.
Specified by:
next in interface Iterator

isDone

public boolean isDone()
Returns true if all Nodes have been visited.
Specified by:
isDone in interface Iterator

currentNode

public Node currentNode()
Returns the current Node, unless all Nodes have been visited (isDone() returns true), in which case it returns null.
Specified by:
currentNode in interface Iterator

FORESTER 1.8