Source of PriorityQueueInterface.java


  1: /**
  2:    An interface for the ADT priority queue.
  3:    @author Frank M. Carrano
  4:    @author Timothy M. Henry
  5:    @version 5.0
  6: */
  7: public interface PriorityQueueInterface<T extends Comparable<? super T>>
  8: {
  9:    /** Adds a new entry to this priority queue.
 10:        @param newEntry  An object to be added. */
 11:    public void add(T newEntry);

 13:    /** Removes and returns the entry having the highest priority.
 14:        @return  Either the object having the highest priority or, if the
 15:                 priority queue is empty before the operation, null. */
 16:    public T remove();

 18:    /** Retrieves the entry having the highest priority.
 19:        @return  Either the object having the highest priority or, if the
 20:                 priority queue is empty, null. */
 21:    public T peek();

 23:    /** Detects whether this priority queue is empty.
 24:        @return  True if the priority queue is empty, or false otherwise. */
 25:    public boolean isEmpty();

 27:    /** Gets the size of this priority queue.
 28:        @return  The number of entries currently in the priority queue. */
 29:    public int getSize();

 31:    /** Removes all entries from this priority queue. */
 32:    public void clear();
 33: } // end PriorityQueueInterface