|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.tostring0.AToString
com.rubecula.darwin.domain.world.Colony_
public abstract class Colony_
| Field Summary | |
|---|---|
protected Environment |
_environment
The environment in which this population exists. |
protected java.lang.String |
_identifier
The string by which this population may be identified. |
int |
_index
TODO consider removing this the index of this colony within its population. |
protected java.util.List<Organism> |
_organisms
collection of organisms in this population. |
protected org.apache.commons.math.random.RandomGenerator |
_random
A random number generator for this population. |
static org.apache.commons.logging.Log |
LOG
The logger for this class. |
static java.lang.String |
S_COLON
|
protected int |
sequence
A sequence number for creating identifiers. |
| Fields inherited from interface net.sf.tostring0.IToString |
|---|
ANGBR_OPEN, ANGBRA_CLSE, BRA_CLSE, BRA_OPEN, BRCE_OPEN, BRCS_CLSE, COLON, LIST_SEPARATOR, MAX_ELEMENTS_DEFAULT, S_MT, S_PERCENT, SEPARATOR, SPACE |
| Constructor Summary | |
|---|---|
protected |
Colony_(java.lang.String identifier,
Environment environment,
org.apache.commons.math.random.RandomGenerator random)
|
| Method Summary | |
|---|---|
boolean |
addOrganism(Organism organism)
Note that this method does NOT invoke the populationChanged() method. |
protected void |
ageOrganisms()
This method ages all current organisms. |
boolean |
censusMe(Census census,
java.lang.Object context)
Method to census this object. |
void |
cleanupGeneration()
Method to clean this colony up after processing the current generation. |
java.lang.Object |
clone()
|
java.lang.String |
createIdentifier()
Method to yield an unique identifier within this colony. |
void |
cullMembers()
TEST |
protected boolean |
doCensusDetail(Census census,
java.lang.Object context)
|
java.util.Collection<? extends Censusible> |
getCensusibleChildren()
Method to return a list of censusible children of this object. |
int |
getCount()
|
protected abstract java.lang.String |
getDaughterId()
|
protected int |
getDaughterSequence()
|
Environment |
getEnvironment()
Method to get the environment in which this colony thrives. |
java.lang.String |
getIdentifier()
|
protected int |
getIndex()
|
java.util.Collection<Individual> |
getIndividuals()
|
protected int |
getNDaughters()
|
java.util.Collection<Organism> |
getOrganisms()
|
Population |
getPopulation()
|
protected void |
getProgenyAsexual()
|
protected boolean |
getProgenySexual()
|
protected org.apache.commons.math.random.RandomGenerator |
getRandom()
|
Realm |
getRealm()
TODO consider eliminating this method |
double |
getSaturation()
Get the current saturation for this colony. |
Sink |
getSink()
|
protected java.util.Collection<VisualizableListener> |
getVisualizableListeners()
Convenience method. |
double |
grantPardons(double fittestOriginal,
int pardonsPerColony)
|
boolean |
isIsolated()
|
void |
markDeadOrganisms(Viability viability)
|
protected void |
neonatalCare()
Register all births with the Registry (if any); Mark dead organisms (with true parameter). |
void |
normalizeGenomes(Organism bestOrganism)
|
void |
onEnvironmentChange(Environment env)
This method is called on a environment listener to notify it that the environment p has changed. |
void |
populationChanged(java.lang.Object context)
Method to respond to the fact that the population of Organisms in this Colony have changed. |
protected boolean |
removeDeadOrganisms()
|
void |
seedMembers()
Method to seed a this Evolvable which a certain number of
members. |
void |
setIndex(int index)
Set the index of this population within its parent Taxon System. |
void |
setIsolated(boolean isolated)
|
void |
setNDaughters(int size)
Set the number of daughter colonies we expect this colony to have. |
void |
setPopulation(Population population)
|
boolean |
setupGeneration()
Method to set up this colony for the current generation. |
boolean |
spin(int n)
|
void |
thin(int thinFactor)
Thin (decimate) the organisms of this colony by a factor of thinFactor. |
protected void |
visualizableChanged(Visualizable source,
java.lang.Object context)
This method should be called whenever this population (or an environment) has changed, for example after seeding, or getting the next generation. |
| Methods inherited from class net.sf.tostring0.AToString |
|---|
toString, toString, toStringBrief, toStringId |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Environment _environment
protected java.lang.String _identifier
protected final org.apache.commons.math.random.RandomGenerator _random
protected transient java.util.List<Organism> _organisms
protected transient int sequence
public transient int _index
public static final org.apache.commons.logging.Log LOG
public static final java.lang.String S_COLON
| Constructor Detail |
|---|
protected Colony_(java.lang.String identifier,
Environment environment,
org.apache.commons.math.random.RandomGenerator random)
identifier - the name of this colonyenvironment - the environment in which this colony existsrandom - a random number source used by the colony for reproduction| Method Detail |
|---|
public boolean addOrganism(Organism organism)
addOrganism in interface ColonyColony.addOrganism(com.rubecula.darwin.domain.helper.Organism)
public boolean censusMe(Census census,
java.lang.Object context)
Censusible
censusMe in interface Censusiblecensus - the census object which will present the results of taking
this censuscontext - an arbitrary object which can be used by the census object to
provide appropriate context for this object.
Censusible.getCensusibleChildren().Censusible.censusMe(com.rubecula.darwin.domain.helper.Census,
java.lang.Object)public final void cleanupGeneration()
Method to clean this colony up after processing the current generation.
Called by Population_.nextGeneration(). Some individuals will be
culled (according to the mortality implementation, etc.).
Normally, this method will not be overridden by sub-classes because it contains critical logic. If you want to do additional logic, you would normally override one or more of the following methods:
Here is the exact sequence of events for this method:
sequenceremoveDeadOrganisms()populationChanged(Object)
cleanupGeneration in interface ColonyGenerational.nextGeneration()
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionObject.clone()public java.lang.String createIdentifier()
Colony
createIdentifier in interface ColonyColony.createIdentifier()public void cullMembers()
cullMembers in interface TheologicalTheological.cullMembers()public java.util.Collection<? extends Censusible> getCensusibleChildren()
Censusible
getCensusibleChildren in interface CensusibleArrayList of censusible objects.Censusible.getCensusibleChildren()public int getCount()
getCount in interface CountableCollection.size()public Environment getEnvironment()
Colony
getEnvironment in interface ColonyColony.getEnvironment()public java.lang.String getIdentifier()
getIdentifier in interface net.sf.tostring0.IdentifiableIdentifiable.getIdentifier()public java.util.Collection<Individual> getIndividuals()
getIndividuals in interface VisualizableVisualizableVisualizable.getIndividuals()public java.util.Collection<Organism> getOrganisms()
getOrganisms in interface ColonyIterator of Organism objects.Colony.getOrganisms()public Population getPopulation()
getPopulation in interface ColonyColony.getPopulation()public Realm getRealm()
getRealm in interface VisualizableVisualizable object exists.Visualizable.getRealm()public double getSaturation()
getSaturation in interface ColonyColony.getSaturation()public Sink getSink()
getSink in interface VisualizableVisualizable.getSink()
public double grantPardons(double fittestOriginal,
int pardonsPerColony)
throws FitnessException
grantPardons in interface ColonyfittestOriginal - XXXpardonsPerColony -
FitnessExceptionColony.grantPardons(double, int)public boolean isIsolated()
isIsolated in interface InsularInsular.isIsolated()
public void markDeadOrganisms(Viability viability)
throws FitnessException
markDeadOrganisms in interface Colonyviability - the viability which will determine whether an organism is
viable or not.
FitnessExceptionColony.markDeadOrganisms(com.rubecula.darwin.domain.world.Viability)public void normalizeGenomes(Organism bestOrganism)
normalizeGenomes in interface ColonybestOrganism - Colony.normalizeGenomes(com.rubecula.darwin.domain.helper.Organism)public void onEnvironmentChange(Environment env)
EnvironmentListenerp has changed.
onEnvironmentChange in interface EnvironmentListenerenv - the environment which has changed.EnvironmentListener.onEnvironmentChange(com.rubecula.darwin.domain.helper.Environment)public void populationChanged(java.lang.Object context)
populationChanged in interface Colonycontext - something that characterizes what caused the population changeColony.populationChanged(java.lang.Object)public void seedMembers()
TheologicalEvolvable which a certain number of
members.
seedMembers in interface TheologicalTheological.seedMembers()public void setIndex(int index)
ColonyList.indexOf(Object).
setIndex in interface Colonyindex - Colony.setIndex(int)public void setIsolated(boolean isolated)
setIsolated in interface Colonyisolated - the isolated to setColony.setIsolated(boolean)public void setNDaughters(int size)
Colony
setNDaughters in interface ColonyColony.setNDaughters(int)public void setPopulation(Population population)
setPopulation in interface Colonypopulation - the population to setColony.setPopulation(com.rubecula.darwin.domain.helper.Population)public final boolean setupGeneration()
Method to set up this colony for the current generation. Called by
Population_.nextGeneration(). Some individuals will be culled
(according to the mortality implementation, etc.); while each mating pair
will produce some progeny.
Normally, this method will not be overridden by sub-classes because it contains critical logic. If you want to do additional logic, you would normally override one or more of the following methods:
markDeadOrganisms(Viability)neonatalCare()getProgenyAsexual()getProgenySexual()populationChanged(Object)Here is the exact sequence of events for this method (each step depends on the success of the previous step):
sequenceageOrganisms()markDeadOrganisms(Viability) with false parametergetProgenySexual() or getProgenyAsexual()
according to the whether the system's genome is diploid or haploid.neonatalCare()populationChanged(Object)
setupGeneration in interface ColonyGenerational.nextGeneration()public boolean spin(int n)
spin in interface Colonyn - the odds against the result being true.
Colony.spin(int)
public void thin(int thinFactor)
throws FitnessException
ColonythinFactor. Literal decimation would occur if the thinFactor
was 10.
thin in interface ColonythinFactor -
FitnessExceptionColony.thin(int)protected void ageOrganisms()
protected boolean doCensusDetail(Census census,
java.lang.Object context)
census - the census objectcontext -
protected abstract java.lang.String getDaughterId()
protected int getDaughterSequence()
protected int getIndex()
protected int getNDaughters()
protected void getProgenyAsexual()
protected boolean getProgenySexual()
protected org.apache.commons.math.random.RandomGenerator getRandom()
protected java.util.Collection<VisualizableListener> getVisualizableListeners()
protected void neonatalCare()
throws FitnessException
FitnessExceptionprotected boolean removeDeadOrganisms()
protected void visualizableChanged(Visualizable source,
java.lang.Object context)
source - the source of the change (either this population or its
environment).context - the context of the change
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||