u6
Interface PriorityQueue

All Known Implementing Classes:
HeapPriorityQueue

public interface PriorityQueue

Priority Queue. Stores elements of the key-element pair type, where the key is considered as a priority value.


Method Summary
 java.lang.Object extract()
          Extracts the element with greater priority, i.e. with minimal key.
 void insert(java.lang.Object key, java.lang.Object element)
          Inserts an element with priority key in this priority queue.
 boolean isEmpty()
          Checks whether this priority queue is empty.
 java.lang.Object minKey()
          Reads the minimal key in this priority queue, without removing the element.
 java.lang.Object minKeyElement()
          Reads the element with minimal key.
 int size()
          Gets the number of entries in this priority queue.
 

Method Detail

insert

public void insert(java.lang.Object key,
                   java.lang.Object element)
Inserts an element with priority key in this priority queue.
Parameters:
key - the priority value; smaller keys represent greater priority.
element - the element value;

extract

public java.lang.Object extract()
Extracts the element with greater priority, i.e. with minimal key.
Returns:
the element with minimal key

size

public int size()
Gets the number of entries in this priority queue.
Returns:
the number of elements

isEmpty

public boolean isEmpty()
Checks whether this priority queue is empty.
Returns:
true iff this priority queue is empty

minKey

public java.lang.Object minKey()
Reads the minimal key in this priority queue, without removing the element.

minKeyElement

public java.lang.Object minKeyElement()
Reads the element with minimal key.