Package jadex.platform.service.clock
Class ContinuousClock
- java.lang.Object
- 
- jadex.platform.service.clock.AbstractClock
- 
- jadex.platform.service.clock.ContinuousClock
 
 
- 
- All Implemented Interfaces:
- IClock,- IContinuousClock
 - Direct Known Subclasses:
- SystemClock
 
 public class ContinuousClock extends AbstractClock implements IContinuousClock A continuous clock represents a real time clock that is based on the hardware clock. Can be made faster or slower and also has an adjustable start time.
- 
- 
Field SummaryFields Modifier and Type Field Description protected doubledilationThe dilation.protected longelapsedThe elapsed time.protected ExecutorexecutorThe active timer watcher.protected longlaststartThe last starting real time measurement point.protected IThreadPoolthreadpoolThe threadpool.- 
Fields inherited from class jadex.platform.service.clock.AbstractClockcurrenttime, DEFAULT_DELTA, delta, listeners, name, starttime, state, ticktimer, ticktimers, timers
 - 
Fields inherited from interface jadex.bridge.service.types.clock.IClockEVENT_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 SummaryConstructors Constructor Description ContinuousClock(IClock oldclock, IThreadPool threadpool)Create a new clock.ContinuousClock(java.lang.String name, long starttime, double dilation, long delta, IThreadPool threadpool)Create a new clock.ContinuousClock(java.lang.String name, long starttime, double dilation, IThreadPool threadpool)Create a new clock.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChangeListener(IChangeListener listener)Add a change listener.voidaddTimer(ITimer timer)Add a timer.protected voidcomputeNextTimepoint()Compute the next timepoint.voidcopyFromClock(IClock oldclock)Transfer state from another clock to this clock.protected ExecutorcreateExecutor()Create new executor.voiddispose()Called, when the clock is no longer used.doublegetDilation()Get the clocks dilation.longgetTime()Get the clocks name.java.lang.StringgetType()Get the clock type.voidremoveTimer(ITimer timer)Remove a timer.voidreset()Reset the clock.voidsetDilation(double dilation)Set the clocks dilation.voidstart()Start the clock.voidstop()Stop the clock.- 
Methods inherited from class jadex.platform.service.clock.AbstractClockactivateTickTimer, addTickTimer, createTickTimer, createTimer, getDelta, getName, getNextTimer, getStarttime, getState, getTick, getTickTimers, getTimers, hasListeners, notifyListeners, removeChangeListener, removeTickTimer, setDelta, setStarttime, shutdown
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface jadex.bridge.service.types.clock.IClockaddTickTimer, createTickTimer, createTimer, getDelta, getName, getNextTimer, getStarttime, getState, getTick, getTickTimers, getTimers, removeChangeListener, removeTickTimer, setDelta, setStarttime
 
- 
 
- 
- 
- 
Field Detail- 
dilationprotected double dilation The dilation.
 - 
laststartprotected long laststart The last starting real time measurement point.
 - 
elapsedprotected long elapsed The elapsed time.
 - 
executorprotected Executor executor The active timer watcher.
 - 
threadpoolprotected IThreadPool threadpool The threadpool.
 
- 
 - 
Constructor Detail- 
ContinuousClockpublic ContinuousClock(java.lang.String name, long starttime, double dilation, IThreadPool threadpool)Create a new clock. Delta (tick size) is default (see AbstractClock).- Parameters:
- name- The clock name.
- starttime- The start time.
- dilation- The dilation.
 
 - 
ContinuousClockpublic ContinuousClock(java.lang.String name, long starttime, double dilation, long delta, IThreadPool threadpool)Create a new clock.- Parameters:
- name- The clock name.
- starttime- The start time.
- dilation- The dilation.
- delta- The tick size (in millis).
 
 - 
ContinuousClockpublic ContinuousClock(IClock oldclock, IThreadPool threadpool) Create a new clock.- Parameters:
- oldclock- The old clock.
 
 
- 
 - 
Method Detail- 
copyFromClockpublic void copyFromClock(IClock oldclock) Transfer state from another clock to this clock.- Overrides:
- copyFromClockin class- AbstractClock
 
 - 
disposepublic void dispose() Called, when the clock is no longer used.- Specified by:
- disposein interface- IClock
- Overrides:
- disposein class- AbstractClock
 
 - 
getTimepublic long getTime() Get the clocks name.- Specified by:
- getTimein interface- IClock
- Overrides:
- getTimein class- AbstractClock
- Returns:
- The name.
 
 - 
getDilationpublic double getDilation() Get the clocks dilation.- Specified by:
- getDilationin interface- IContinuousClock
- Returns:
- The clocks dilation.
 
 - 
setDilationpublic void setDilation(double dilation) Set the clocks dilation.- Specified by:
- setDilationin interface- IContinuousClock
- Parameters:
- dilation- The clocks dilation.
 
 - 
getTypepublic java.lang.String getType() Get the clock type.
 - 
startpublic void start() Start the clock.- Specified by:
- startin interface- IClock
- Overrides:
- startin class- AbstractClock
 
 - 
stoppublic void stop() Stop the clock.- Specified by:
- stopin interface- IClock
- Overrides:
- stopin class- AbstractClock
 
 - 
resetpublic void reset() Reset the clock.- Specified by:
- resetin interface- IClock
- Overrides:
- resetin class- AbstractClock
 
 - 
computeNextTimepointprotected void computeNextTimepoint() Compute the next timepoint.
 - 
addTimerpublic void addTimer(ITimer timer) Add a timer.- Specified by:
- addTimerin interface- IClock
- Overrides:
- addTimerin class- AbstractClock
- Parameters:
- timer- The timer.
 
 - 
removeTimerpublic void removeTimer(ITimer timer) Remove a timer.- Specified by:
- removeTimerin interface- IClock
- Overrides:
- removeTimerin class- AbstractClock
- Parameters:
- timer- The timer.
 
 - 
addChangeListenerpublic void addChangeListener(IChangeListener listener) Add a change listener.- Specified by:
- addChangeListenerin interface- IClock
- Overrides:
- addChangeListenerin class- AbstractClock
- Parameters:
- listener- The change listener.
 
 - 
createExecutorprotected Executor createExecutor() Create new executor.
 
- 
 
-