Package samer.tools
Class RThread
- java.lang.Object
-
- Viewable
-
- samer.tools.RThread
-
- All Implemented Interfaces:
- java.lang.Runnable
public class RThread extends Viewable implements java.lang.Runnable
frame rate regulator
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description class
RThread.Kill
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
checkpoint()
This method blocks if the thread has been paused and throws an InterruptedException if the thread has been killed.void
deregulate()
void
dispose()
double
elapsedTime()
void
execute(java.lang.String c, Environment env)
double
fps()
void
getCommands(Agent.Registry r)
Task
getTask()
Viewer
getViewer()
void
interrupt()
long
iterations()
void
join()
void
kill()
Important: this method BLOCKS until the thread co-operatively terminates, either naturally or by not handling the InterruptedException that will be thrown by thecheckpoint()
method the next time it is called.Task
onFinish(Task t)
void
pause()
void
regulate()
void
reset()
void
run()
void
setPriority(double p)
void
setRate(double r)
void
setTask(Task t)
void
start()
void
start(int n)
void
tock()
void
unpause()
-
-
-
Constructor Detail
-
RThread
public RThread()
-
RThread
public RThread(Task r)
-
-
Method Detail
-
getViewer
public Viewer getViewer()
-
dispose
public void dispose()
-
getTask
public Task getTask()
-
setTask
public void setTask(Task t)
-
interrupt
public void interrupt()
-
join
public void join()
-
start
public void start()
-
start
public void start(int n)
-
kill
public void kill()
Important: this method BLOCKS until the thread co-operatively terminates, either naturally or by not handling the InterruptedException that will be thrown by thecheckpoint()
method the next time it is called.
-
setPriority
public void setPriority(double p)
-
pause
public void pause()
-
unpause
public void unpause()
-
checkpoint
public final void checkpoint() throws RThread.Kill
This method blocks if the thread has been paused and throws an InterruptedException if the thread has been killed.- Throws:
RThread.Kill
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
fps
public double fps()
-
elapsedTime
public double elapsedTime()
-
iterations
public long iterations()
-
setRate
public void setRate(double r)
-
regulate
public void regulate()
-
deregulate
public void deregulate()
-
reset
public void reset()
-
tock
public void tock()
-
getCommands
public void getCommands(Agent.Registry r)
-
execute
public void execute(java.lang.String c, Environment env) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-