Package jadex.bridge.service.types.clock
Interface IClock
-
public interface IClock
Interface a for clock. Provides general methods for working with a clock such as starting, stopping, resetting, getting and setting the current time (stop time?). todo: do we want to support setTime() (how to handle timer, ticktimers i.e. keep their time or keep their deltas compared to the current time)
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
EVENT_TYPE_NEW_DELTA
Change event type new delta.static java.lang.String
EVENT_TYPE_NEW_DILATION
Change event type new dilation.static java.lang.String
EVENT_TYPE_NEXT_TIMEPOINT
Change event next timepoint.static java.lang.String
EVENT_TYPE_RESET
Change event type reset.static java.lang.String
EVENT_TYPE_STARTED
Change event type started.static java.lang.String
EVENT_TYPE_STOPPED
Change event type stopped.static java.lang.String
EVENT_TYPE_TIMER_ADDED
Change event timer added.static java.lang.String
EVENT_TYPE_TIMER_REMOVED
Change event timer removed.static java.lang.String
STATE_RUNNING
The clock state running.static java.lang.String
STATE_SUSPENDED
The clock state suspended.static java.lang.String
TYPE_CONTINUOUS
The clock type continuous.static java.lang.String
TYPE_EVENT_DRIVEN
The clock type event driven.static java.lang.String
TYPE_SYSTEM
The clock type system.static java.lang.String
TYPE_TIME_DRIVEN
The clock type time driven.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addChangeListener(jadex.commons.IChangeListener listener)
Add a change listener.void
addTickTimer(ITimer timer)
Add a tick timer.void
addTimer(ITimer timer)
Add a timer.ITimer
createTickTimer(ITimedObject to)
Create a new tick timer.ITimer
createTimer(long time, ITimedObject to)
Create a new timer.void
dispose()
Called, when the clock is no longer used.long
getDelta()
Get the clock delta.java.lang.String
getName()
Get the clocks name.ITimer
getNextTimer()
Get the next timer.long
getStarttime()
Get the clocks start time.java.lang.String
getState()
Get the clock state.double
getTick()
Get the current tick.ITimer[]
getTickTimers()
Get all active tick timers.long
getTime()
Get the current time.ITimer[]
getTimers()
Get all active timers.java.lang.String
getType()
Get the clock type.void
removeChangeListener(jadex.commons.IChangeListener listener)
Remove a change listener.void
removeTickTimer(ITimer timer)
Remove a tick timer.void
removeTimer(ITimer timer)
Remove a timer.void
reset()
Reset the clock.void
setDelta(long delta)
Set the clock delta.void
setStarttime(long starttime)
Set the clocks start time.void
start()
Start the clock.void
stop()
Stop the clock.
-
-
-
Field Detail
-
STATE_RUNNING
static final java.lang.String STATE_RUNNING
The clock state running.- See Also:
- Constant Field Values
-
STATE_SUSPENDED
static final java.lang.String STATE_SUSPENDED
The clock state suspended.- See Also:
- Constant Field Values
-
TYPE_SYSTEM
static final java.lang.String TYPE_SYSTEM
The clock type system.- See Also:
- Constant Field Values
-
TYPE_CONTINUOUS
static final java.lang.String TYPE_CONTINUOUS
The clock type continuous.- See Also:
- Constant Field Values
-
TYPE_EVENT_DRIVEN
static final java.lang.String TYPE_EVENT_DRIVEN
The clock type event driven.- See Also:
- Constant Field Values
-
TYPE_TIME_DRIVEN
static final java.lang.String TYPE_TIME_DRIVEN
The clock type time driven.- See Also:
- Constant Field Values
-
EVENT_TYPE_NEW_DELTA
static final java.lang.String EVENT_TYPE_NEW_DELTA
Change event type new delta.- See Also:
- Constant Field Values
-
EVENT_TYPE_NEW_DILATION
static final java.lang.String EVENT_TYPE_NEW_DILATION
Change event type new dilation.- See Also:
- Constant Field Values
-
EVENT_TYPE_STARTED
static final java.lang.String EVENT_TYPE_STARTED
Change event type started.- See Also:
- Constant Field Values
-
EVENT_TYPE_STOPPED
static final java.lang.String EVENT_TYPE_STOPPED
Change event type stopped.- See Also:
- Constant Field Values
-
EVENT_TYPE_RESET
static final java.lang.String EVENT_TYPE_RESET
Change event type reset.- See Also:
- Constant Field Values
-
EVENT_TYPE_TIMER_ADDED
static final java.lang.String EVENT_TYPE_TIMER_ADDED
Change event timer added.- See Also:
- Constant Field Values
-
EVENT_TYPE_TIMER_REMOVED
static final java.lang.String EVENT_TYPE_TIMER_REMOVED
Change event timer removed.- See Also:
- Constant Field Values
-
EVENT_TYPE_NEXT_TIMEPOINT
static final java.lang.String EVENT_TYPE_NEXT_TIMEPOINT
Change event next timepoint.- See Also:
- Constant Field Values
-
-
Method Detail
-
getTime
long getTime()
Get the current time.- Returns:
- The current time.
-
getTick
double getTick()
Get the current tick.- Returns:
- The current tick.
-
getStarttime
long getStarttime()
Get the clocks start time.- Returns:
- The start time.
-
setStarttime
void setStarttime(long starttime)
Set the clocks start time.- Parameters:
starttime
- The start time.
-
getDelta
long getDelta()
Get the clock delta.- Returns:
- The clock delta.
-
getName
java.lang.String getName()
Get the clocks name.- Returns:
- The name.
-
getType
java.lang.String getType()
Get the clock type.- Returns:
- The clock type.
-
getState
java.lang.String getState()
Get the clock state.- Returns:
- The clock state.
-
setDelta
void setDelta(long delta)
Set the clock delta. param delta The new clock delta.
-
getTimers
ITimer[] getTimers()
Get all active timers.- Returns:
- The active timers.
-
getTickTimers
ITimer[] getTickTimers()
Get all active tick timers.- Returns:
- The active tick timers.
-
start
void start()
Start the clock.
-
stop
void stop()
Stop the clock.
-
reset
void reset()
Reset the clock.
-
createTimer
ITimer createTimer(long time, ITimedObject to)
Create a new timer. The unit of the timespan value depends on the clock implementation. For system clocks, the time value should adhere to the time representation as used bySystem.currentTimeMillis()
.- Parameters:
timespan
- The relative timespan after which the timed object should be notified.to
- The timed object.
-
createTickTimer
ITimer createTickTimer(ITimedObject to)
Create a new tick timer. todo: @param tickcount The number of ticks.- Parameters:
to
- The timed object.
-
getNextTimer
ITimer getNextTimer()
Get the next timer.- Returns:
- The next timer.
-
addChangeListener
void addChangeListener(jadex.commons.IChangeListener listener)
Add a change listener.- Parameters:
listener
- The change listener.
-
removeChangeListener
void removeChangeListener(jadex.commons.IChangeListener listener)
Remove a change listener.- Parameters:
listener
- The change listener.
-
dispose
void dispose()
Called, when the clock is no longer used.
-
addTimer
void addTimer(ITimer timer)
Add a timer.- Parameters:
timer
- The timer.
-
removeTimer
void removeTimer(ITimer timer)
Remove a timer.- Parameters:
timer
- The timer.
-
addTickTimer
void addTickTimer(ITimer timer)
Add a tick timer.- Parameters:
timer
- The timer.
-
removeTickTimer
void removeTickTimer(ITimer timer)
Remove a tick timer.- Parameters:
timer
- The timer.
-
-