net.sourceforge.combean.samples.simplegraphs
Class NumberNeighborIterator

Package class diagram package NumberNeighborIterator
java.lang.Object
  extended by net.sourceforge.combean.samples.simplegraphs.NumberNeighborIterator
All Implemented Interfaces:
EdgeIterator

public class NumberNeighborIterator
extends Object
implements EdgeIterator

An iterator through the neighbors of a NumberNode.


Constructor Summary
NumberNeighborIterator(NumberGraph graph, NumberNode startNode)
          Construct an iterator for the neighborhood of startNode in the given graph.
 
Method Summary
protected  NumberNode getCurrNode()
          The current node which corresponds to the next neighbor in the iteration.
 boolean hasNext()
          Check if further edges exist for this iteration.
 Edge next()
          Switch to the next edge in the iteration.
protected  void setCurrNode(NumberNode currNode)
          Set the next neighbor node to be returned in the iteration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumberNeighborIterator

public NumberNeighborIterator(NumberGraph graph,
                              NumberNode startNode)
Construct an iterator for the neighborhood of startNode in the given graph.

Parameters:
graph - the graph where the nodes reside
startNode - the node where the iteration starts
Method Detail

getCurrNode

protected final NumberNode getCurrNode()
The current node which corresponds to the next neighbor in the iteration.

Returns:
Returns the currNode.

setCurrNode

protected final void setCurrNode(NumberNode currNode)
Set the next neighbor node to be returned in the iteration.

Parameters:
currNode - The currNode to set.

hasNext

public boolean hasNext()
Description copied from interface: EdgeIterator
Check if further edges exist for this iteration.

Specified by:
hasNext in interface EdgeIterator
Returns:
true if there are further edges
See Also:
EdgeIterator.hasNext()

next

public Edge next()
Description copied from interface: EdgeIterator
Switch to the next edge in the iteration.

Specified by:
next in interface EdgeIterator
Returns:
the next edge
See Also:
EdgeIterator.next()