CSE115.Fly
Class MoveBehaviour

java.lang.Object
  extended byNGP.Timer
      extended byCSE115.Fly.MoveBehaviour
All Implemented Interfaces:
ActionListener, EventListener
Direct Known Subclasses:
AttractBehaviour, RandomBehaviour, RepelBehaviour

public abstract class MoveBehaviour
extends Timer


Field Summary
protected  Rectangle areaOfMovement
          The limits within which inheriting classes move their Movables are defined by this
 
Constructor Summary
MoveBehaviour(int delay, Rectangle area)
          Initializes the limiting area and inverse of speed
 
Method Summary
 int getTheta(double dx, double dy)
          Returns the phase ( angle ) of a vector in degrees
 void placeWithinBounds(Point p, int XJUMP, int YJUMP, double deltaX, double deltaY)
          Places a point which has gone off-limits within limits
 
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
 

Field Detail

areaOfMovement

protected Rectangle areaOfMovement
The limits within which inheriting classes move their Movables are defined by this

Constructor Detail

MoveBehaviour

public MoveBehaviour(int delay,
                     Rectangle area)
Initializes the limiting area and inverse of speed

Parameters:
delay - inverse of speed
area - the limiting area
Method Detail

placeWithinBounds

public void placeWithinBounds(Point p,
                              int XJUMP,
                              int YJUMP,
                              double deltaX,
                              double deltaY)
Places a point which has gone off-limits within limits

Parameters:
p - the point
XJUMP - the length of stride along X
YJUMP - the length of stride along Y
deltaX - X-component of vector to move along
deltaY - Y-component of vector to move along

getTheta

public int getTheta(double dx,
                    double dy)
Returns the phase ( angle ) of a vector in degrees

Parameters:
dx - X-component of vector
dy - Y-component of vector