physis.core.lifespace
Class DistributedLattice2DLifeSpace

java.lang.Object
  |
  +--physis.core.lifespace.DistributedLattice2DLifeSpace
All Implemented Interfaces:
CellLifeSpace, LifeSpace, java.rmi.Remote, Remote2DLattice

public class DistributedLattice2DLifeSpace
extends java.lang.Object
implements CellLifeSpace, Remote2DLattice

dependency: Array2DDigitalOrganismIterator, ArrayDigitalOrganismIterator


Field Summary
private  DigitalOrganism[] east
           
private static java.lang.String EAST
           
private  DigitalOrganismProxy east_server
           
private  DigitalOrganism[][] lifespace
           
private static java.lang.String LOCALEAST
           
private static java.lang.String LOCALNORTH
           
private static java.lang.String LOCALSOUTH
           
private static java.lang.String LOCALWEST
           
private  ArrayDigitalOrganismIterator neighbour_iterator
           
private  DigitalOrganism[] neighbours
           
private  DigitalOrganism[] north
           
private static java.lang.String NORTH
           
private  DigitalOrganismProxy north_server
           
private  java.util.Random rnd
           
private  DigitalOrganism[] south
           
private static java.lang.String SOUTH
           
private  DigitalOrganismProxy south_server
           
private  DigitalOrganism[] west
           
private static java.lang.String WEST
           
private  DigitalOrganismProxy west_server
           
private  int x_size
           
private static java.lang.String X_SIZE
           
private  int y_size
           
private static java.lang.String Y_SIZE
           
 
Constructor Summary
DistributedLattice2DLifeSpace()
          Creates a lifespace.
DistributedLattice2DLifeSpace(int x_size_, int y_size_)
          Creates a lifespace with different with dimension x * y.
 
Method Summary
protected  java.net.Socket createSocket(java.lang.String host_port)
           
 DigitalOrganismIterator getAllOrganisms()
          This method provides all the organisms of the lifespace.
 DigitalOrganism[] getEast()
           
 DigitalOrganismIterator getNeighbours(DigitalOrganism digorg)
          This method gives the neighbours of an organism.
 DigitalOrganism[] getNorth()
           
 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 of the lifespace.
 DigitalOrganismIterator getSomeOrganisms(double precent)
          Returns some organisms.
 DigitalOrganism[] getSouth()
           
 DigitalOrganism[] getWest()
           
 void injectGenome(GeneticCodeTape ct)
          Injects the 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

X_SIZE

private static final java.lang.String X_SIZE

Y_SIZE

private static final java.lang.String Y_SIZE

EAST

private static final java.lang.String EAST

WEST

private static final java.lang.String WEST

NORTH

private static final java.lang.String NORTH

SOUTH

private static final java.lang.String SOUTH

LOCALEAST

private static final java.lang.String LOCALEAST

LOCALWEST

private static final java.lang.String LOCALWEST

LOCALNORTH

private static final java.lang.String LOCALNORTH

LOCALSOUTH

private static final java.lang.String LOCALSOUTH

east

private DigitalOrganism[] east

south

private DigitalOrganism[] south

west

private DigitalOrganism[] west

north

private DigitalOrganism[] north

east_server

private DigitalOrganismProxy east_server

south_server

private DigitalOrganismProxy south_server

west_server

private DigitalOrganismProxy west_server

north_server

private DigitalOrganismProxy north_server

x_size

private int x_size

y_size

private int y_size

lifespace

private DigitalOrganism[][] lifespace

neighbours

private DigitalOrganism[] neighbours

neighbour_iterator

private ArrayDigitalOrganismIterator neighbour_iterator

rnd

private java.util.Random rnd
Constructor Detail

DistributedLattice2DLifeSpace

public DistributedLattice2DLifeSpace()
Creates a lifespace. The dimensional parameters are got from Configuration.

DistributedLattice2DLifeSpace

public DistributedLattice2DLifeSpace(int x_size_,
                                     int y_size_)
Creates a lifespace with different with dimension x * y. Setting up the local servers and conects to the remote servers.
Method Detail

injectGenome

public void injectGenome(GeneticCodeTape ct)
Injects the genome into the soup. The target cell is random.
Specified by:
injectGenome in interface LifeSpace

getAllOrganisms

public DigitalOrganismIterator getAllOrganisms()
This method provides all the organisms of the lifespace. This feature is needed when making the update.
Specified by:
getAllOrganisms in interface LifeSpace

getNeighbours

public DigitalOrganismIterator getNeighbours(DigitalOrganism digorg)
This method gives the neighbours of an organism. This is needed when an organism interact with its neighbourhood. Here the topology is 8-neighbourhood on a toroidal two dimensional lattice.
Specified by:
getNeighbours in interface LifeSpace

getOrganismRandomly

public DigitalOrganism getOrganismRandomly()
Gives an organism randomly from the entire 'soup'. It's needed for point mutations for example.
Specified by:
getOrganismRandomly in interface LifeSpace

getSize

public int getSize()
Gives the capacity 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.

getWest

public DigitalOrganism[] getWest()
Specified by:
getWest in interface Remote2DLattice

getEast

public DigitalOrganism[] getEast()
Specified by:
getEast in interface Remote2DLattice

getNorth

public DigitalOrganism[] getNorth()
Specified by:
getNorth in interface Remote2DLattice

getSouth

public DigitalOrganism[] getSouth()
Specified by:
getSouth in interface Remote2DLattice

createSocket

protected java.net.Socket createSocket(java.lang.String host_port)