public class Clock
extends java.lang.Thread
Modifier and Type | Method and Description |
---|---|
void |
addListener(ClockListener listener)
Adds new clock listener.
|
static Clock |
getDefault()
Returns default instance of Clock object.
|
boolean |
isTicking()
Returns whether clock is ticking or not.
|
void |
removeListener(ClockListener listener)
Removes already registered clock listener.
|
void |
resumeClock()
Starts clock again.
|
void |
run()
Main clock loop.
|
void |
setTick(long tick)
Sets period of one clock tick.
|
void |
suspendClock()
Temporarily stops clock.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public static Clock getDefault()
public void setTick(long tick)
tick
- Clock period i.e. time between two notifications to listeners.public void addListener(ClockListener listener)
listener
- Object who whats to be notified after each tick.public void removeListener(ClockListener listener)
listener
- Object who no longer whats to be notified after each tick.public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void suspendClock()
public void resumeClock()
public boolean isTicking()