Please send questions to
st10@humboldt.edu .
/* Cs132PriorityQueue.java 1.0 */
/* by Sharon Tuttle */
/* last modified: 4-8-03 */
/* */
/* an interface for a priority queue; */
/* adapted from pp. 303-304, course text */
public interface Cs132PriorityQueue
{
// can you see that we are in trouble, for a priority queue, if
// the objects are *not* comparable? how else will we grab the
// element of lowest value?
/*------------------------------------------------------------
getFirst()
Purpose: return the minimum value in this priority queue
(non-destructively). Assumes priority queue is NOT
empty.
--------------------------------------------------------------*/
public Comparable getFirst();
/*-------------------------------------------------------------
removeFirst()
Purpose: remove (and return) the minimum value in this priority
queue ("destructively" --- it DOES change the actual
priority queue, removing the value). Also assumes
priority queue is NOT empty.
----------------------------------------------------------------*/
public Comparable removeFirst();
/*----------------------------------------------------------------
add()
Purpose: Assuming that the value to be added is non-null, Comparable
instance value is added to this priority queue.
------------------------------------------------------------------*/
public void add(Comparable value);
/*-----------------------------------------------------------------
isEmpty()
Purpose: return true if there are no elements in the priority queue,
false otherwise.
---------------------------------------------------------------------*/
public boolean isEmpty();
/*-------------------------------------------------------------------
size()
Purpose: returns number of elements within the priority queue
--------------------------------------------------------------------*/
public int size();
/*-------------------------------------------------------------------
clear()
Purpose: removes all elements from priority queue
---------------------------------------------------------------------*/
public void clear();
}