random
Class RandomAnt

java.lang.Object
  |
  +--random.RandomAnt
All Implemented Interfaces:
Ant, java.io.Serializable

public class RandomAnt
extends java.lang.Object
implements Ant, java.io.Serializable

This class contains the implementation of a simple ant which performs a random walk through the network. Ants move forward until they reach the searched resource; then, they move backward along the incoming path. When they reach the requestor nest, they copy the resource locally.

See Also:
Serialized Form

Constructor Summary
RandomAnt(java.lang.String query)
          Instantiate a new RandomAnt by setting the query to be satisfied and the hash value to be searched.
 
Method Summary
 java.lang.String getSpecies()
          Returns the identifier of the "species" of this ant.
 void readExternal(java.io.ObjectInput in)
           
 void run(AntView view)
          This method encapsulate the computation performed by the ant.
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomAnt

public RandomAnt(java.lang.String query)
Instantiate a new RandomAnt by setting the query to be satisfied and the hash value to be searched.
Method Detail

getSpecies

public java.lang.String getSpecies()
Returns the identifier of the "species" of this ant. Different ant species may have access to different pheromone information in nests.
Specified by:
getSpecies in interface Ant

run

public void run(AntView view)
This method encapsulate the computation performed by the ant.
Specified by:
run in interface Ant
Parameters:
view - reference to the AntView object which constitutes the controlled environment of the ant

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)