package u6; /** * Priority Queue. * Stores elements of the key-element pair type, where * the key is considered as a priority value. * * @author V.Boutchkova */ public interface PriorityQueue { /** * Inserts an element with priority key in this priority queue. * @param key the priority value; smaller keys represent greater priority. * @param element the element value; */ public void insert(Object key, Object element); /** * Extracts the element with greater priority, i.e. with minimal key. * @return the element with minimal key */ public Object extract(); /** * Gets the number of entries in this priority queue. * @return the number of elements */ public int size(); /** * Checks whether this priority queue is empty. * @return true iff this priority queue is empty */ public boolean isEmpty(); /** * Reads the minimal key in this priority queue, * without removing the element. */ public Object minKey(); /** * Reads the element with minimal key. */ public Object minKeyElement(); }