de.steeringbehaviors.simulation.mind
Class Mind

java.lang.Object
  extended by de.steeringbehaviors.simulation.mind.Mind
Direct Known Subclasses:
SimpleMind

public class Mind
extends java.lang.Object


Field Summary
protected  java.util.Vector m_behaviors
          List of behaviors used on this object
protected  java.util.Vector m_forces
          List of the behaviors with the associated forces for the last frame
protected  boolean m_trackBehaviors
          Use this to turn on the tracking of behavior forces
 
Constructor Summary
Mind()
          Constructor
Mind(java.util.Vector behaviors)
          Constructor
 
Method Summary
 void addBehavior(Behavior behave)
          Adds a new behaviors to the list of behaviors
 Vector2d calculate(Vehicle v)
          Calculates the forces based on internal data
 java.util.Iterator getBehaviors()
          Gives access to the list of behaviors
 java.util.Vector getForces()
          Gives acces to the vector with the forces for each behavior in the last frame
 void setBehaviors(java.util.Vector behaviors)
          Replaces the array of behaviors with a new one
 void setTrackBehaviors(boolean trackBehaviors)
          Toggles the state of behavior tracking.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_behaviors

protected java.util.Vector m_behaviors
List of behaviors used on this object


m_forces

protected java.util.Vector m_forces
List of the behaviors with the associated forces for the last frame


m_trackBehaviors

protected boolean m_trackBehaviors
Use this to turn on the tracking of behavior forces

Constructor Detail

Mind

public Mind()
Constructor


Mind

public Mind(java.util.Vector behaviors)
Constructor

Parameters:
behaviors - Array with the behaviors to be used in the mind
Method Detail

setBehaviors

public void setBehaviors(java.util.Vector behaviors)
Replaces the array of behaviors with a new one

Parameters:
behaviors - Array with the new behaviors

addBehavior

public void addBehavior(Behavior behave)
Adds a new behaviors to the list of behaviors

Parameters:
behave - The new behavior

setTrackBehaviors

public void setTrackBehaviors(boolean trackBehaviors)
Toggles the state of behavior tracking. If it is turned on, the calculated forces of the behaviors are stored in the forces array for every frame.

Parameters:
trackBehaviors - Turns the tracking of behavior forces on or off

getBehaviors

public java.util.Iterator getBehaviors()
Gives access to the list of behaviors

Returns:
Iterator over the list of behaviors

getForces

public java.util.Vector getForces()
Gives acces to the vector with the forces for each behavior in the last frame

Returns:
A Vector with the name of the behavior and the calculated force in the last frame

calculate

public Vector2d calculate(Vehicle v)
Calculates the forces based on internal data

Returns:
The force for this step of animation