org.aisb.bio.things.evolution
Class AsexualOrganism

java.lang.Object
  extended byorg.aisb.bio.things.evolution.AsexualOrganism

public class AsexualOrganism
extends java.lang.Object

This is an "organism" for the purpose of running evolutionary experiments. There's a Sequence representing the "genotype", and a unitless floating point number representing how much time until the organisim reproduces. There's also an integer value representing "fitness".

For convenience, there's also a floating point number representing "birthday", so we can fit the organism's entire lifespan into a timeline if we wish.

There's also a "parent" of type AsexualOrganism, so we can trace the organism's family tree if we wish.

Author:
Doug DeJulio

Constructor Summary
AsexualOrganism()
           
 
Method Summary
 double getBirthday()
           
 int getFitness()
           
 Sequence getGenotype()
           
 Mutator getMutator()
           
 AsexualOrganism getParent()
           
 double getTimeToReproduce()
           
 AsexualOrganism haveMutantBaby(double now)
           Create a new AsexualOrganism with a specified birthday.
 void loadFromFile(java.io.File file)
          Load the organism's gene sequence from a file.
 void loadFromFile(java.lang.String fileName)
          Load the organism's gene sequence from a file.
 void setBirthday(double birthday)
           
 void setFitness(int fitness)
           
 void setGenotype(Sequence genotype)
           
 void setMutator(Mutator mutator)
           
 void setParent(AsexualOrganism parent)
           
 void setTimeToReproduce(double timeToReproduce)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AsexualOrganism

public AsexualOrganism()
Method Detail

getBirthday

public double getBirthday()
Returns:
Returns the birthday.

setBirthday

public void setBirthday(double birthday)
Parameters:
birthday - The birthday to set.

getFitness

public int getFitness()
Returns:
Returns the fitness.

setFitness

public void setFitness(int fitness)
Parameters:
fitness - The fitness to set.

getGenotype

public Sequence getGenotype()
Returns:
Returns the genotype.

setGenotype

public void setGenotype(Sequence genotype)
Parameters:
genotype - The genotype to set.

getTimeToReproduce

public double getTimeToReproduce()
Returns:
Returns the timeToReproduce.

setTimeToReproduce

public void setTimeToReproduce(double timeToReproduce)
Parameters:
timeToReproduce - The timeToReproduce to set.

getParent

public AsexualOrganism getParent()
Returns:
Returns the parent.

setParent

public void setParent(AsexualOrganism parent)
Parameters:
parent - The parent to set.

haveMutantBaby

public AsexualOrganism haveMutantBaby(double now)

Create a new AsexualOrganism with a specified birthday. The offspring will be mutated as per the mutator assigned to the parent, and will inherit that mutator.

To simulate the budding of an organism, keep the parent around and call this method once. To simulate cell division, call this method twice on the parent and then throw the parent away.

Parameters:
now - The offspring's "birthday".
Returns:
The child organism.

loadFromFile

public void loadFromFile(java.io.File file)
                  throws java.io.IOException
Load the organism's gene sequence from a file.

Parameters:
file - A file containing exactly one line consisting only of nucleotide code letters.
Throws:
java.io.IOException

loadFromFile

public void loadFromFile(java.lang.String fileName)
                  throws java.io.IOException
Load the organism's gene sequence from a file.

Parameters:
fileName - The name of a file containing exactly one line consisting only of nucleotide code letters.
Throws:
java.io.IOException

getMutator

public Mutator getMutator()
Returns:
Returns the mutator.

setMutator

public void setMutator(Mutator mutator)
Parameters:
mutator - The mutator to use.

toString

public java.lang.String toString()