Package jadex.platform.service.clock
Class SystemClock
- java.lang.Object
-
- jadex.platform.service.clock.AbstractClock
-
- jadex.platform.service.clock.ContinuousClock
-
- jadex.platform.service.clock.SystemClock
-
- All Implemented Interfaces:
IClock
,IContinuousClock
public class SystemClock extends ContinuousClock
Clock implementation that corresponds to the exact system clock.
-
-
Field Summary
Fields Modifier and Type Field Description protected long
stoptime
The time when the clock was stopped (used to adjust timers before restarting the clock).-
Fields inherited from class jadex.platform.service.clock.ContinuousClock
dilation, elapsed, executor, laststart, threadpool
-
Fields inherited from class jadex.platform.service.clock.AbstractClock
currenttime, DEFAULT_DELTA, delta, listeners, name, starttime, state, ticktimer, ticktimers, timers
-
Fields inherited from interface jadex.bridge.service.types.clock.IClock
EVENT_TYPE_NEW_DELTA, EVENT_TYPE_NEW_DILATION, EVENT_TYPE_NEXT_TIMEPOINT, EVENT_TYPE_RESET, EVENT_TYPE_STARTED, EVENT_TYPE_STOPPED, EVENT_TYPE_TIMER_ADDED, EVENT_TYPE_TIMER_REMOVED, STATE_RUNNING, STATE_SUSPENDED, TYPE_CONTINUOUS, TYPE_EVENT_DRIVEN, TYPE_SYSTEM, TYPE_TIME_DRIVEN
-
-
Constructor Summary
Constructors Constructor Description SystemClock(IClock oldclock, IThreadPool threadpool)
Create a new clock.SystemClock(java.lang.String name, long delta, IThreadPool threadpool)
Create a new clock.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copyFromClock(IClock oldclock)
Transfer state from another clock to this clock.double
getDilation()
The dilation is always 1.0.long
getTime()
The current time is always the same as the system time.java.lang.String
getType()
Get the type of the clock.void
stop()
Stop the clock.-
Methods inherited from class jadex.platform.service.clock.ContinuousClock
addChangeListener, addTimer, computeNextTimepoint, createExecutor, dispose, removeTimer, reset, setDilation, start
-
Methods inherited from class jadex.platform.service.clock.AbstractClock
activateTickTimer, addTickTimer, createTickTimer, createTimer, getDelta, getName, getNextTimer, getStarttime, getState, getTick, getTickTimers, getTimers, hasListeners, notifyListeners, removeChangeListener, removeTickTimer, setDelta, setStarttime, shutdown
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jadex.bridge.service.types.clock.IClock
addTickTimer, createTickTimer, createTimer, getDelta, getName, getNextTimer, getStarttime, getState, getTick, getTickTimers, getTimers, removeChangeListener, removeTickTimer, setDelta, setStarttime
-
-
-
-
Constructor Detail
-
SystemClock
public SystemClock(IClock oldclock, IThreadPool threadpool)
Create a new clock.- Parameters:
oldclock
- The old clock.
-
SystemClock
public SystemClock(java.lang.String name, long delta, IThreadPool threadpool)
Create a new clock.
-
-
Method Detail
-
copyFromClock
public void copyFromClock(IClock oldclock)
Transfer state from another clock to this clock.- Overrides:
copyFromClock
in classContinuousClock
-
getType
public java.lang.String getType()
Get the type of the clock.- Specified by:
getType
in interfaceIClock
- Overrides:
getType
in classContinuousClock
- Returns:
- The clock type.
-
getTime
public long getTime()
The current time is always the same as the system time.- Specified by:
getTime
in interfaceIClock
- Overrides:
getTime
in classContinuousClock
- Returns:
- The name.
-
getDilation
public double getDilation()
The dilation is always 1.0.- Specified by:
getDilation
in interfaceIContinuousClock
- Overrides:
getDilation
in classContinuousClock
- Returns:
- The clocks dilation.
-
stop
public void stop()
Stop the clock.- Specified by:
stop
in interfaceIClock
- Overrides:
stop
in classContinuousClock
-
-