cs015.Swarm
Class MoveRandomlyBehavior

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

public class MoveRandomlyBehavior
extends MoveBehavior

This is a concrete subclass of a MoveBehavior that moves a Directional randomly about the screen.

See Also:
MoveBehavior, BeeBehavior

Constructor Summary
MoveRandomlyBehavior()
          This constructor builds this behavior with no target to act on, that it the target reference in its BeeBehavior superclass is null.
MoveRandomlyBehavior(Directional target)
          This constructor builds this behavior with a target on which it will act.
 
Method Summary
 void activate()
          You should not call this method yourself This method is called at regular intervals to perform this behavior's actions.
 BeeBehavior copy()
          This method returns a copy of the behavior.
 
Methods inherited from class cs015.Swarm.BeeBehavior
getTarget, setTarget
 
Methods inherited from class NGP.Timer
actionPerformed, getDelay, setDelay, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MoveRandomlyBehavior

public MoveRandomlyBehavior()
This constructor builds this behavior with no target to act on, that it the target reference in its BeeBehavior superclass is null.


MoveRandomlyBehavior

public MoveRandomlyBehavior(Directional target)
This constructor builds this behavior with a target on which it will act. This target is passed to the superclass.

Parameters:
target - A Directional to be the target of this behavior.
Method Detail

activate

public void activate()
You should not call this method yourself This method is called at regular intervals to perform this behavior's actions. Every time this method is called, it obtains the vector from the Directional it corresponds to and updates it randomly. It then invokes the superclass' activate method.

Overrides:
activate in class MoveBehavior

copy

public BeeBehavior copy()
This method returns a copy of the behavior. It's target will be null. You will have to set the behavior's target using setTarget(...) method

Specified by:
copy in class BeeBehavior
Returns:
a new MoveRandomlyBehavior