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 longstoptimeThe 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 voidcopyFromClock(IClock oldclock)Transfer state from another clock to this clock.doublegetDilation()The dilation is always 1.0.longgetTime()The current time is always the same as the system time.java.lang.StringgetType()Get the type of the clock.voidstop()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:
copyFromClockin classContinuousClock
-
getType
public java.lang.String getType()
Get the type of the clock.- Specified by:
getTypein interfaceIClock- Overrides:
getTypein classContinuousClock- Returns:
- The clock type.
-
getTime
public long getTime()
The current time is always the same as the system time.- Specified by:
getTimein interfaceIClock- Overrides:
getTimein classContinuousClock- Returns:
- The name.
-
getDilation
public double getDilation()
The dilation is always 1.0.- Specified by:
getDilationin interfaceIContinuousClock- Overrides:
getDilationin classContinuousClock- Returns:
- The clocks dilation.
-
stop
public void stop()
Stop the clock.- Specified by:
stopin interfaceIClock- Overrides:
stopin classContinuousClock
-
-