Package jisa.control
Class RTask
- java.lang.Object
-
- jisa.control.RTask
-
public class RTask extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
RTask.Task
-
Constructor Summary
Constructors Constructor Description RTask(long interval, RTask.Task toRun)
Creates a repeating task to run at the given interval.RTask(long interval, SRunnable toRun)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCount()
Returns how many times the task has been run since the timer was last started.long
getInterval()
long
getMSecFromStart()
Returns the number of milliseconds that have elapsed since the task was started.double
getSecFromStart()
Returns the time that has elapsed since the task was started, in seconds.RTask.Task
getTask()
boolean
isRunning()
Is the task currently set to run?void
setInterval(long interval)
void
setTask(RTask.Task task)
void
start()
Start the timer to periodically run the task.void
stop()
Stop the timer from running the task.
-
-
-
Constructor Detail
-
RTask
public RTask(long interval, RTask.Task toRun)
Creates a repeating task to run at the given interval.- Parameters:
interval
- Interval, in millisecondstoRun
- Code to run at each interval
-
RTask
public RTask(long interval, SRunnable toRun)
-
-
Method Detail
-
setInterval
public void setInterval(long interval)
-
getInterval
public long getInterval()
-
setTask
public void setTask(RTask.Task task)
-
getTask
public RTask.Task getTask()
-
start
public void start()
Start the timer to periodically run the task.
-
stop
public void stop()
Stop the timer from running the task.
-
isRunning
public boolean isRunning()
Is the task currently set to run?- Returns:
- Running?
-
getMSecFromStart
public long getMSecFromStart()
Returns the number of milliseconds that have elapsed since the task was started.- Returns:
- Time running, in milliseconds
-
getSecFromStart
public double getSecFromStart()
Returns the time that has elapsed since the task was started, in seconds.- Returns:
- Time running, in seconds
-
getCount
public int getCount()
Returns how many times the task has been run since the timer was last started.- Returns:
- Run count
-
-