cs015.Swarm
Class BeeBehavior

java.lang.Object
  extended byNGP.Timer
      extended bycs015.Swarm.BeeBehavior
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
Direct Known Subclasses:
DoNothingBehavior, MoveBehavior

public abstract class BeeBehavior
extends Timer

This class represents a behavior that has a cs015.Swarm.Directional as the target that the behavior is acting on. It defines accessors and mutators for that target.

See Also:
Directional

Constructor Summary
BeeBehavior()
          This constructor builds a BeeBehavior with a null target.
BeeBehavior(Directional target)
          This constructor takes a new Directional to be target of the behavior and assigns it to its target instance variable.
 
Method Summary
abstract  BeeBehavior copy()
          This method will return a copy of the current behavior.
 Directional getTarget()
          Use this function to obtain the target of the BeeBehavior.
 void setTarget(Directional target)
          Use this method to set the target that a BeeBehavior is acting on.
 
Methods inherited from class NGP.Timer
actionPerformed, activate, getDelay, setDelay, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeeBehavior

public BeeBehavior()
This constructor builds a BeeBehavior with a null target.


BeeBehavior

public BeeBehavior(Directional target)
This constructor takes a new Directional to be target of the behavior and assigns it to its target instance variable.

Parameters:
target - The new target of the behavior.
Method Detail

setTarget

public void setTarget(Directional target)
Use this method to set the target that a BeeBehavior is acting on. The new target has to be a Directional.

Parameters:
target - The new target (A Directional)
See Also:
Directional

getTarget

public Directional getTarget()
Use this function to obtain the target of the BeeBehavior. This method returns a reference to a Directional.

Returns:
This behavior's target reference.
See Also:
Directional

copy

public abstract BeeBehavior copy()
This method will return a copy of the current behavior. The behavior will not have a target. You will have to set the behavior's target using the SetTarget() method! This method is overridden in subclasses to return the correct behavior.