Scribble Problem Set Javadocs

cs101.util.queue
Interface Queue

All Known Implementing Classes:
DefaultQueue

public interface Queue

Generic Queue Interface. Allows insertion/deletion at either end.

Copyright (c) 1998 Massachusetts Institute of Technology

Version:
$Id: Queue.java,v 1.1.1.1 2002/06/05 21:56:32 root Exp $
Author:
Todd C. Parnell, tparnell@ai.mit.edu

Field Summary
static int BACK
           
static int FRONT
           
 
Method Summary
 java.lang.Object dequeue()
          Removes and returns the Object at the tail of the queue.
 java.lang.Object dequeue(int end)
          Removes and returns the Object at the specified end of the queue.
 java.util.Enumeration elements()
          Returns an Enumeration of the Objects in the queue.
 void enqueue(java.lang.Object obj)
          Puts obj into the front the queue.
 void enqueue(java.lang.Object obj, int end)
          Puts obj into the specified end of the queue.
 boolean isEmpty()
          Tests whether the queue is empty.
 java.lang.Object peek()
          Gets the tail object from the queue without removing it.
 java.lang.Object peek(int end)
          Gets the object from the specified end of the queue without removing it.
 int size()
          Returns the number of elements in this.
 

Field Detail

FRONT

public static final int FRONT
See Also:
Constant Field Values

BACK

public static final int BACK
See Also:
Constant Field Values
Method Detail

size

public int size()
Returns the number of elements in this.


peek

public java.lang.Object peek()
Gets the tail object from the queue without removing it.


peek

public java.lang.Object peek(int end)
Gets the object from the specified end of the queue without removing it.


enqueue

public void enqueue(java.lang.Object obj)
Puts obj into the front the queue.


enqueue

public void enqueue(java.lang.Object obj,
                    int end)
Puts obj into the specified end of the queue.


dequeue

public java.lang.Object dequeue()
Removes and returns the Object at the tail of the queue.


dequeue

public java.lang.Object dequeue(int end)
Removes and returns the Object at the specified end of the queue.


isEmpty

public boolean isEmpty()
Tests whether the queue is empty.


elements

public java.util.Enumeration elements()
Returns an Enumeration of the Objects in the queue.

Note: Do not modify the queue while enumerating--unpredictable behavior may result.

See Also:
Enumeration

Scribble Problem Set Javadocs