// An interface for an ordered structure that allows you to remove min elts // (c) 1998, 2001 duane a. bailey package structure5; // ideally this would extend linear, but there are problems.... /** * Interface describing an queue of prioritized values. * This linear-like structure has values that * are inserted in such a way as to allow them to be removed in * increasing order. *
* Example usage: *
* To print out a list of programmers sorted by age we could use the following: *
* public static void main(String[] argv){ * //initialize a new fib heap * {@link PriorityQueue} programmers = new {@link structure.FibHeap#FibHeap() FibHeap()}; * * //add programmers and their ages to heap * //ages current of 7/22/2002 * programmers.{@link #add(Comparable) add(new ComparableAssociation(new Integer(22), "Evan"))}; * programmers.add(new ComparableAssociation(new Integer(19), "Chris")); * programmers.add(new ComparableAssociation(new Integer(20), "Shimon")); * programmers.add(new ComparableAssociation(new Integer(21), "Diane")); * programmers.add(new ComparableAssociation(new Integer(21), "Lida")); * programmers.add(new ComparableAssociation(new Integer(20), "Rob")); * programmers.add(new ComparableAssociation(new Integer(20), "Sean")); * * //print out programmers * while(!programmers.{@link #isEmpty()}){ * ComparableAssociation p = (ComparableAssociation)programmers.{@link #remove()}; * System.out.println(p.getValue() + " is " + p.getKey() + " years old."); * } * } ** * @version $Id: PriorityQueue.java 22 2006-08-21 19:27:26Z bailey $ * @author, 2001 duane a. bailey */ public interface PriorityQueue