|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectavrora.sim.util.PeriodicEvent
The PeriodicEvent class is a utility that allows a Simulator.Event
to be inserted into the simulator that will fire with a specified period of clock
cycles. It works by automatically adding itself back into the timer queue at each
firing.
Simulator.Event| Field Summary | |
Simulator.Event |
event
This field stores the event that will be fired after each period. |
long |
period
This field stores the period (in clock cycles) that the event will be fired. |
Simulator |
simulator
This field stores the simulator in which the event will continually be reinserted. |
| Constructor Summary | |
PeriodicEvent(Simulator s,
Simulator.Event t,
long p)
The constructor for the PeriodicEvent class creates a
new periodic event with the specified period. |
|
| Method Summary | |
void |
fire()
The fire() method is called by the simulator when the
timer event occurs. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public final Simulator simulator
public final Simulator.Event event
public final long period
| Constructor Detail |
public PeriodicEvent(Simulator s,
Simulator.Event t,
long p)
PeriodicEvent class creates a
new periodic event with the specified period. Each time the event
fires, it will be added again back into the simulator's timer event
queue with the same delta. The result is the specified event fires
with the precise period specified.
Creating the PeriodicEvent does not insert it into
the simulator. It is important that these instances of
Simulator match--this probe will always reinsert itself
into the instance passed in the constructor.
s - the simulator in which to reinsert the event each timet - the event to fire after each periodp - the period in clock cycles| Method Detail |
public void fire()
fire() method is called by the simulator when the
timer event occurs. In this implementation, the periodic event is
reinserted into the timer queue, and then the fire()
method of the event is called.
fire in interface Simulator.Event
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||