com.mhhe.clrs2e
Class AdjacencyListGraph.EdgeIterator

java.lang.Object
  |
  +--com.mhhe.clrs2e.AdjacencyListGraph.EdgeIterator
All Implemented Interfaces:
java.util.Iterator
Direct Known Subclasses:
FlowNetwork.EdgeIterator, WeightedAdjacencyListGraph.EdgeIterator
Enclosing class:
AdjacencyListGraph

public class AdjacencyListGraph.EdgeIterator
extends java.lang.Object
implements java.util.Iterator

Inner class for an iterator that iterates through the edges incident on a given vertex.


Field Summary
protected  AdjacencyListGraph.Edge current
          The edge returned by the most recent call to next.
protected  int index
          The index of the vertex whose edges this iterator iterates through.
 
Constructor Summary
AdjacencyListGraph.EdgeIterator(int v)
          Starts an iteration through the edges incident on a given vertex.
 
Method Summary
 boolean hasNext()
          Returns true if this edge iterator has more edges, false otherwise.
 java.lang.Object next()
          Returns the next edge in the iteration.
 void remove()
          Unsupported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

current

protected AdjacencyListGraph.Edge current
The edge returned by the most recent call to next. Initially, it is null.


index

protected int index
The index of the vertex whose edges this iterator iterates through.

Constructor Detail

AdjacencyListGraph.EdgeIterator

public AdjacencyListGraph.EdgeIterator(int v)
Starts an iteration through the edges incident on a given vertex.

Parameters:
v - The index of the vertex.
Method Detail

hasNext

public boolean hasNext()
Returns true if this edge iterator has more edges, false otherwise.

Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Returns the next edge in the iteration.

Specified by:
next in interface java.util.Iterator

remove

public void remove()
Unsupported.

Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.UnsupportedOperationException - always.