avrora.sim
Class MainClock
java.lang.Object
avrora.sim.Clock
avrora.sim.MainClock
- public class MainClock
- extends Clock
|
Constructor Summary |
MainClock(java.lang.String n,
long hz)
|
|
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. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
eventQueue
protected final DeltaQueue eventQueue
MainClock
public MainClock(java.lang.String n,
long hz)
getCount
public long getCount()
- The
getCount() method returns the number of clock cycles (ticks) that have elapsed for
this clock.
- Specified by:
getCount in class Clock
- Returns:
- the number of elapsed time ticks in clock cycles
insertEvent
public 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. The event will then be executed at the future time specified.
- Specified by:
insertEvent in class Clock
- Parameters:
e - the event to be insertedcycles - the number of cycles in the future at which to fire
removeEvent
public void removeEvent(Simulator.Event e)
- The
removeEvent() method removes an event from the event queue of the clock. The
comparison used is reference equality, not .equals().
- Specified by:
removeEvent in class Clock
- Parameters:
e - the event to remove
advance
public void advance(long cycles)
- The
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.
- Parameters:
cycles - the number of cycles to advance the clock
getFirstEventDelta
public long getFirstEventDelta()
- The
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.
- Returns:
- the delta in clock cycles of the first event in the queue; -1 if there are no
events in the queue