CSE115.Fly
Class RandomStateChangeBehaviour

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

public class RandomStateChangeBehaviour
extends Timer


Constructor Summary
RandomStateChangeBehaviour(int delay)
          Creates an object of this class
 
Method Summary
 void activate()
          Randomly flips the state of StateChanger objects in its list.
 void addStateChanger(StateChanger s)
          Adds a StateChanger to the internal list
 void removeStateChanger(StateChanger s)
          Removes a StateChanger from internal list
 
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

RandomStateChangeBehaviour

public RandomStateChangeBehaviour(int delay)
Creates an object of this class

Parameters:
delay - inverse of the frequency with which states are randomly changed
Method Detail

addStateChanger

public void addStateChanger(StateChanger s)
Adds a StateChanger to the internal list

Parameters:
s - StateChanger to be added

removeStateChanger

public void removeStateChanger(StateChanger s)
Removes a StateChanger from internal list

Parameters:
s - StateChanger to be removed

activate

public void activate()
Randomly flips the state of StateChanger objects in its list.