Class LQueue

java.lang.Object
  |
  +--LQueue

public class LQueue
extends Object

LQueue.java Created: Mon Mar 24 22:24:44 2003

Author:
Stuart C. Shapiro

Constructor Summary
LQueue()
          Creates a new LQueue instance.
 
Method Summary
 Object dequeue()
          Removes the Object that is at the front of this queue, and returns it.
 void enqueue(Object obj)
          Adds an Object to the rear of this queue.
 Object front()
          Returns the first element on this queue.
 boolean isEmpty()
          Determines if this queue is empty.
 String toString()
          Returns a String representation of this queue, showing all the elements of it, with the first at the left, surrounded by parentheses.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LQueue

public LQueue()
Creates a new LQueue instance.

Method Detail

isEmpty

public boolean isEmpty()
Determines if this queue is empty.

Returns:
true if this queue is empty; false otherwise.

front

public Object front()
             throws NoSuchElementException
Returns the first element on this queue.

Returns:
the first Object on the queue.
Throws:
NoSuchElementException - if this queue is empty.

enqueue

public void enqueue(Object obj)
Adds an Object to the rear of this queue.

Parameters:
obj - the Object to be added to this queue.

dequeue

public Object dequeue()
               throws NoSuchElementException
Removes the Object that is at the front of this queue, and returns it.

Returns:
the Object at the front of this queue, having removed it from this queue.
Throws:
NoSuchElementException - if this queue is empty.

toString

public String toString()
Returns a String representation of this queue, showing all the elements of it, with the first at the left, surrounded by parentheses.

Overrides:
toString in class Object
Returns:
a String representation of this queue, showing all the elements of it, with the first at the left, surrounded by parentheses.