public class Queue
1: // Fig. 17.13: Queue.java
2: // Class Queue.
3: package com.deitel.jhtp6.ch17;
4:
5: public class Queue
6: {
7: private List queueList;
8:
9: // no-argument constructor
10: public Queue()
11: {
12: queueList = new List( "queue" );
13: } // end Queue no-argument constructor
14:
15: // add object to queue
16: public void enqueue( Object object )
17: {
18: queueList.insertAtBack( object );
19: } // end method enqueue
20:
21: // remove object from queue
22: public Object dequeue() throws EmptyListException
23: {
24: return queueList.removeFromFront();
25: } // end method dequeue
26:
27: // determine if queue is empty
28: public boolean isEmpty()
29: {
30: return queueList.isEmpty();
31: } // end method isEmpty
32:
33: // output queue contents
34: public void print()
35: {
36: queueList.print();
37: } // end method print
38: } // end class Queue
39:
40:
41: /**************************************************************************
42: * (C) Copyright 1992-2005 by Deitel & Associates, Inc. and *
43: * Pearson Education, Inc. All Rights Reserved. *
44: * *
45: * DISCLAIMER: The authors and publisher of this book have used their *
46: * best efforts in preparing the book. These efforts include the *
47: * development, research, and testing of the theories and programs *
48: * to determine their effectiveness. The authors and publisher make *
49: * no warranty of any kind, expressed or implied, with regard to these *
50: * programs or to the documentation contained in these books. The authors *
51: * and publisher shall not be liable in any event for incidental or *
52: * consequential damages in connection with, or arising out of, the *
53: * furnishing, performance, or use of these programs. *
54: *************************************************************************/