public class ContinuousClock extends AbstractClock implements IContinuousClock
Modifier and Type | Field and Description |
---|---|
protected double |
dilation
The dilation.
|
protected long |
elapsed
The elapsed time.
|
protected jadex.commons.concurrent.Executor |
executor
The active timer watcher.
|
protected long |
laststart
The last starting real time measurement point.
|
protected jadex.commons.concurrent.IThreadPool |
threadpool
The threadpool.
|
currenttime, DEFAULT_DELTA, delta, listeners, name, starttime, state, ticktimer, ticktimers, timers
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 and Description |
---|
ContinuousClock(jadex.bridge.service.types.clock.IClock oldclock,
jadex.commons.concurrent.IThreadPool threadpool)
Create a new clock.
|
ContinuousClock(java.lang.String name,
long starttime,
double dilation,
jadex.commons.concurrent.IThreadPool threadpool)
Create a new clock.
|
ContinuousClock(java.lang.String name,
long starttime,
double dilation,
long delta,
jadex.commons.concurrent.IThreadPool threadpool)
Create a new clock.
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(jadex.commons.IChangeListener listener)
Add a change listener.
|
void |
addTimer(jadex.bridge.service.types.clock.ITimer timer)
Add a timer.
|
protected void |
computeNextTimepoint()
Compute the next timepoint.
|
protected void |
copyFromClock(jadex.bridge.service.types.clock.IClock oldclock)
Transfer state from another clock to this clock.
|
protected jadex.commons.concurrent.Executor |
createExecutor()
Create new executor.
|
void |
dispose()
Called, when the clock is no longer used.
|
double |
getDilation()
Get the clocks dilation.
|
long |
getTime()
Get the clocks name.
|
java.lang.String |
getType()
Get the clock type.
|
void |
removeTimer(jadex.bridge.service.types.clock.ITimer timer)
Remove a timer.
|
void |
reset()
Reset the clock.
|
void |
setDilation(double dilation)
Set the clocks dilation.
|
void |
start()
Start the clock.
|
void |
stop()
Stop the clock.
|
activateTickTimer, addTickTimer, createTickTimer, createTimer, getDelta, getName, getNextTimer, getStarttime, getState, getTick, getTickTimers, getTimers, hasListeners, notifyListeners, removeChangeListener, removeTickTimer, setDelta, setStarttime, shutdown
protected double dilation
protected long laststart
protected long elapsed
protected jadex.commons.concurrent.Executor executor
protected jadex.commons.concurrent.IThreadPool threadpool
public ContinuousClock(java.lang.String name, long starttime, double dilation, jadex.commons.concurrent.IThreadPool threadpool)
name
- The clock name.starttime
- The start time.dilation
- The dilation.public ContinuousClock(java.lang.String name, long starttime, double dilation, long delta, jadex.commons.concurrent.IThreadPool threadpool)
name
- The clock name.starttime
- The start time.dilation
- The dilation.delta
- The tick size (in millis).public ContinuousClock(jadex.bridge.service.types.clock.IClock oldclock, jadex.commons.concurrent.IThreadPool threadpool)
oldclock
- The old clock.protected void copyFromClock(jadex.bridge.service.types.clock.IClock oldclock)
copyFromClock
in class AbstractClock
public void dispose()
dispose
in interface jadex.bridge.service.types.clock.IClock
dispose
in class AbstractClock
public long getTime()
getTime
in interface jadex.bridge.service.types.clock.IClock
getTime
in class AbstractClock
public double getDilation()
getDilation
in interface IContinuousClock
public void setDilation(double dilation)
setDilation
in interface IContinuousClock
dilation
- The clocks dilation.public java.lang.String getType()
getType
in interface jadex.bridge.service.types.clock.IClock
public void start()
start
in interface jadex.bridge.service.types.clock.IClock
start
in class AbstractClock
public void stop()
stop
in interface jadex.bridge.service.types.clock.IClock
stop
in class AbstractClock
public void reset()
reset
in interface jadex.bridge.service.types.clock.IClock
reset
in class AbstractClock
protected void computeNextTimepoint()
public void addTimer(jadex.bridge.service.types.clock.ITimer timer)
addTimer
in interface jadex.bridge.service.types.clock.IClock
addTimer
in class AbstractClock
timer
- The timer.public void removeTimer(jadex.bridge.service.types.clock.ITimer timer)
removeTimer
in interface jadex.bridge.service.types.clock.IClock
removeTimer
in class AbstractClock
timer
- The timer.public void addChangeListener(jadex.commons.IChangeListener listener)
addChangeListener
in interface jadex.bridge.service.types.clock.IClock
addChangeListener
in class AbstractClock
listener
- The change listener.protected jadex.commons.concurrent.Executor createExecutor()