Interface IPriorityQueue

All Known Implementing Classes:
JavaPriorityQueue

public interface IPriorityQueue

Required methods for the Priority Queue ADT.


Method Summary
 Object highest()
          Returns an object in this associated with a highest priority key.
 Comparable highestKey()
          Returns a highest priority key in this.
 void insertItem(Comparable key, Object element)
          Associates the given key and object and inserts them into this, increasing its size by 1.
 boolean isEmpty()
          Returns whether or not this is empty.
 Object removeHighest()
          Removes and returns the object in this associated with a highest priority key, reducing its size by 1.
 int size()
          Returns the number of items in this.
 

Method Detail

insertItem

public void insertItem(Comparable key,
                       Object element)
Associates the given key and object and inserts them into this, increasing its size by 1.

Parameters:
key - representation of priority for the element
element - object to store in this

removeHighest

public Object removeHighest()
Removes and returns the object in this associated with a highest priority key, reducing its size by 1.

Throws:
RuntimeException - if this is empty

highestKey

public Comparable highestKey()
Returns a highest priority key in this.

Throws:
RuntimeException - if this is empty

highest

public Object highest()
Returns an object in this associated with a highest priority key.

Throws:
RuntimeException - if this is empty

size

public int size()
Returns the number of items in this.


isEmpty

public boolean isEmpty()
Returns whether or not this is empty.