A managed timer that will tick on intervals. More...
Public Member Functions | |
void | changeInterval (int newInterval) |
Changes the interval of the timer. More... | |
String | getId () |
Gets the Id of the timer. More... | |
int | getInterval () |
Gets the interval that the timer will tick on. More... | |
boolean | getInTick () |
Gets whether the callback is currently being called. More... | |
boolean | getRunning () |
Gets whether the timer is running. More... | |
ManagedTimer (int interval, fm.liveswitch.IAction0 callback) | |
Creates a new instance of the managed timer. More... | |
boolean | start () |
Starts the timer. More... | |
boolean | stop () |
Stops the timer. More... | |
boolean | stop (boolean waitForStop) |
Stops the timer. More... | |
fm.liveswitch.Future< Object > | stopAsync () |
Stops the timer. More... | |
Static Public Member Functions | |
static int | perSecondInterval (double timesPerSecond) |
Calculates a interval based on how many times you want the timer to tick per second. More... | |
A managed timer that will tick on intervals.
Might catchup if callback takes too long.
fm.liveswitch.ManagedTimer.ManagedTimer | ( | int | interval, |
fm.liveswitch.IAction0 | callback | ||
) |
Creates a new instance of the managed timer.
interval | The millisecond interval to tick on. |
callback | The callback to use when a tick occurs. |
void fm.liveswitch.ManagedTimer.changeInterval | ( | int | newInterval | ) |
Changes the interval of the timer.
newInterval |
String fm.liveswitch.ManagedTimer.getId | ( | ) |
Gets the Id of the timer.
int fm.liveswitch.ManagedTimer.getInterval | ( | ) |
Gets the interval that the timer will tick on.
boolean fm.liveswitch.ManagedTimer.getInTick | ( | ) |
Gets whether the callback is currently being called.
boolean fm.liveswitch.ManagedTimer.getRunning | ( | ) |
Gets whether the timer is running.
|
static |
Calculates a interval based on how many times you want the timer to tick per second.
timesPerSecond | The amount of times to tick per second. |
boolean fm.liveswitch.ManagedTimer.start | ( | ) |
Starts the timer.
boolean fm.liveswitch.ManagedTimer.stop | ( | ) |
Stops the timer.
boolean fm.liveswitch.ManagedTimer.stop | ( | boolean | waitForStop | ) |
Stops the timer.
waitForStop | True if method should block until timer is stopped. |
fm.liveswitch.Future<Object> fm.liveswitch.ManagedTimer.stopAsync | ( | ) |
Stops the timer.