|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectavrora.sim.util.DeltaQueue
The DeltaQueue class implements an amortized constant time
delta-queue for processing of scheduled events. Events are put into the queue
that will fire at a given number of cycles in the future. An internal delta
list is maintained where each link in the list represents a set of events
to be fired some number of clock cycles after the previous link.
| Field Summary | |
protected long |
count
The count field stores the total number of cycles that this
queue has been advanced, i.e. the sum of all advance() calls. |
protected avrora.sim.util.DeltaQueue.EventList |
freeEventLists
The freeEventLists field stores a reference to any free event
links that have become unused during the processing of events. |
protected avrora.sim.util.DeltaQueue.Link |
freeLinks
The freeLinks field stores a reference to any free links that
have become unused during the processing of events. |
protected avrora.sim.util.DeltaQueue.Link |
head
The head field stores a reference to the head of the delta queue,
which represents the event that is nearest in the future. |
| Constructor Summary | |
DeltaQueue()
|
|
| Method Summary | |
void |
add(Simulator.Event t,
long cycles)
The add method adds an event to be executed in the future. |
void |
advance(long cycles)
The advance method advances timesteps through the queue by the
specified number of clock cycles, processing any events. |
long |
getCount()
The getCount() gets the total cumulative count of all the
advance() calls on this delta queue. |
long |
getHeadDelta()
The getHeadDelta() method gets the number of clock cycles until
the first event will fire. |
void |
remove(Simulator.Event e)
The remove method removes all occurrences of the specified
event within the delta queue. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected avrora.sim.util.DeltaQueue.Link head
head field stores a reference to the head of the delta queue,
which represents the event that is nearest in the future.
protected avrora.sim.util.DeltaQueue.Link freeLinks
freeLinks field stores a reference to any free links that
have become unused during the processing of events. A free list is used to
prevent garbage from accumulating.
protected avrora.sim.util.DeltaQueue.EventList freeEventLists
freeEventLists field stores a reference to any free event
links that have become unused during the processing of events. A free list
is used to prevent garbage from accumulating.
protected long count
count field stores the total number of cycles that this
queue has been advanced, i.e. the sum of all advance() calls.
| Constructor Detail |
public DeltaQueue()
| Method Detail |
public void add(Simulator.Event t,
long cycles)
add method adds an event to be executed in the future.
t - the event to addcycles - the number of clock cycles in the futurepublic void remove(Simulator.Event e)
remove method removes all occurrences of the specified
event within the delta queue.
e - the event to removepublic void advance(long cycles)
advance method advances timesteps through the queue by the
specified number of clock cycles, processing any events.
cycles - the number of clock cycles to advancepublic long getHeadDelta()
getHeadDelta() method gets the number of clock cycles until
the first event will fire.
public long getCount()
getCount() gets the total cumulative count of all the
advance() calls on this delta queue.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||