com.mhhe.clrs2e
Class WeightedAdjacencyMatrixGraph.EdgeIterator

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

public class WeightedAdjacencyMatrixGraph.EdgeIterator
extends AdjacencyMatrixGraph.EdgeIterator
implements WeightedEdgeIterator

Inner class that overrides AdjacencyListGraph.EdgeIterator to implement WeightedEdgeIterator.


Field Summary
 
Fields inherited from class com.mhhe.clrs2e.AdjacencyMatrixGraph.EdgeIterator
current, u
 
Constructor Summary
WeightedAdjacencyMatrixGraph.EdgeIterator(int v)
          Starts an iteration through the weighted edges incident on a given vertex.
 
Method Summary
 double getWeight()
          Returns the weight of the edge returned by the most recent call to next.
 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 setWeight(double weight)
          Sets the weight of the edge returned by the most recent call to next.
 
Methods inherited from class com.mhhe.clrs2e.AdjacencyMatrixGraph.EdgeIterator
remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Iterator
remove
 

Constructor Detail

WeightedAdjacencyMatrixGraph.EdgeIterator

public WeightedAdjacencyMatrixGraph.EdgeIterator(int v)
Starts an iteration through the weighted 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
Overrides:
hasNext in class AdjacencyMatrixGraph.EdgeIterator

next

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

Specified by:
next in interface java.util.Iterator
Overrides:
next in class AdjacencyMatrixGraph.EdgeIterator

getWeight

public double getWeight()
Returns the weight of the edge returned by the most recent call to next.

Specified by:
getWeight in interface WeightedEdgeIterator

setWeight

public void setWeight(double weight)
Sets the weight of the edge returned by the most recent call to next.

Specified by:
setWeight in interface WeightedEdgeIterator