physis.core.virtualmachine
Class PhysisVirtualMachine

java.lang.Object
  |
  +--physis.core.virtualmachine.VirtualMachine
        |
        +--physis.core.virtualmachine.PhysisVirtualMachine
Direct Known Subclasses:
MarVM, PrimordialSoupVM, UP

public abstract class PhysisVirtualMachine
extends VirtualMachine

This is the base class for all virtualmachines which are implemented in Physis. This class should contain some "biological" fields and operations.

Author:
sirna

Field Summary
protected  GeneticCodeTape alien
          This is another codetape for alien genomes.
protected  DigitalOrganism bearer
          It's a backreference to the bearer digtal organism.
protected static short blank
          The blank instruction.
protected  int counter
          counts the instructions between creating childs
protected  int gestation_time
          Time (in executed instructions) needed to create a child.
protected static int GESTATION_TIME_INVALID
          This value shows that the VM hasn't executed a succesfull divide operation yet.
protected  GeneticCodeTape tape
          This codetape contains the organism's genetic code.
 
Constructor Summary
PhysisVirtualMachine()
           
 
Method Summary
 DigitalOrganism getBearer()
          Returns the bearer organism.
 int getEffectiveLength()
          Gives the number of copied or executed instructions.
abstract  Genome getGenome()
          Returns the genetic information.
abstract  int getGenomeSize()
          Returns the size of the genome.
 int getGestationTime()
          Gives the number of instructions that was needed last time to yield a new organism.
 void loadCodeTape(GeneticCodeTape ct)
          Loads the codetape into the VM.
abstract  void restart()
          This should be called after successfull proliferation.
 void setBearer(DigitalOrganism bearer_)
          Sets the bearer organism of the VM.
 
Methods inherited from class physis.core.virtualmachine.VirtualMachine
execute, execute, getState, reset
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

blank

protected static final short blank
The blank instruction. It's implicitly part of all instructionsets.

tape

protected GeneticCodeTape tape
This codetape contains the organism's genetic code.

alien

protected GeneticCodeTape alien
This is another codetape for alien genomes. (for parasitism)

bearer

protected DigitalOrganism bearer
It's a backreference to the bearer digtal organism. It's useful when generating an event and there's a need to know the digital organism. The same with environment interactions and parasitism or facing change.

GESTATION_TIME_INVALID

protected static final int GESTATION_TIME_INVALID
This value shows that the VM hasn't executed a succesfull divide operation yet.

gestation_time

protected int gestation_time
Time (in executed instructions) needed to create a child. (Actually it's the last time when birth happened.)

counter

protected int counter
counts the instructions between creating childs
Constructor Detail

PhysisVirtualMachine

public PhysisVirtualMachine()
Method Detail

getGestationTime

public int getGestationTime()
Gives the number of instructions that was needed last time to yield a new organism. If the organism hasn't spawned yet, then it returns the number of executed instructions. This way the unfertile organisms are filtered out, but the first time after birth they have good chance (low gestation time

getGenome

public abstract Genome getGenome()
Returns the genetic information.

getGenomeSize

public abstract int getGenomeSize()
Returns the size of the genome.

getEffectiveLength

public int getEffectiveLength()
Gives the number of copied or executed instructions. (It grabs it from the CodeTape.)

restart

public abstract void restart()
This should be called after successfull proliferation. (it doesn't change the gestation_time to invalid)

loadCodeTape

public void loadCodeTape(GeneticCodeTape ct)
Loads the codetape into the VM.

setBearer

public void setBearer(DigitalOrganism bearer_)
Sets the bearer organism of the VM.

getBearer

public DigitalOrganism getBearer()
Returns the bearer organism.