anthill.nestor
Class LocalGeneticNest
java.lang.Object
|
+--anthill.nestor.LocalNest
|
+--anthill.nestor.LocalGeneticNest
- All Implemented Interfaces:
- AntListener, Clearable, GeneticNest, Nest, java.rmi.Remote
- public class LocalGeneticNest
- extends LocalNest
- implements GeneticNest
A Nest class collects the components of a Nest site: (i) a AntView
object, which is the view of a Nest for an Ant; (ii) a Gate object,
which manage the communication between nests; (iii) an Manager,
i.e. the object which manage the activities performed by different agents.
Implementation note: this implementation is supposed to be used as
simple implementation of Nest
in the off-line
environment. Here, we assume that the Manager object used is single-threaded;
in this way, we avoid the costs of synchronized methods.
- Version:
- $Revision$
- Author:
- Alberto Montresor
Method Summary |
void |
addGeneticCode(GeneticCode code)
Add a new genetic code to the set of genetic codes known to this anthill.
|
void |
clear()
Restores the object to its initial state. |
Methods inherited from class anthill.nestor.LocalNest |
addAntNeighbour, addClientNeighbour, addResource, deliver, getId, getManager, getNeighbours, getPheromone, getResource, getResources, getStorage, insert, intValue, removeNeighbour, request, setPheromone, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
LocalGeneticNest
public LocalGeneticNest(Factory factory)
- Constructs a new nest.
addGeneticCode
public void addGeneticCode(GeneticCode code)
- Add a new genetic code to the set of genetic codes known to this anthill.
When creating a new ant, an anthill may choose from one of the
available genetic codes. This implementation of
Nest
does not enable the use of more than one genetic code; thus, duplicated
invocations of addGeneticCode()
throws an
IllegalStateException
.
- Specified by:
addGeneticCode
in interface GeneticNest
- Parameters:
code
- the genetic code to be added- Throws:
IllegalStateException
- if no other genetic code can be added to
the anthill
clear
public void clear()
- Restores the object to its initial state.
- Specified by:
clear
in interface Clearable
- Overrides:
clear
in class LocalNest