* Copyright (c) 1998 Massachusetts Institute of Technology * * @author Todd C. Parnell, tparnell@ai.mit.edu * @version $Id: Queue.java,v 1.1.1.1 2002/06/05 21:56:32 root Exp $ */ public interface Queue { public static final int FRONT = 0; public static final int BACK = 1; /** Returns the number of elements in this. */ public int size(); /** * Gets the tail object from the queue without removing * it. */ public Object peek(); /** * Gets the object from the specified end of the queue * without removing it. */ public Object peek(int end); /** Puts obj into the front the queue. */ public void enqueue(Object obj); /** Puts obj into the specified end of the queue. */ public void enqueue(Object obj, int end); /** Removes and returns the Object at the tail of the queue. */ public Object dequeue(); /** Removes and returns the Object at the specified end of the queue. */ public Object dequeue(int end); /** Tests whether the queue is empty. */ public boolean isEmpty (); /** Returns an Enumeration of the Objects in the queue.
* * Note: Do not modify the queue while enumerating--unpredictable * behavior may result. * * @see java.util.Enumeration */ public Enumeration elements(); } /* * $Log: Queue.java,v $ * Revision 1.1.1.1 2002/06/05 21:56:32 root * CS101 comes to Olin finally. * * Revision 1.1 2000/04/24 22:17:18 nathanw * Bulk reorganization * * Revision 1.12 1999/07/27 16:59:16 las * Updated cs101.util.Queue.java to spell its method peek() * * Revision 1.11 1999/01/21 20:49:19 tparnell * Made Queue.java an interface and added DefaultQueue.java as an implementation. * * Revision 1.10 1998/07/31 21:42:36 tparnell * bugfix * * Revision 1.9 1998/07/31 21:39:01 tparnell * added size() method * * Revision 1.8 1998/07/24 17:19:33 tparnell * Placate new javadoc behavior * */