urdar
Class Organism

java.lang.Object
  extended by urdar.Organism

public class Organism
extends java.lang.Object

The Organism class represents the organisms in the simulation. Each organism is characterised by a number of features, the genotype or cellular automaton rule the organism implements being the most important.


Field Summary
 int age
          The age of the organism counted in updates
static int currentGID
          The current highest genotype ID
static int currentOID
          The current highest organism ID
 double dE
          The most recent entropy change achieved by the organism
 int G
          The CA rule implemented by the organism, i.e. its pheno/genotype
 int GID
          The organism genotype identity number.
 boolean isNew
          Shows if the organism is a newborn
 boolean mutated
          Shows if the organism was a mutant at birth
 int OID
          The organism identity number (unique to each instance of the class)
static double pc
          The copy mutation probability
 BString S
          The bit string attached to the organism
 BString S0
          A backup copy of the bit string attached to the organism
 
Constructor Summary
Organism(int G, int OID, int GID)
          Creates an Organism with given properties
 
Method Summary
 void clearTag()
          Clear the isNew tag
 Organism divide()
          Creates a daughter organism under mutations.
 int getAge()
          Get the age of the organism
static int getCurrentGID()
          Returns a GID
static int getCurrentOID()
          Returns an OID
 int getGenome()
          Get the organism genotype
 int getGID()
          Returns the organism genotype ID number
 double getLatestIO()
          Get the most recent entropy difference
static int getNextGID()
          Returns a GID and increments the counter
static int getNextOID()
          Returns an OID and increments the counter
 int getOID()
          Returns the OID
 BString getOrigString()
          Get the backup string attached to the organism
 BString getString()
          Get the string attached to the organism
 void IO(World W, BString Sx)
          Swaps the current string and creates a backup
 boolean isMutated()
          Check if the organism is mutated
 void mutated(boolean b)
          Mark the organism as mutated
 void setGenome(int G)
          Sets the organism genotype
 void setGID(int ID)
          Sets the organism genotype ID number
static void setMutRate(double p)
          Sets the mutation rate
 void setOID(int ID)
          Sets the organism ID number
 void setString(BString Snew)
          Attaches a new bit string to the organism and creates a backup
 BString test(BString St)
          Manipulates the a test string and returns it
 boolean update(int L)
          Updates the organism
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OID

public int OID
The organism identity number (unique to each instance of the class)


GID

public int GID
The organism genotype identity number. Not currently used, but makes it possible to track lineages


age

public int age
The age of the organism counted in updates


G

public int G
The CA rule implemented by the organism, i.e. its pheno/genotype


dE

public double dE
The most recent entropy change achieved by the organism


S

public BString S
The bit string attached to the organism


S0

public BString S0
A backup copy of the bit string attached to the organism


mutated

public boolean mutated
Shows if the organism was a mutant at birth


isNew

public boolean isNew
Shows if the organism is a newborn


currentOID

public static int currentOID
The current highest organism ID


currentGID

public static int currentGID
The current highest genotype ID


pc

public static double pc
The copy mutation probability

Constructor Detail

Organism

public Organism(int G,
                int OID,
                int GID)
Creates an Organism with given properties

Parameters:
G - the CA-rule/genotype of the organism
OID - the organism ID
GID - the genotype ID
Method Detail

getNextOID

public static int getNextOID()
Returns an OID and increments the counter

Returns:
the next available organism ID

getNextGID

public static int getNextGID()
Returns a GID and increments the counter

Returns:
the next available genotype ID

getCurrentOID

public static int getCurrentOID()
Returns an OID

Returns:
the highest current organism ID

getCurrentGID

public static int getCurrentGID()
Returns a GID

Returns:
the highest current genotype ID

setMutRate

public static void setMutRate(double p)
Sets the mutation rate

Parameters:
p - the copy mutation rate

setString

public void setString(BString Snew)
Attaches a new bit string to the organism and creates a backup

Parameters:
Snew - the string to be attached

getOID

public int getOID()
Returns the OID

Returns:
the organism ID number

setOID

public void setOID(int ID)
Sets the organism ID number

Parameters:
ID - the organism ID number

getGID

public int getGID()
Returns the organism genotype ID number

Returns:
the organism genotype ID

setGID

public void setGID(int ID)
Sets the organism genotype ID number

Parameters:
ID - the organism genotype ID number

isMutated

public boolean isMutated()
Check if the organism is mutated

Returns:
true if organism was mutated at birth

mutated

public void mutated(boolean b)
Mark the organism as mutated

Parameters:
b - true if mutated

clearTag

public void clearTag()
Clear the isNew tag


getGenome

public int getGenome()
Get the organism genotype

Returns:
the organism genotype

setGenome

public void setGenome(int G)
Sets the organism genotype

Parameters:
G - the organism genotype

getString

public BString getString()
Get the string attached to the organism

Returns:
the string attached to the organism

getOrigString

public BString getOrigString()
Get the backup string attached to the organism

Returns:
the backup string attached to the organism

getLatestIO

public double getLatestIO()
Get the most recent entropy difference

Returns:
the latest entropy difference

getAge

public int getAge()
Get the age of the organism

Returns:
the age in updates

update

public boolean update(int L)
Updates the organism

Parameters:
L - the level of entropy calculation
Returns:
true if the organism is ready to divide

test

public BString test(BString St)
Manipulates the a test string and returns it

Parameters:
St - the test string
Returns:
a manipulated version of the input string

IO

public void IO(World W,
               BString Sx)
Swaps the current string and creates a backup

Parameters:
W - the World from which the new string is picked
Sx - the string which is returned

divide

public Organism divide()
Creates a daughter organism under mutations. With probability pc the daughter is identical with the parent (except for OID ) and with complementary probability 1-pc it is assigned a random genotype

Returns:
the daughter organism