|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectheaps.generic.GenericHeap<TimeAssociation<T>>
heaps.event.EventHeap<T>
T - the type of all timed heap elementspublic abstract class EventHeap<T>
An interface for all heaps that contain timers as their elements. This is
done by extending interface GenericHeap such that all entries
in the heap are TimeAssociation objects whose contained
objects are of the parameterized type T. Implicitly, all
implementations order the TimeAssociation elements by the
comparator returned by static method
TimeAssociation.getMinComparator. The running time of all
methods defined by this interface depends on the backing implementation.
| Method Summary | |
|---|---|
abstract boolean |
containsElement(T element)
Returns whether there exists a TimeAssociation in the heap
that is associated with the given element parameter. |
abstract TimeAssociation<T> |
getNextTime(T element)
Returns the first TimeAssociation in the heap that is
associated with the given element parameter. |
abstract TimeAssociation<T> |
removeNextTime(T element)
Returns and removes the first TimeAssociation in the heap
that is associated with the given element parameter. |
abstract boolean |
setNextTime(TimeAssociation<T> element,
boolean do_add)
Substitues the given parameter for the first TimeAssociation
in the heap that is associated with the object returned by method
getObject of the parameter. |
| Methods inherited from class heaps.generic.GenericHeap |
|---|
add, allowsDuplicates, contains, getComparator, remove |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface heaps.Heap |
|---|
clear, extract, getSize, isEmpty, top |
| Method Detail |
|---|
public abstract boolean setNextTime(TimeAssociation<T> element,
boolean do_add)
TimeAssociation
in the heap that is associated with the object returned by method
getObject of the parameter. Thus, if the object returned
by method getObject is only present once in the heap, this
method is equivalent to updating its time. If no such
TimeAssociation object exists, this method has the same
effect as calling method add(element) in interface
GenericHeap if flag do_add is
true; otherwise, this method returns false
and has no effect.
element - the element to update in the heapdo_add - if true, then element will be added to the
heap even if not already present
element was either updated or addedpublic abstract TimeAssociation<T> getNextTime(T element)
TimeAssociation in the heap that is
associated with the given element parameter. That is, of
all the TimeAssociation elements that are associated with
the given parameter, the one returned has the smallest value returned by
method getTime. If no such element exists, this method
returns null.
element - the element to query for in the list
TimeAssociation whose event is equal to
argument event, or null if none existspublic abstract boolean containsElement(T element)
TimeAssociation in the heap
that is associated with the given element parameter.
element - the element to query for in the heap
true if a TimeAssociation exists
associated with element, false otheriwsepublic abstract TimeAssociation<T> removeNextTime(T element)
TimeAssociation in the heap
that is associated with the given element parameter. That
is, of all the TimeAssociation elements that are
associated with the given parameter, the one removed has the smallest
value returned by method getTime. If no such element
exists, the heap remains unchanged and this method returns
null.
element - the element to remove from the list
TimeAssociation that was removed from the
heap, or null if the list remains unchanged
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||