nz.ac.waikato.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.1.1
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 nz.ac.waikato.jdsl.core.api.KeyBasedContainer
insert, remove, replaceKey
 
Methods inherited from interface nz.ac.waikato.jdsl.core.api.InspectableKeyBasedContainer
keys, locators
 
Methods inherited from interface nz.ac.waikato.jdsl.core.api.Container
newContainer, replaceElement
 
Methods inherited from interface nz.ac.waikato.jdsl.core.api.InspectableContainer
contains, elements, isEmpty, size
 

Method Detail

min

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

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


Copyright © 2009 ModelJUnit Project. All Rights Reserved.