jdsl.core.api
Interface PriorityQueue
- All Superinterfaces:
- Container, InspectableContainer, InspectableKeyBasedContainer, KeyBasedContainer
- All Known Implementing Classes:
- ArrayHeap
- public interface PriorityQueue
- extends KeyBasedContainer
A partially-ordered container that allows for
removal of the element with highest priority. The names of
the methods (e.g., min()) assume that high priorities are
numerically low, but nothing except the names requires this
convention.
The interface makes no assumptions about how comparisons are made,
or how the elements are ordered. The priority of two elements may
be hardcoded or chosen dynamicaly, depending upon the specific
implementation.
Note that there is no InspectablePriorityQueue.
- Version:
- JDSL 2.0.6
- Author:
- Mark Handy, Andrew Schwerin, Luca Vismara
Method Summary |
Locator |
min()
Allows access to element with highest priority without removing
it from the priority queue. |
java.lang.Object |
removeMin()
Pops the highest-priority element off the priority queue and
updates the priority queue. |
min
public Locator min()
throws EmptyContainerException
- Allows access to element with highest priority without removing
it from the priority queue.
- Returns:
- the locator to the element with highest priority in the
priority queue
- Throws:
EmptyContainerException
- if the priority queue is empty
removeMin
public java.lang.Object removeMin()
throws EmptyContainerException
- Pops the highest-priority element off the priority queue and
updates the priority queue.
- Returns:
- an element with highest priority in the priority queue
- Throws:
EmptyContainerException
- if the priority queue is empty