Class Iterator

java.lang.Object
  |
  +--Iterator
All Implemented Interfaces:
java.io.Serializable

public class Iterator
extends java.lang.Object
implements java.io.Serializable

Iterator for a list of nodes To be used with my Node and Nodelist classes.
Author: Neil Short

See Also:
Serialized Form

Constructor Summary
Iterator(Node x, Node y)
          (Don't try this at home)--Constructor called only by Nodelist class.
 
Method Summary
 java.lang.Object back()
          Move Iterator back one position and return data at the new location.
 Node getNode()
          Get the current Node.
 void gotoBack()
          Locate Iterator at the end of the list.
 void gotoFirst()
          Locate Iterator at the front of the list.
 boolean hasNext()
          Checks to see if Iterator is at the end of the list.
 boolean hasPrev()
          Check if Iterator is at the beginning of the list.
 java.lang.Object next()
          Advance Iterater one position and return the data at that location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Iterator

public Iterator(Node x,
                Node y)
(Don't try this at home)--Constructor called only by Nodelist class.

Method Detail

getNode

public Node getNode()
Get the current Node. Caution! This method returns a Node and not the data referenced by the node. Use very cautiously.


gotoFirst

public void gotoFirst()
Locate Iterator at the front of the list.


gotoBack

public void gotoBack()
Locate Iterator at the end of the list.


hasNext

public boolean hasNext()
Checks to see if Iterator is at the end of the list. If not, return true. If so, return false.


hasPrev

public boolean hasPrev()
Check if Iterator is at the beginning of the list. If so, return false. If not, return true.


next

public java.lang.Object next()
Advance Iterater one position and return the data at that location.


back

public java.lang.Object back()
Move Iterator back one position and return data at the new location.