/** * CSE 373, Spring 2011, Jessica Miller * A client program to test our GenericPriorityQueue. */ public class PriorityQueueTest { public static void main(String[] args) { testPriorityQueueWithInts(); testPriorityQueueWithStrings(); testPriorityQueueWithPrintJobs(); } public static void testPriorityQueueWithInts() { GenericPriorityQueue pq = new BinaryHeapPQ(); pq.add(13); pq.add(20); pq.add(11); pq.add(44); pq.add(3); pq.add(7); pq.add(9); while (!pq.isEmpty()) { System.out.println(pq.remove()); } System.out.println(); } public static void testPriorityQueueWithStrings() { GenericPriorityQueue pq = new BinaryHeapPQ(); pq.add("Kona"); pq.add("Daisy"); pq.add("Meghan"); pq.add("Martin"); while (!pq.isEmpty()) { System.out.println(pq.remove()); } System.out.println(); } public static void testPriorityQueueWithPrintJobs() { GenericPriorityQueue pjs = new BinaryHeapPQ(); pjs.add(new PrintJob(1, "Kona", 3)); pjs.add(new PrintJob(2, "Daisy", 1)); pjs.add(new PrintJob(3, "Meghan", 3)); pjs.add(new PrintJob(4, "Kona", 2)); pjs.add(new PrintJob(5, "Martin", 1)); while (!pjs.isEmpty()) { System.out.println(pjs.remove()); } } }