scranton.queue
Interface PriorityQueue

All Known Implementing Classes:
PriorityQueueViaHeapArray

public interface PriorityQueue

A priority queue applies a comparator so that the remove method dispenses the object that preceed the other objects in the queue when odered with the comparator. Initial condition: this = (); If this = (a0, a1, ..., an-1) then a0 is the front object and an-1 is the rear object. and there is an order relationship "<=" such that ai <= ai+1 for all i, 0<=i<#(L)-2


Method Summary
 java.lang.Object frontOf()
          Method frontOf return front, a0.
 void insert(java.lang.Object item)
          Method insert item into the PriorityQueue.
 boolean isEmpty()
          Method isEmpty returns this==().
 java.lang.Object remove()
          Method remove the object from the front of the PriorityQueue, a0.
 

Method Detail

isEmpty

public boolean isEmpty()
Method isEmpty returns this==(). this'=this .

Returns:
boolean

frontOf

public java.lang.Object frontOf()
Method frontOf return front, a0. pre: this /= () this'=this

Returns:
Object

insert

public void insert(java.lang.Object item)
Method insert item into the PriorityQueue.

Parameters:
item - Post: i'=#(this)+1 There is a k such that a'k=item and

remove

public java.lang.Object remove()
Method remove the object from the front of the PriorityQueue, a0.

Returns:
Object pre: this /= (), post: this = (a0, this')