1 pnkfelix 1.1.2.1 // PriorityQueue.java, created Tue Jun  1 13:43:17 1999 by pnkfelix
 2 cananian 1.1.2.3 // Copyright (C) 1999 Felix S. Klock II <pnkfelix@mit.edu>
 3 pnkfelix 1.1.2.1 // Licensed under the terms of the GNU GPL; see COPYING for details.
 4 pnkfelix 1.1.2.1 package harpoon.Util;
 5 pnkfelix 1.1.2.1 
 6 pnkfelix 1.1.2.1 import java.util.Collection;
 7 pnkfelix 1.1.2.1 
 8 pnkfelix 1.1.2.1 /**
 9 pnkfelix 1.1.2.1  * <code>MaxPriorityQueue</code> maintains a <code>Collection</code> of
10 pnkfelix 1.1.2.1  * <code>Object</code>s, each with an associated priority.
11 pnkfelix 1.1.2.1  * Implementations should make the <code>peekMax</code> and
12 pnkfelix 1.1.2.1  * <code>removeMax</code> operations efficient.  Implementations
13 pnkfelix 1.1.2.1  * need not implement the Object-addition operations of the
14 pnkfelix 1.1.2.1  * <code>Collection</code> interface, since they do not associate each
15 pnkfelix 1.1.2.1  * added <code>Object</code> with a priority.
16 pnkfelix 1.1.2.1  * 
17 cananian 1.1.2.3  * @author  Felix S. Klock II <pnkfelix@mit.edu>
18 ovy      1.3      * @version $Id: MaxPriorityQueue.java,v 1.3 2002/04/23 22:29:05 ovy Exp $
19 pnkfelix 1.1.2.1  */
20 pnkfelix 1.1.2.1 public interface MaxPriorityQueue extends Collection {
21 pnkfelix 1.1.2.2 
22 pnkfelix 1.1.2.2     /** Inserts <code>item</code> into this, assigning it priority
23 pnkfelix 1.1.2.2         <code>priority</code>. 
24 pnkfelix 1.1.2.2         @param item <code>Object</code> being inserted
25 pnkfelix 1.1.2.2         @param priority Priority of <code>item</code>
26 pnkfelix 1.1.2.2     */
27 ovy      1.3         boolean insert(Object item, int priority);
28 pnkfelix 1.1.2.1 
29 pnkfelix 1.1.2.2     /** Returns the <code>Object</code> in <code>this</code> with the
30 pnkfelix 1.1.2.2         highest priority.
31 pnkfelix 1.1.2.2     */
32 pnkfelix 1.1.2.1     Object peekMax();
33 pnkfelix 1.1.2.1     
34 pnkfelix 1.1.2.2     /** Returns and removes the <code>Object</code> in
35 pnkfelix 1.1.2.2         <code>this</code> with the highest priority.
36 pnkfelix 1.1.2.2     */
37 pnkfelix 1.1.2.1     Object deleteMax();
38 ovy      1.3     
39 ovy      1.3     
40 ovy      1.3         /** Returns the priority currently associated with this item.
41 ovy      1.3          */
42 ovy      1.3         int getPriority(Object item);
43 ovy      1.3     
44 ovy      1.3         /** Changes the priority of this <code>Object</code>
45 ovy      1.3             to the new, specified value, and returns the old value
46 ovy      1.3         */
47 ovy      1.3         int setPriority(Object item, int newPriority);
48 ovy      1.3     
49 ovy      1.3         /** Change the priority of this element by the specified delta.
50 ovy      1.3             This is equivalent to <code>setPriority(item, getPriority(item)+delta).
51 ovy      1.3             It might save time in some implementations.
52 ovy      1.3         */
53 ovy      1.3         void changePriority(Object item, int delta);
54 pnkfelix 1.1.2.1     
55 cananian 1.2     }