Package cc.mallet.util.search
Interface PriorityQueue
-
- All Known Implementing Classes:
MinHeap
public interface PriorityQueue
Created by IntelliJ IDEA. User: pereira Date: Jun 18, 2005 Time: 7:46:46 PM Interface representing the basic methods for a priority queue.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
changePriority(QueueElement e, double priority)
Change the priority of queue elemente
topriority
.boolean
contains(QueueElement e)
Does the queue contain an element?QueueElement
extractMin()
Remove the top element of the queue.void
insert(QueueElement e)
Insert elemente
into the queue.QueueElement
min()
Return the top element of the queue.int
size()
The current size of the queue.QueueElement[]
toArray()
Returns any array containing all of the elements in the queue.
-
-
-
Method Detail
-
insert
void insert(QueueElement e)
Insert elemente
into the queue.- Parameters:
e
- the element to insert
-
size
int size()
The current size of the queue.- Returns:
- current size
-
min
QueueElement min()
Return the top element of the queue.- Returns:
- top element of the queue
-
extractMin
QueueElement extractMin()
Remove the top element of the queue.- Returns:
- the element removed
-
changePriority
void changePriority(QueueElement e, double priority)
Change the priority of queue elemente
topriority
. The element's position in the queue is adjusted as needed.- Parameters:
e
- the element that has been changedpriority
- the new priority
-
contains
boolean contains(QueueElement e)
Does the queue contain an element?- Parameters:
e
- the element- Returns:
- whether the queue contains the element
-
toArray
QueueElement[] toArray()
Returns any array containing all of the elements in the queue. They are not guaranteed to be in any particular order.
-
-