public abstract class Clock extends Object
The abstract class Clock
is used by the ClockManager
to provide JBotSim with a clock mechanism.
A DefaultClock
is provided, but each platform/implementation is able to use its own clock by subclassiong
the Clock
class.
Modifier and Type | Field and Description |
---|---|
protected ClockManager |
manager |
Constructor and Description |
---|
Clock(ClockManager manager) |
Modifier and Type | Method and Description |
---|---|
abstract int |
getTimeUnit()
Returns the time unit of the clock, in milliseconds.
|
abstract boolean |
isRunning()
Indicates whether the clock is currently running or paused.
|
abstract void |
pause()
Pauses the clock.
|
abstract void |
resume()
Resumes the clock if it was paused.
|
abstract void |
setTimeUnit(int timeUnit)
Sets the time unit of the clock to the specified value in millisecond.
|
abstract void |
start()
Starts the clock.
|
protected ClockManager manager
public Clock(ClockManager manager)
public abstract int getTimeUnit()
Returns the time unit of the clock, in milliseconds. The time unit is the duration of a round.
public abstract void setTimeUnit(int timeUnit)
timeUnit
- The desired time unitpublic abstract boolean isRunning()
true
if running, false
if paused.public abstract void start()
public abstract void pause()
public abstract void resume()