/** * CSE 373, Spring 2012 * A client program to test our generic priority queue */ public class PriorityQueueTest { public static void main(String[] args) { testPriorityQueueWithInts(); testPriorityQueueWithStrings(); testPriorityQueueWithPrintJobs(); } public static void testPriorityQueueWithInts() { PriorityQueue pq = new BinaryHeap(); 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() { PriorityQueue pq = new BinaryHeap(); 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() { PriorityQueue pq = new BinaryHeap(); pq.add(new PrintJob(1, "Kona", 3)); pq.add(new PrintJob(2, "Daisy", 1)); pq.add(new PrintJob(3, "Meghan", 3)); pq.add(new PrintJob(4, "Kona", 2)); pq.add(new PrintJob(5, "Martin", 1)); while (!pq.isEmpty()) { System.out.println(pq.remove()); } } }