|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.realtime.AsyncEvent | +--javax.realtime.Timer
A Timer
is a timed event that measures time
relative to a given Clock
. This class defines
basic functionality available to all timers. Applications
will generally use either PeriodicTimer
to
create an event that is fired repeatedly at regular intervals,
of OneShotTimer
, which provides the basic
facilities of something that ticks along following some
time line (real-time, cpu-time, user-time, simulation-time,
etc.). All timers are created disabled and do nothing
until start()
is called.
Field Summary | |
protected javax.realtime.Clock |
defaultClock
|
protected boolean |
enabled
|
protected javax.realtime.RelativeTime |
fireAfter
|
protected javax.realtime.AsyncEventHandler |
handler
|
protected javax.realtime.AbsoluteTime |
lastUpdated
|
protected boolean |
started
|
protected javax.realtime.RelativeTime |
timePassed
|
Fields inherited from class javax.realtime.AsyncEvent |
handlersList |
Constructor Summary | |
protected |
Timer(javax.realtime.HighResolutionTime t,
javax.realtime.Clock c,
javax.realtime.AsyncEventHandler handler)
Create a timer that fires at the given time based on the given instance of Clock and is handled by the specified
handler. |
Method Summary | |
javax.realtime.ReleaseParameters |
createReleaseParameters()
Create a ReleaseParameters block appropriate to the
timing characteristics of this event. |
void |
destroy()
Destroy the timer and return all possible resources to the system. |
void |
disable()
Disable this timer, preventing it from firing. |
void |
enable()
Re-enable this timer after it has been disabled. |
javax.realtime.Clock |
getClock()
Gets the instance of Clock that this timer is based on. |
javax.realtime.AbsoluteTime |
getFireTime()
Get the time at which this event will fire. |
boolean |
isRunning()
Tests this to determine if this has been started and is in a state (enabled) such that when the given time occurs it will fire the event. |
void |
reschedule(javax.realtime.HighResolutionTime time)
Change the schedule time for this event; can take either absolute or relative times. |
void |
start()
Starts this time. |
boolean |
stop()
Stops a timer that is running and changes its state to not started. |
Methods inherited from class javax.realtime.AsyncEvent |
addHandler, bindTo, fire, handledBy, removeHandler, setHandler, unbindTo |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected boolean enabled
protected boolean started
protected javax.realtime.Clock defaultClock
protected javax.realtime.RelativeTime fireAfter
protected javax.realtime.AsyncEventHandler handler
protected javax.realtime.RelativeTime timePassed
protected javax.realtime.AbsoluteTime lastUpdated
Constructor Detail |
protected Timer(javax.realtime.HighResolutionTime t, javax.realtime.Clock c, javax.realtime.AsyncEventHandler handler)
Clock
and is handled by the specified
handler.
t
- The time to fire the event. Will be converted to
absolute time.handler
- The default handler to use for this event. If null, no
handler is associated with it and nothing will happen
when this event fires until a handler is provided.Method Detail |
public javax.realtime.ReleaseParameters createReleaseParameters()
ReleaseParameters
block appropriate to the
timing characteristics of this event. The default is the most
pessimistic: AperiodicParameters
. This is typically
called by code that is setting up a handler for this event that
will fill in the parts of the release parameters for which it has
values, e.g, cost.
createReleaseParameters
in class AsyncEvent
ReleaseParameters
object.public void destroy()
public void disable()
public void enable()
public javax.realtime.Clock getClock()
Clock
that this timer is based on.
Clock
.public javax.realtime.AbsoluteTime getFireTime()
AbsoluteTime
object representing
the absolute time at which this will fire.public boolean isRunning()
public void reschedule(javax.realtime.HighResolutionTime time)
time
- The time to reschedule for this event firing. If null, the
previous fire time is still the time at which this will fire.public void start()
Timer
starts measuring time from
when it is started.
public boolean stop()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |