com.mhhe.clrs2e
Class AdjacencyMatrixGraph.EdgeIterator

java.lang.Object
  |
  +--com.mhhe.clrs2e.AdjacencyMatrixGraph.EdgeIterator
All Implemented Interfaces:
java.util.Iterator
Direct Known Subclasses:
WeightedAdjacencyMatrixGraph.EdgeIterator
Enclosing class:
AdjacencyMatrixGraph

public class AdjacencyMatrixGraph.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  int current
          The index of the vertex returned by the most recent call to next.
(package private)  int u
          The index of the vertex whose edges this iterator iterates through.
 
Constructor Summary
AdjacencyMatrixGraph.EdgeIterator(int u)
          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 int current
The index of the vertex returned by the most recent call to next. Initially, it is -1.


u

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

Constructor Detail

AdjacencyMatrixGraph.EdgeIterator

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

Parameters:
u - 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.