anthill
Interface Ant

All Known Subinterfaces:
GeneticAnt
All Known Implementing Classes:
BackwardGnutant, BackwardGnutant, DeliverAnt, Gnutant, Insant, Insant, MessorAnt, MessorQueen, RandomAnt, ReplyGnutant, ReplyGnutant, ResponseGnutant, SearchGnutant, SearchGnutant

public interface Ant

This interface contains the methods which must be implemented by ant developers. The main method to be implemented is run(), which is invoked by a nest when an ant is received. Method run() contains the ant algorithm.

Version:
$Revision: 1.4 $
Author:
Alberto Montresor

Method Summary
 String getSpecies()
          Returns the identifier of the "species" of this ant.
 void init(AntView view)
          This method is called on ants at the initialization time.
 void run(AntView view)
          This method encapsulate the computation performed by ants.
 

Method Detail

init

public void init(AntView view)
This method is called on ants at the initialization time. The view delivered to ants is not fully functional; for example, ants cannot move to other nests or create new ants during the execution of init(). FIXME Implement the control in LocalAntView.


run

public void run(AntView view)
This method encapsulate the computation performed by ants. It is invoked once by a nest when the ant is received by another nest, or when the ant is generated locally. The run() method must be executed in a controlled environment, meaning that the ant cannot be enabled to access nest resources besides of the methods provided by the AntView interface.

Parameters:
view - reference to the AntView object which is the communication interface between ants and nests.

getSpecies

public String getSpecies()
Returns the identifier of the "species" of this ant. Different ant species may have access to different pheromone information in nests.