|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.mhhe.clrs2e.AdjacencyListGraph.EdgeIterator | +--com.mhhe.clrs2e.FlowNetwork.EdgeIterator
Inner class that overrides
AdjacencyListGraph.EdgeIterator
to implement
FlowNetworkEdgeIterator
.
Field Summary | |
private boolean |
residualOnly
true if this iterator is to return only edges
in the residual network, false if it is to
return all edges (even those whose residual capacity is not
positive. |
Fields inherited from class com.mhhe.clrs2e.AdjacencyListGraph.EdgeIterator |
current, index |
Constructor Summary | |
FlowNetwork.EdgeIterator(int v,
boolean residual)
Starts an iteration through the edges incident on a given vertex in a flow network. |
Method Summary | |
double |
getCapacity()
Returns the capacity of the edge returned by the most recent call to next . |
java.lang.Object |
getEdge()
Returns the edge found by the most recent call to next . |
double |
getNetFlow()
Returns the net flow of the edge returned by the most recent call to next . |
double |
getResidualCapacity()
Returns the residual capacity of the edge returned by the most recent call to next . |
boolean |
hasNext()
Returns true if this edge iterator has more
edges, false otherwise. |
void |
increaseNetFlow(double amount)
Increases the net flow of the edge returned by the most recent call to next . |
java.lang.Object |
next()
Returns the next edge in the iteration. |
void |
zeroNetFlow()
Zeros out the net flow of the edge returned by the most recent call to next . |
Methods inherited from class com.mhhe.clrs2e.AdjacencyListGraph.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 |
Field Detail |
private boolean residualOnly
true
if this iterator is to return only edges
in the residual network, false
if it is to
return all edges (even those whose residual capacity is not
positive.
Constructor Detail |
public FlowNetwork.EdgeIterator(int v, boolean residual)
v
- The index of the vertex.residual
- true
if this iterator is to
return only edges in the residual network,
false
if it is to return all edges.Method Detail |
public boolean hasNext()
true
if this edge iterator has more
edges, false
otherwise. Depending on the
instance variable residualOnly
, this method
may consider only edges that are present in the residual
network.
hasNext
in interface java.util.Iterator
hasNext
in class AdjacencyListGraph.EdgeIterator
public java.lang.Object next()
residualOnly
, this method
may consider only edges that are present in the residual
network.
next
in interface java.util.Iterator
next
in class AdjacencyListGraph.EdgeIterator
public java.lang.Object getEdge()
next
. Unlike next
, this method
returns an object corresponding to the edge itself rather
than just the adjacent vertex.
getEdge
in interface FlowNetworkEdgeIterator
public double getCapacity()
next
.
getCapacity
in interface FlowNetworkEdgeIterator
public double getNetFlow()
next
.
getNetFlow
in interface FlowNetworkEdgeIterator
public double getResidualCapacity()
next
.
getResidualCapacity
in interface FlowNetworkEdgeIterator
public void zeroNetFlow()
next
.
zeroNetFlow
in interface FlowNetworkEdgeIterator
public void increaseNetFlow(double amount)
next
.
increaseNetFlow
in interface FlowNetworkEdgeIterator
amount
- The amount by which this edge's flow is
increased.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |