|
tauZaman v0.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--tauzaman.calendricsystem.granularitylattice.minpriorityqueue.MinPriorityQueue
Constructor Summary | |
MinPriorityQueue()
Constructs a minimum priority queue by initializing its array to the default size and intializing the value -> index hashtable. |
Method Summary | |
boolean |
decreasePriority(java.lang.Object value,
java.lang.Comparable newPriority)
Given a particular element already in the queue, decrease its priority to the given priority. |
MPQElement |
dequeue()
Deletes and returns the element at the root (the element with the minimum priority) of the heap. |
void |
enqueue(java.lang.Comparable priority,
java.lang.Object value)
Inserts a new element into the priority queue. |
int |
getSize()
Returns the number of elements currently in the queue. |
boolean |
isEmpty()
Returns whether or not the queue is empty. |
static void |
main(java.lang.String[] args)
|
java.lang.String |
toString()
Returns a string representation of the minimum priority queue. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public MinPriorityQueue()
Method Detail |
public void enqueue(java.lang.Comparable priority, java.lang.Object value)
priority
- The priority of the new element.value
- The value of the new element.public MPQElement dequeue()
public boolean decreasePriority(java.lang.Object value, java.lang.Comparable newPriority)
value
- The element whose priority we want to decrease.newPriority
- The new priority for the element.
true
if the priority was changed,
false
if the priority given was greater
than the original priority or if the element is not
in the queuepublic int getSize()
public boolean isEmpty()
true
if the queue is empty, false
if
the queue has elementspublic java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
|
tauZaman v0.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |