com.rubecula.darwin.domain.helper
Interface Colony

All Superinterfaces:
Censusible, java.lang.Cloneable, Countable, net.sf.tostring0.Identifiable, Insular, Theological, Visualizable
All Known Implementing Classes:
Colony_, Colony_Mayrian

public interface Colony
extends Visualizable, Countable, Theological, java.lang.Cloneable, Insular

This super-interface of Population addresses the more basic aspects of an Evolvable, Visualizable and Countable group. In particular, this interface knows nothing about Organisms. TODO consider switching names between this and Population.

Author:
Robin Hillyard

Method Summary
 boolean addOrganism(Organism organism)
           
 void cleanupGeneration()
          Cleanup (that's a euphemism) the organisms in this Colony.
 java.lang.String createIdentifier()
          Method to yield an unique identifier within this colony.
 Environment getEnvironment()
          Method to get the environment in which this colony thrives.
 java.util.Collection<Organism> getOrganisms()
           
 Population getPopulation()
           
 double getSaturation()
          Method to determine the population saturation.
 double grantPardons(double fittestOriginal, int pardonsPerColony)
           
 void markDeadOrganisms(Viability viability)
           
 void normalizeGenomes(Organism bestOrganism)
           
 void populationChanged(java.lang.Object context)
           
 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()
           
 boolean spin(int n)
           
 void thin(int thinFactor)
          Thin (decimate) the organisms of this colony by a factor of thinFactor.
 
Methods inherited from interface com.rubecula.darwin.foundation.Visualizable
getIndividuals, getRealm, getSink
 
Methods inherited from interface net.sf.tostring0.Identifiable
getIdentifier
 
Methods inherited from interface com.rubecula.darwin.foundation.Countable
getCount
 
Methods inherited from interface com.rubecula.darwin.domain.helper.Censusible
censusMe, getCensusibleChildren
 
Methods inherited from interface com.rubecula.darwin.foundation.Theological
cullMembers, seedMembers
 
Methods inherited from interface com.rubecula.darwin.domain.helper.Insular
isIsolated
 

Method Detail

addOrganism

boolean addOrganism(Organism organism)
Parameters:
organism -
Returns:
true if we added the organism

cleanupGeneration

void cleanupGeneration()
Cleanup (that's a euphemism) the organisms in this Colony. Normally, the cleanup consists of killing off all of the "marked" organisms. This method is called for each Colony of a population during the invocation of the Generational.nextGeneration() method.


createIdentifier

java.lang.String createIdentifier()
Method to yield an unique identifier within this colony.

Returns:
a string which represents the next integer in a sequence. TODO use the generation number for id TODO consider putting this in a factory class

getEnvironment

Environment getEnvironment()
Method to get the environment in which this colony thrives.

Returns:
the environment.

getOrganisms

java.util.Collection<Organism> getOrganisms()
Returns:
a collection of all the Organisms in this Population

getPopulation

Population getPopulation()
Returns:
the population to which this colony belongs

getSaturation

double getSaturation()
Method to determine the population saturation. One of the Eco Factors is the ideal population which the environment can support.

Returns:
current population divided by ideal population (unless the latter is undefined in which case the value 1 is returned).

grantPardons

double grantPardons(double fittestOriginal,
                    int pardonsPerColony)
                    throws FitnessException
Parameters:
fittestOriginal - the fitness value of the fittest we know of so far
pardonsPerColony -
Returns:
a new value of fitness
Throws:
FitnessException

markDeadOrganisms

void markDeadOrganisms(Viability viability)
                       throws FitnessException
Parameters:
viability - the viability which will determine whether an organism is viable or not.
Throws:
FitnessException

normalizeGenomes

void normalizeGenomes(Organism bestOrganism)
Parameters:
bestOrganism -

populationChanged

void populationChanged(java.lang.Object context)
Parameters:
context - something that characterizes what caused the population change

setIndex

void setIndex(int index)
Set the index of this population within its parent Taxon System. TODO consider removing this and always use List.indexOf(Object).

Parameters:
index -

setIsolated

void setIsolated(boolean isolated)
Parameters:
isolated - the isolated to set

setNDaughters

void setNDaughters(int size)
Set the number of daughter colonies we expect this colony to have.

Parameters:
size -

setPopulation

void setPopulation(Population population)
Parameters:
population - the population to set

setupGeneration

boolean setupGeneration()
Returns:
true if all OK

spin

boolean spin(int n)
Parameters:
n - the range of integers from which to choose (i.e. the odds against spin returning true).
Returns:
true if the random number source yields a zero

thin

void thin(int thinFactor)
          throws FitnessException
Thin (decimate) the organisms of this colony by a factor of thinFactor. Literal decimation would occur if the thinFactor was 10.

Parameters:
thinFactor - the factor by which the population is to be reduced.
Throws:
FitnessException


Copyright © 2010 Rubecula Software, LLC. All Rights Reserved.