|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object avrora.sim.clock.Clock avrora.sim.clock.SystemClock
The SystemClock
class represents a wrapper around the system clock that
measures actual wall clock time passed in simulation. This implementation encapsulates
the System.currentTimeMillis()
method, and thus provides a precision
of approximately 1000 cycles per second.
Field Summary |
Fields inherited from class avrora.sim.clock.Clock |
hz, name |
Method Summary | |
static SystemClock |
get()
The get() method retrieves the singleton instance of the system clock. |
long |
getCount()
The getCount() method returns the number of clock cycles (ticks) that have elapsed for
this clock. |
long |
getFirstEventDelta()
The getFirstEventDelta() method returns the number of clock cycles until
the first event in the event queue will fire. |
void |
insertEvent(Simulator.Event e,
long cycles)
The insertEvent() method inserts an event into the event queue of the clock with the
specified delay in clock cycles. |
void |
removeEvent(Simulator.Event e)
The removeEvent() method removes an event from the event queue of the clock. |
Methods inherited from class avrora.sim.clock.Clock |
getHZ, getName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static SystemClock get()
get()
method retrieves the singleton instance of the system clock.
SystemClock
classpublic long getCount()
getCount()
method returns the number of clock cycles (ticks) that have elapsed for
this clock.
getCount
in class Clock
public void insertEvent(Simulator.Event e, long cycles)
insertEvent()
method inserts an event into the event queue of the clock with the
specified delay in clock cycles. The event will then be executed at the future time specified.
insertEvent
in class Clock
e
- the event to be insertedcycles
- the number of cycles in the future at which to firepublic void removeEvent(Simulator.Event e)
removeEvent()
method removes an event from the event queue of the clock. The
comparison used is reference equality, not .equals()
.
removeEvent
in class Clock
e
- the event to removepublic long getFirstEventDelta()
getFirstEventDelta()
method returns the number of clock cycles until
the first event in the event queue will fire. This method will return -1 if there are no
events in the queue.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |