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:
$Id: PriorityQueue.java,v 1.3 2000/01/12 03:21:34 mdh Exp $
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.
 
Methods inherited from interface jdsl.core.api.KeyBasedContainer
insert, remove, replaceKey
 
Methods inherited from interface jdsl.core.api.InspectableKeyBasedContainer
keys, locators
 
Methods inherited from interface jdsl.core.api.InspectableContainer
contains, elements, isEmpty, size
 
Methods inherited from interface jdsl.core.api.Container
newContainer, replaceElement
 

Method Detail

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