Interface PriorityQueue


public interface PriorityQueue


Method Summary
 void clear()
          Make the heap (logically) empty.
 java.lang.Object deleteMin()
          Deletes and returns the smallest item from the priority queue, maintaining heap order.
 void insert(java.lang.Object obj, long priority)
          Insert into the priority queue, maintaining heap order.
 boolean isEmpty()
          Check whether the heap is empty.
 boolean isFull()
          Check whether the heap is full.
 int size()
          Returns the number of elements in this priority queue.
 

Method Detail

insert

public void insert(java.lang.Object obj,
                   long priority)
            throws QueueFullException
Insert into the priority queue, maintaining heap order. Duplicates are allowed. Small values of the argument priority means high priority, Large values means low priority.
Parameters:
obj - the item to insert
priority - the priority to be assigned to the item obj
Throws:
QueueFullException - if the heap is full

deleteMin

public java.lang.Object deleteMin()
                           throws QueueEmptyException
Deletes and returns the smallest item from the priority queue, maintaining heap order.
Returns:
the the smallest item
Throws:
QueueEmptyException - if the queue is empty

size

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

isEmpty

public boolean isEmpty()
Check whether the heap is empty.
Returns:
true if there are no items in the heap.

isFull

public boolean isFull()
Check whether the heap is full.
Returns:
true if no further elements can be inserted into the heap.

clear

public void clear()
Make the heap (logically) empty.