de.steeringbehaviors.simulation.behaviors
Class SimplePathfollowing

java.lang.Object
  extended by de.steeringbehaviors.simulation.behaviors.Behavior
      extended by de.steeringbehaviors.simulation.behaviors.SimplePathfollowing
All Implemented Interfaces:
ObjectAttributes

public class SimplePathfollowing
extends Behavior
implements ObjectAttributes

Base class for all steering behaviors


Field Summary
static int KEEP_GOING
           
protected  double m_arriveDistance
          This is the minimum distance to the waypoint to say we arrived there
protected  int m_stop
          Flag to show if, the vehicle should stop at the last waypoint
static int STOP_AT_TARGET
           
 
Fields inherited from class de.steeringbehaviors.simulation.behaviors.Behavior
m_behaviorName, m_influence, m_needsNeighborhood, m_neighborhood
 
Constructor Summary
SimplePathfollowing()
          Constructor
 
Method Summary
 Vector2d calculate(Vehicle veh)
          Calculates the resulting force vector for this frame
 void setAttribute(java.lang.String name, java.lang.String value, java.util.Hashtable objectList)
          Sets a attribute specified by the name
 boolean setSpecialObject(java.lang.String objectDesc, java.lang.Object specialObject)
          Use this function if you need to pass a special object to certain behaviors, but do not know which behavior really recognizes this object.
 
Methods inherited from class de.steeringbehaviors.simulation.behaviors.Behavior
getBehaviorName, getInfluence, needsNeighborhood, setInfluence, setNeighborhood
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STOP_AT_TARGET

public static final int STOP_AT_TARGET
See Also:
Constant Field Values

KEEP_GOING

public static final int KEEP_GOING
See Also:
Constant Field Values

m_arriveDistance

protected double m_arriveDistance
This is the minimum distance to the waypoint to say we arrived there


m_stop

protected int m_stop
Flag to show if, the vehicle should stop at the last waypoint

Constructor Detail

SimplePathfollowing

public SimplePathfollowing()
Constructor

Method Detail

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value,
                         java.util.Hashtable objectList)
Sets a attribute specified by the name

Specified by:
setAttribute in interface ObjectAttributes
Overrides:
setAttribute in class Behavior
Parameters:
name - name of the attribute
value - value of the attribute
objectList - hashtable of all steeringobjects

setSpecialObject

public boolean setSpecialObject(java.lang.String objectDesc,
                                java.lang.Object specialObject)
Use this function if you need to pass a special object to certain behaviors, but do not know which behavior really recognizes this object. If a behavior recognized the objectDesc, it will return true and cast the object to the correct type internally. If the behavior does not know the objectDesc, it will return false.

Overrides:
setSpecialObject in class Behavior
Parameters:
objectDesc - A string that represents a certain object type
specialObject - An instance of a special object that corresponds to the objectDesc
Returns:
True if the behvaior recognized the description, otherwise False

calculate

public Vector2d calculate(Vehicle veh)
Calculates the resulting force vector for this frame

Overrides:
calculate in class Behavior
Parameters:
veh - The vehicle
Returns:
Returns the resulting force