Source of HeapPriorityQueue.java


  1: /**
  2:    A class that implements the ADT priority queue by using a maxheap.
  3:    
  4:    @author Frank M. Carrano
  5:    @author Timothy M. Henry
  6:    @version 4.0
  7: */
  8: public final class HeapPriorityQueue<T extends Comparable<? super T>>
  9:                    implements PriorityQueueInterface<T>
 10: {
 11:         private MaxHeapInterface<T> pq;        
 12:         
 13:         public HeapPriorityQueue()
 14:         {
 15:                 pq = new MaxHeap<>();
 16:         } // end default constructor
 17:         
 18:         public void add(T newEntry)
 19:         { 
 20:                 pq.add(newEntry);
 21:         } // end add
 22: 
 23: /* < Implementations of remove, peek, isEmpty, getSize, and clear are here. >
 24:    . . . */
 25: } // end HeapPriorityQueue