antsim.nestor
Class LocalGeneticNest
java.lang.Object
|
+--antsim.nestor.LocalNest
|
+--antsim.nestor.LocalGeneticNest
- All Implemented Interfaces:
- AntListener, Clearable, GeneticNest, Nest, Remote, SimulatedNest
- 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: 1.3 $
- Author:
- Alberto Montresor
Fields inherited from interface anthill.nest.Nest |
NAME |
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 antsim.nestor.LocalNest |
addAntNeighbour, addClientNeighbour, createResourceManager, deliver, getManager, getNeighbours, getNestId, getResourceManager, leave, removeNeighbour, request, toString |
LocalGeneticNest
public LocalGeneticNest(Factory factory,
String name)
- Constructs a new nest.
- Parameters:
factory
- the factory to be used to read configuration arguments
and to create other configurable objectsname
- the name that is associated to this instance in the
configuration file
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