CSE115.Fly
Class AttractBehaviour

java.lang.Object
  extended byNGP.Timer
      extended byCSE115.Fly.MoveBehaviour
          extended byCSE115.Fly.AttractBehaviour
All Implemented Interfaces:
ActionListener, EventListener

public class AttractBehaviour
extends MoveBehaviour


Field Summary
 
Fields inherited from class CSE115.Fly.MoveBehaviour
areaOfMovement
 
Constructor Summary
AttractBehaviour(int delay, Rectangle area)
           
 
Method Summary
 void activate()
          For moving the Movables towards the attracting shapes
 void add(Movable movable, Shape attractingShape)
          For adding a Movable and its attracting shape to the lists
 void remove(Movable movable)
          For removing a Movable and its attracting shape from the lists
 
Methods inherited from class CSE115.Fly.MoveBehaviour
getTheta, placeWithinBounds
 
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

AttractBehaviour

public AttractBehaviour(int delay,
                        Rectangle area)
Parameters:
delay - inverse of speed of movement
area - limits within which the Movables are to be moved
Method Detail

add

public void add(Movable movable,
                Shape attractingShape)
For adding a Movable and its attracting shape to the lists

Parameters:
movable - the Movable
attractingShape - the attracting shape

remove

public void remove(Movable movable)
For removing a Movable and its attracting shape from the lists

Parameters:
movable - the Movable

activate

public void activate()
For moving the Movables towards the attracting shapes