|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--edu.davidson.tools.SClock
A runnable class designed to provide animation for Physlets. Objects wishing to receive notification of clock ticks must implement the SStepable interface. SStepable objects must register themselves using the addClockListener method. The stepping thread is created by the constructor and put into a wait state. StartClock() will notify the thread to start running. SClock is also a SDataSourceso that other applets can be notified of clock ticks using JavaScript. DataConnections and inter-appletc communication is describted in the book "Teaching with Physlets."
| Constructor Summary | |
SClock()
Create a new SClock. |
|
SClock(SApplet owner)
Create a new SClock to animate the given SApplet. |
|
| Method Summary | |
void |
addClockListener(SStepable cl)
Add an object to the list of objects that will be stepped at every clock tick. |
void |
doStep()
Do one time step and update all clock listeners. |
double |
getDt()
Returns the time step. |
double |
getFPS()
Estimate the frames per second, FPS, for the animation. |
int |
getID()
Get the integer id of the object. |
double |
getMaxTime()
Returns the maximum time for cycle and one-shot mode. |
double |
getMinTime()
Returns the minimum time for cycle mode. |
SApplet |
getOwner()
Get the SApplet owner of the clock. |
double |
getTime()
Returns the animation time. |
double |
getTimeStep()
Returns the time step. |
double[][] |
getVariables()
Get the variables for use by a data connection. |
java.lang.String[] |
getVarStrings()
Get the variable string for use by a data connection. |
boolean |
isContinous()
Determine if the clock is in continuous mode. |
boolean |
isCycle()
Determine if the clock is in cycle mode. |
boolean |
isOneShot()
Determine if the clock is in oneShot mode. |
boolean |
isRunning()
Determine if the clock is running. |
void |
panicStopClock()
Stop the thread at all costs. |
void |
removeAllClockListeners()
Remove all objects from the list that will be stepped at every clock tick. |
void |
removeClockListener(SStepable cl)
Remove an object from the list of objects that will be stepped at every clock tick. |
void |
run()
The run method passed to the thread. |
void |
setContinuous()
Set the clock to always increment the time. |
void |
setCycle(double min,
double max)
Set the clock to cycle between min and max time values. |
void |
setDt(double newDt)
Set the time step. |
void |
setFPS(double fps)
Set the frames per second, FPS, for the animation. |
void |
setOneShot(double min,
double max)
Set the clock to run one time from the min time to the max time. |
void |
setOwner(SApplet owner)
Set the SApplet owner of the clock. |
void |
setTime(double t)
Sets the animation time. |
void |
setTimeStep(double newDt)
Set the time step. |
void |
startClock()
Notify the thread to start running in order to produce clock ticks. |
void |
stopClock()
Notify the thread to stop running. |
| Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public SClock()
public SClock(SApplet owner)
owner - the SApplet that uses this clock for animation.SClock()| Method Detail |
public void addClockListener(SStepable cl)
cl - the clock listenerpublic void removeClockListener(SStepable cl)
cl - the clock listenerpublic void removeAllClockListeners()
removeClockListener(SStepable)public void doStep()
public final double getTime()
public final double getMinTime()
public final double getMaxTime()
public void setTime(double t)
t - the time.public final double getDt()
public void setDt(double newDt)
newDt - the time step for each clock tick.public final double getTimeStep()
public void setTimeStep(double newDt)
newDt - the time step for each clock tick.public void setContinuous()
setCycle(double, double),
setOneShot(double, double)
public void setCycle(double min,
double max)
min - the time minimum.max - the time maximum.setContinuous(),
setOneShot(double, double)
public void setOneShot(double min,
double max)
min - the time minimum.max - the time maximum.setContinuous(),
setCycle(double, double)public void startClock()
stopClock()public void panicStopClock()
stopClock()public void stopClock()
startClock()public double getFPS()
getTimeStep()public void setFPS(double fps)
setTimeStep(double)public boolean isCycle()
public boolean isOneShot()
public boolean isContinous()
public boolean isRunning()
public void run()
public double[][] getVariables()
public java.lang.String[] getVarStrings()
public int getID()
public void setOwner(SApplet owner)
owner - the owner.public SApplet getOwner()
|
Copyright Wolfgang Christian | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||