|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectpeersim.edsim.Heap
public class Heap
The Heap data structure used to maintain events "sorted" by scheduled time and to obtain the next event to be executed.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface peersim.edsim.PriorityQ |
|---|
PriorityQ.Event |
| Parameter Summary | |
|---|---|
pbits
This parameter specifies how many bits are used to order events that occur at the same time. |
|
size
Specifies the initial capacity of the heap. |
|
| Constructor Summary | |
|---|---|
Heap()
Initializes a new heap using defaults. |
|
Heap(java.lang.String prefix)
Initializes a new heap using the configuration. |
|
| Method Summary | |
|---|---|
void |
add(long time,
java.lang.Object event,
Node node,
byte pid)
Add a new event, to be scheduled at the specified time. |
void |
add(long time,
java.lang.Object event,
Node node,
byte pid,
long priority)
Add a new event, to be scheduled at the specified time. |
long |
maxPriority()
Maximal value of priority this interpretation can deal with. |
long |
maxTime()
Maximal value of time this interpretation can represent. |
PriorityQ.Event |
removeFirst()
Removes the first event in the heap and returns it. |
int |
size()
Returns the current number of events in the system. |
java.lang.String |
toString()
Prints the time values contained in the heap. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Parameter Detail |
|---|
pbits
size
| Constructor Detail |
|---|
public Heap()
public Heap(java.lang.String prefix)
| Method Detail |
|---|
public int size()
size in interface PriorityQ
public void add(long time,
java.lang.Object event,
Node node,
byte pid)
add in interface PriorityQtime - the time at which this event should be scheduledevent - the object describing the eventnode - the node at which the event has to be deliveredpid - the protocol that handles the event
public void add(long time,
java.lang.Object event,
Node node,
byte pid,
long priority)
add in interface PriorityQtime - the time at which this event should be scheduledevent - the object describing the eventnode - the node at which the event has to be deliveredpid - the protocol that handles the eventpriority - if for two events the "time" value is the same, this
value should be used to order them. Lower value means higher priority.
Like with time, non-negativity as assumed.public PriorityQ.Event removeFirst()
removeFirst in interface PriorityQpublic long maxTime()
PriorityQ
maxTime in interface PriorityQpublic long maxPriority()
PriorityQ
maxPriority in interface PriorityQPriorityQ.add(long,Object,Node,byte,long)public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||