© 1998-2002 McGraw-Hill

structure
Class GraphListEIterator

java.lang.Object
  |
  +--structure.AbstractIterator
        |
        +--structure.GraphListEIterator
All Implemented Interfaces:
Enumeration, Iterator

class GraphListEIterator
extends AbstractIterator

An iterator over all edges. Every directed/undirected edge is considered exactly once. Order is not guaranteed.

Typical use:

      Graph g = new GraphList();
      // ...list gets built up...
      Iterator ei = g.edges();
      while (ei.hasNext())
      {
          System.out.println(ei.next());
      }
 


Field Summary
protected  Iterator edges
           
 
Constructor Summary
GraphListEIterator(Map dict)
           
 
Method Summary
 Object get()
          Returns the value currently being considered by the AbstractIterator.
 boolean hasNext()
          Returns true if the iterator has more elements to visit.
 Object next()
          Moves, bumps, or "increments" the iterator along the traversal; returns the next value considered.
 void reset()
          Reset iterator to the beginning of the structure.
 
Methods inherited from class structure.AbstractIterator
hasMoreElements, nextElement, remove, value
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

edges

protected Iterator edges
Constructor Detail

GraphListEIterator

public GraphListEIterator(Map dict)
Parameters:
dict -  
Method Detail

reset

public void reset()
Description copied from class: AbstractIterator
Reset iterator to the beginning of the structure. This method is not required of Iterator or Enumeration implementation, but some traversals may allow efficient multi-pass implementations with little overhead. The user is encouraged to implement this method.
Overrides:
reset in class AbstractIterator
Postcondition:
resets the iterator to first edge

hasNext

public boolean hasNext()
Description copied from class: AbstractIterator
Returns true if the iterator has more elements to visit. The method hasMoreElements is an Enumeration-required call to this method. The user should override only this method.
Overrides:
hasNext in class AbstractIterator
Postcondition:
returns true iff current element is valid
Returns:
True iff current element is valid

get

public Object get()
Description copied from class: AbstractIterator
Returns the value currently being considered by the AbstractIterator. This method is required by neither Iterator nor Enumeration. This method should be implemented, however, to provide better support for for-loops.
Overrides:
get in class AbstractIterator
Precondition:
hasNext()
Postcondition:
returns the current element
Returns:
The current element

next

public Object next()
Description copied from class: AbstractIterator
Moves, bumps, or "increments" the iterator along the traversal; returns the next value considered. This method should only be called if the iterator has a next value. To get a value from an iterator multiple times, use the value method.

This method is preferred over the nextElement method.

Overrides:
next in class AbstractIterator
Precondition:
hasNext()
Postcondition:
returns current value and increments iterator
Returns:
Current value and increments iterator

© 1998-2002 McGraw-Hill