Class HashRoute

java.lang.Object
  extended by HashRoute

public class HashRoute
extends java.lang.Object

HashRoute is a particular route where order does not matter. HashRoutes are primarily used in Agent when they keep track of nodes they have already visited. The class stores Integers containing node numbers in a HashSet.


Field Summary
private  java.util.HashSet hash
           
 
Constructor Summary
HashRoute(int load)
          Constructs a blank HashRoute.
 
Method Summary
 void addNewNode(int n)
          Adds a node into the HashSet.
 int getSize()
          Returns the number of nodes stored in the HashRoute.
 java.util.Iterator iterator()
          Creates an iterator for the HashRoute pointing to the HashSet.
 void removeNode(int n)
          Removes a node from the HashSet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hash

private java.util.HashSet hash
Constructor Detail

HashRoute

public HashRoute(int load)
Constructs a blank HashRoute.

Parameters:
load - The estimated size of the HashRoute
Method Detail

addNewNode

public void addNewNode(int n)
Adds a node into the HashSet.

Parameters:
n - Node to be added into the HashSet

removeNode

public void removeNode(int n)
Removes a node from the HashSet.

Parameters:
n - Node to be removed from the HashSet

iterator

public java.util.Iterator iterator()
Creates an iterator for the HashRoute pointing to the HashSet.

Returns:
An iterator pointing to the HashSet

getSize

public int getSize()
Returns the number of nodes stored in the HashRoute.

Returns:
number of nodes stored in HashSet