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

Field Summary
 
Fields inherited from class antsim.nestor.LocalNest
PAR_TTL
 
Fields inherited from interface anthill.nest.Nest
NAME
 
Constructor Summary
LocalGeneticNest(Factory factory, String name)
          Constructs a new nest.
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface anthill.nest.Nest
addAntNeighbour, addClientNeighbour, createResourceManager, getNeighbours, getNestId, getResourceManager, removeNeighbour, request
 

Constructor Detail

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 objects
name - the name that is associated to this instance in the configuration file
Method Detail

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