|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object avrora.sim.clock.Clock
The Clock
class represents a clock within the simulation. There is one main clock for the
Simulator itself, and all other clocks, even if they are not physically derived off the same clock signal,
are simulated by inserting events into the main clock.
Field Summary | |
protected long |
hz
The hz field stores the rate of this clock in cycles per second. |
protected java.lang.String |
name
The name field stores the name of this clock as a string. |
Constructor Summary | |
protected |
Clock(java.lang.String n,
long hz)
|
Method Summary | |
abstract long |
getCount()
The getCount() method returns the number of clock cycles (ticks) that have elapsed for
this clock. |
long |
getHZ()
The getHZ() method returns the number of cycles per second at which this clock runs. |
java.lang.String |
getName()
The getName() method returns the name of this clock source. |
abstract 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. |
abstract 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 |
Field Detail |
protected final long hz
hz
field stores the rate of this clock in cycles per second.
protected final java.lang.String name
name
field stores the name of this clock as a string.
Constructor Detail |
protected Clock(java.lang.String n, long hz)
Method Detail |
public long getHZ()
getHZ()
method returns the number of cycles per second at which this clock runs.
public java.lang.String getName()
getName()
method returns the name of this clock source. Each clock has a name, so that
they can be indexed in the simulator.
public abstract long getCount()
getCount()
method returns the number of clock cycles (ticks) that have elapsed for
this clock.
public abstract 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.
e
- the event to be insertedcycles
- the number of cycles in the future at which to firepublic abstract 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()
.
e
- the event to remove
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |