ants.freeant
Class GnutantPheromone

java.lang.Object
  |
  +--ants.freeant.GnutantPheromone
All Implemented Interfaces:
ResourceManager

public class GnutantPheromone
extends Object
implements ResourceManager

Gnutant Pheromone is "the routing table" of the Gnutant species. Ants may only add knowledge about new keywords, and the nest where documents relating to that keyword may be found. The underlying data structure will take care of limiting the resource (memory) usage, by implementing an LRU policy. Ants may also obtain a list of nests that contain more information about a given keyword or closely matching keywords.

Version:
$Revision: 1.6 $
Author:
Hein Meling

Field Summary
static String NAME
          Identifier used in the configuration files
static String PAR_CAPACITY
          String name of the parameter used to determine
 
Constructor Summary
GnutantPheromone(Factory factory, String name)
          Creates a new GnutantPheromone instance.
 
Method Summary
 void addKeyhash(HashedKeyword keyhash, NestId nestid)
           
 void init(AntView view, float explorationProbability, int trailAttempts, double trailDev, int explorationAttempts)
           
 boolean moveToNextRandomNest(AntView view)
          The ant performs a random step, either because the ant wants to explore, or because the ants failed to move to the selected nests.
 boolean moveToNextTrailNest(AntView view, HashedKeyword keyhash)
           
 String toString()
          Returns a string representation of the GnutantPheromone.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

public static final String NAME
Identifier used in the configuration files

See Also:
Constant Field Values

PAR_CAPACITY

public static final String PAR_CAPACITY
String name of the parameter used to determine

See Also:
Constant Field Values
Constructor Detail

GnutantPheromone

public GnutantPheromone(Factory factory,
                        String name)
Creates a new GnutantPheromone instance.

Parameters:
factory - the factory to be used to read configuration arguments and to create other configurable objects
name - the name that is associated to this instance in the configuration file
Method Detail

init

public void init(AntView view,
                 float explorationProbability,
                 int trailAttempts,
                 double trailDev,
                 int explorationAttempts)

addKeyhash

public void addKeyhash(HashedKeyword keyhash,
                       NestId nestid)

moveToNextTrailNest

public boolean moveToNextTrailNest(AntView view,
                                   HashedKeyword keyhash)

moveToNextRandomNest

public boolean moveToNextRandomNest(AntView view)
The ant performs a random step, either because the ant wants to explore, or because the ants failed to move to the selected nests.


toString

public String toString()
Returns a string representation of the GnutantPheromone.

Overrides:
toString in class Object
Returns:
a String representation of the GnutantPheromone object. A multiline string will be returned.