Class AnimThread

java.lang.Object
  |
  +--AnimThread

class AnimThread
extends java.lang.Object
implements java.lang.Runnable

Thread designed to animate a graph. The parameter t of some function is incremented repeatedly, while the refresh() method of a BaseApplet is called.

See Also:
BaseApplet

Field Summary
protected  BaseApplet applet
           
protected  int delay
           
protected  TimeDependent fn
           
protected  boolean killed
           
protected  boolean singleStep
           
protected  double speed
           
protected  double t
           
protected  java.lang.Thread thr
           
 
Constructor Summary
AnimThread(TimeDependent fn, BaseApplet applet)
           
 
Method Summary
 boolean hasStarted()
           
 boolean isRunning()
           
 void kill()
          Signals that the thread should stop running at the next convenient moment.
 void run()
          Performs the work of the thread.
 void setRange(double min, double max)
          Should be considered deprecated and non-functional; will be removed shortly.
 void setRefreshDelay(int delay)
           
 void setSpeed(double speed)
          Sets the ratio between simulation time and real time.
 void start()
          Begins execution in a separate thread.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

thr

protected java.lang.Thread thr

t

protected double t

speed

protected double speed

delay

protected int delay

killed

protected boolean killed

singleStep

protected boolean singleStep

fn

protected TimeDependent fn

applet

protected BaseApplet applet
Constructor Detail

AnimThread

public AnimThread(TimeDependent fn,
                  BaseApplet applet)
Parameters:
fn - The function whose parameter should be varied
applet - The applet which should be refreshed
Method Detail

run

public void run()
Performs the work of the thread. This method should not be executed directly, but via the start() method.
Specified by:
run in interface java.lang.Runnable

hasStarted

public boolean hasStarted()
Returns:
true if the thread has started, else false

start

public void start()
Begins execution in a separate thread. If the thread was previously kill()ed but has not yet terminated, then that thread may, (at the discretion of the implementation) ignore the kill() request.

isRunning

public boolean isRunning()
Returns:
true if the thread is currently running, else false

kill

public void kill()
Signals that the thread should stop running at the next convenient moment. The thread may increment the time parameter and/or refresh the applet a maximum of one more time before halting.

setRange

public void setRange(double min,
                     double max)
Should be considered deprecated and non-functional; will be removed shortly.

setSpeed

public void setSpeed(double speed)
Sets the ratio between simulation time and real time.
Parameters:
speed - The simulation time increment per real second

setRefreshDelay

public void setRefreshDelay(int delay)
Parameters:
delay - The length of real time (in milliseconds) between each frame of animation