physis.core.lifespace
Class MemoryPoolLifeSpace

java.lang.Object
  |
  +--physis.core.lifespace.MemoryPoolLifeSpace
All Implemented Interfaces:
LifeSpace, SoupLifeSpace

public class MemoryPoolLifeSpace
extends java.lang.Object
implements SoupLifeSpace


Field Summary
(package private)  DigitalOrganismIterator neighbour_iterator
           
(package private)  DigitalOrganism[] neighbours
           
static int NEIGHBOURS
           
(package private)  DigitalOrganism[] orgs
           
(package private)  java.util.Random rnd
           
static java.lang.String SIZE
           
 
Constructor Summary
MemoryPoolLifeSpace()
           
 
Method Summary
 DigitalOrganismIterator getAllOrganisms()
          This method provides all the organisms of the lifespace.
 DigitalOrganismIterator getNeighbours(DigitalOrganism org)
          This method gives the neighbours of an organism.
 DigitalOrganism getOrganismRandomly()
          Gives an organism randomly from the entire 'soup'.
 DigitalOrganismIterator getRegion(double percent)
          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 precent)
          Returns some organisms.
 void injectGenome(GeneticCodeTape ct)
          Inserts a genome into the soup.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

orgs

DigitalOrganism[] orgs

NEIGHBOURS

public static final int NEIGHBOURS

SIZE

public static final java.lang.String SIZE

neighbours

DigitalOrganism[] neighbours

neighbour_iterator

DigitalOrganismIterator neighbour_iterator

rnd

java.util.Random rnd
Constructor Detail

MemoryPoolLifeSpace

public MemoryPoolLifeSpace()
Method Detail

getAllOrganisms

public DigitalOrganismIterator getAllOrganisms()
Description copied from interface: LifeSpace
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.)
Specified by:
getAllOrganisms in interface LifeSpace

getNeighbours

public DigitalOrganismIterator getNeighbours(DigitalOrganism org)
Description copied from interface: LifeSpace
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.)
Specified by:
getNeighbours in interface LifeSpace

getOrganismRandomly

public DigitalOrganism getOrganismRandomly()
Description copied from interface: LifeSpace
Gives an organism randomly from the entire 'soup'. It's needed for point mutations for example. The distribution of the hits should be uniform.
Specified by:
getOrganismRandomly in interface LifeSpace

injectGenome

public void injectGenome(GeneticCodeTape ct)
Description copied from interface: LifeSpace
Inserts a genome into the soup. The position is implementation dependent.
Specified by:
injectGenome in interface LifeSpace

getSize

public int getSize()
Description copied from interface: LifeSpace
Gives the capacity (the number of cells) of the lifespace.
Specified by:
getSize in interface LifeSpace

getRegion

public DigitalOrganismIterator getRegion(double percent)
Description copied from interface: LifeSpace
Returns organisms from a connected local territory in the lifespace. (Should return always a new iterator.)
Specified by:
getRegion in interface LifeSpace
Following copied from interface: physis.core.lifespace.LifeSpace
Parameters:
percentage - The percentage of organisms to be returned.

getSomeOrganisms

public DigitalOrganismIterator getSomeOrganisms(double precent)
Description copied from interface: LifeSpace
Returns some organisms. The organisms should be distributed uniformly in the whole lifespace. (Should return always a new iterator.)
Specified by:
getSomeOrganisms in interface LifeSpace
Following copied from interface: physis.core.lifespace.LifeSpace
Parameters:
percentage - The percentage of organisms to be returned.