physis.core.lifespace
Interface LifeSpace

All Known Subinterfaces:
CellLifeSpace, SoupLifeSpace

public interface LifeSpace

LifeSpace is the space where the digital organisms live. Just like the earth for animals in real world. It has to know two things. It stores the organisms and ensures the access to those. The neighbour-access methods always corrrespond to a certain topology, which is hidden in the implementation. For example the lifespace can be a two-dimensional toroidal lattice or a three-dimensional cube or even a one dimensional ring. This class can hide the distributed processing as well. (Two LifeSpace-s can be connected across the network.)
CRC
1. Stores the digital organisms.
2. Handles the topolgy of the lifespace - DigitalOrganism.


Method Summary
 DigitalOrganismIterator getAllOrganisms()
          This method provides all the organisms of the lifespace.
 DigitalOrganismIterator getNeighbours(DigitalOrganism digorg)
          This method gives the neighbours of an organism.
 DigitalOrganism getOrganismRandomly()
          Gives an organism randomly from the entire 'soup'.
 DigitalOrganismIterator getRegion(double percentage)
          Returns organisms from a connected local territory in the lifespace.
 int getSize()
          Gives the capacity (the number of cells) of the lifespace.
 DigitalOrganismIterator getSomeOrganisms(double percentage)
          Returns some organisms.
 void injectGenome(GeneticCodeTape ct)
          Inserts a genome into the soup.
 

Method Detail

getAllOrganisms

public DigitalOrganismIterator getAllOrganisms()
This method provides all the organisms of the lifespace. This feature is needed when making the update. The order of the organisms in the iterator is arbitrary but it must remain the same all the time for one particular implementation. (Should return always a new iterator.)

getSomeOrganisms

public DigitalOrganismIterator getSomeOrganisms(double percentage)
Returns some organisms. The organisms should be distributed uniformly in the whole lifespace. (Should return always a new iterator.)
Parameters:
percentage - The percentage of organisms to be returned.

getRegion

public DigitalOrganismIterator getRegion(double percentage)
Returns organisms from a connected local territory in the lifespace. (Should return always a new iterator.)
Parameters:
percentage - The percentage of organisms to be returned.

getOrganismRandomly

public DigitalOrganism getOrganismRandomly()
Gives an organism randomly from the entire 'soup'. It's needed for point mutations for example. The distribution of the hits should be uniform.

getNeighbours

public DigitalOrganismIterator getNeighbours(DigitalOrganism digorg)
This method gives the neighbours of an organism. This is needed when an organism interact with its neighbourhood. The order is arbitrary. (It may return always one instance of iterator. For performance reasons.)

getSize

public int getSize()
Gives the capacity (the number of cells) of the lifespace.

injectGenome

public void injectGenome(GeneticCodeTape ct)
Inserts a genome into the soup. The position is implementation dependent.