planet.generic.commonapi
Class NetworkImpl.NetworkIterator

java.lang.Object
  extended byplanet.generic.commonapi.NetworkImpl.NetworkIterator
All Implemented Interfaces:
java.util.Iterator
Enclosing class:
NetworkImpl

public class NetworkImpl.NetworkIterator
extends java.lang.Object
implements java.util.Iterator

This class implements the java.util.Iterator interface and is backed up by TreeMap that contains all existing nodes on the network.

It use the iterator of the TreeMap key set to iterate over all instances of the nodes, and returns the corresponding Node. It also implements the remove() method, that uses the same method of the key set iterator. This last method ensures to remove the required entry on to the TreeMap.

Author:
Jordi Pujol

Constructor Summary
NetworkImpl.NetworkIterator(java.util.TreeMap nodes)
          Initialize the key set iterator over the HashMap.
 
Method Summary
 boolean hasNext()
          Evaluate if there are more nodes.
 java.lang.Object next()
          Returns the next Node.
 void remove()
          Remove the actual element of the HashMap.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetworkImpl.NetworkIterator

public NetworkImpl.NetworkIterator(java.util.TreeMap nodes)
Initialize the key set iterator over the HashMap.

Parameters:
nodes -
Method Detail

hasNext

public boolean hasNext()
Evaluate if there are more nodes.

Specified by:
hasNext in interface java.util.Iterator
See Also:
Iterator.hasNext()

next

public java.lang.Object next()
Returns the next Node.

Specified by:
next in interface java.util.Iterator
See Also:
Iterator.next()

remove

public void remove()
Remove the actual element of the HashMap.

Specified by:
remove in interface java.util.Iterator
See Also:
Iterator.remove()