biosim.core.body
Class Body

java.lang.Object
  extended by biosim.core.body.Body
All Implemented Interfaces:
java.io.Serializable, sim.engine.Steppable
Direct Known Subclasses:
AbstractAnt, AbstractFish, AbstractFly, AbstractMonkey, ReplayBody

public abstract class Body
extends java.lang.Object
implements sim.engine.Steppable

See Also:
Serialized Form

Field Summary
protected  Agent agent
           
 boolean notFinished
           
protected  Simulation sim
           
 
Constructor Summary
Body()
           
 
Method Summary
protected  boolean collisionCheck(sim.util.MutableDouble2D newPos, sim.util.MutableDouble2D newDir)
           
protected abstract  boolean computeNewConfiguration(sim.util.MutableDouble2D newPos, sim.util.MutableDouble2D newDir)
           
 void finish()
           
 Agent getAgent()
           
abstract  ec.util.MersenneTwisterFast getRandom()
           
abstract  double getSize()
          The size of the body in meters.
 void init()
           
protected  void move(sim.util.MutableDouble2D newPos, sim.util.MutableDouble2D newDir)
           
 void setAgent(Agent a)
           
 void step(sim.engine.SimState simstate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

agent

protected Agent agent

sim

protected Simulation sim

notFinished

public boolean notFinished
Constructor Detail

Body

public Body()
Method Detail

setAgent

public void setAgent(Agent a)

getAgent

public Agent getAgent()

getRandom

public abstract ec.util.MersenneTwisterFast getRandom()

getSize

public abstract double getSize()
The size of the body in meters. Used in the default portrayal as the size of the displayed circle. Also used in the default Environment.configSim(...) method to determine if a random location for a body is a valid starting location. For Body classes that use more complicated collision detection you may need to write a custom configSim(...) method.


computeNewConfiguration

protected abstract boolean computeNewConfiguration(sim.util.MutableDouble2D newPos,
                                                   sim.util.MutableDouble2D newDir)

collisionCheck

protected boolean collisionCheck(sim.util.MutableDouble2D newPos,
                                 sim.util.MutableDouble2D newDir)

move

protected void move(sim.util.MutableDouble2D newPos,
                    sim.util.MutableDouble2D newDir)

init

public void init()

finish

public void finish()

step

public void step(sim.engine.SimState simstate)
Specified by:
step in interface sim.engine.Steppable