|
||||||||||
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.MainClock
The MainClock
class represents a clock that has an associated delta queue. This clock is
meant as the main, or driving clock. Clocks that are derived from this class are kept in synch
through the event queue. The MainClock
is advanced by the interpreter for a node.
Field Summary | |
protected DeltaQueue |
eventQueue
The eventQueue field stores a reference to the event queue for this node. |
Fields inherited from class avrora.sim.clock.Clock |
hz, name |
Constructor Summary | |
MainClock(java.lang.String n,
long hz)
The MainClock() method creates a main clock with the specified name and frequency. |
Method Summary | |
void |
advance(long cycles)
The advance() method advances the time of the clock by the number of cycles. |
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. |
void |
skipAhead()
The skipAhead() method skips ahead to the next event in the queue and fires it. |
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 |
Field Detail |
protected final DeltaQueue eventQueue
eventQueue
field stores a reference to the event queue for this node.
Constructor Detail |
public MainClock(java.lang.String n, long hz)
MainClock()
method creates a main clock with the specified name and frequency.
n
- the name of this clockhz
- the number of cycles per second for this clockMethod Detail |
public 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 void advance(long cycles)
advance()
method advances the time of the clock by the number of cycles. This may
happen as the result of executing an instruction, sleeping for a time, delaying, etc. This method is
only intended for use by the agent driving the clock; e.g. the simulator, and not a monitor or probe.
cycles
- the number of cycles to advance the clockpublic 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.
public void skipAhead()
skipAhead()
method skips ahead to the next event in the queue and fires it.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |