Opus5
Class QueueAsLinkedList
java.lang.Object
|
+--Opus5.AbstractObject
|
+--Opus5.AbstractContainer
|
+--Opus5.QueueAsLinkedList
- All Implemented Interfaces:
- Comparable, Container, Queue
- Direct Known Subclasses:
- DequeAsLinkedList
- public class QueueAsLinkedList
- extends AbstractContainer
- implements Queue
A queue implemented using a linked list.
- Version:
- $Id: QueueAsLinkedList.java,v 3.3 1998/07/28 02:24:04 brpreiss Exp $
- Author:
- Bruno R. Preiss, P.Eng.
|
Method Summary |
void |
accept(Visitor visitor)
Accepts the specified visitor and makes it visit
all the objects in this queue. |
protected int |
compareTo(Comparable arg)
Compares this queue with the specified comparable object. |
java.lang.Object |
dequeue()
Dequeues and returns the object at the head of this queue. |
void |
enqueue(java.lang.Object object)
Enqueues the specified object at the tail of this queue. |
Enumeration |
getEnumeration()
Returns an enumeration that enumerates the objects in this queue. |
java.lang.Object |
getHead()
Returns the object at the head of this queue. |
void |
purge()
Purges this queue, making it empty. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
list
protected LinkedList list
- The linked list.
QueueAsLinkedList
public QueueAsLinkedList()
- Constructs an empty
QueueAsLinkedList.
purge
public void purge()
- Purges this queue, making it empty.
- Specified by:
purge in interface Container
getHead
public java.lang.Object getHead()
- Returns the object at the head of this queue.
- Specified by:
getHead in interface Queue
- Returns:
- the object at the head of this queue.
- Throws:
ContainerEmptyException - If this queue is empty.
enqueue
public void enqueue(java.lang.Object object)
- Enqueues the specified object at the tail of this queue.
- Specified by:
enqueue in interface Queue
- Parameters:
object - The object to be enqueued.
dequeue
public java.lang.Object dequeue()
- Dequeues and returns the object at the head of this queue.
- Specified by:
dequeue in interface Queue
- Returns:
- The object at the head of this queue.
- Throws:
ContainerEmptyException - If the container is empty.
accept
public void accept(Visitor visitor)
- Accepts the specified visitor and makes it visit
all the objects in this queue.
- Specified by:
accept in interface Container- Overrides:
accept in class AbstractContainer
- Parameters:
visitor - The visitor to accept.
getEnumeration
public Enumeration getEnumeration()
- Returns an enumeration that enumerates the objects in this queue.
- Specified by:
getEnumeration in interface Container
- Returns:
- an enumeration that enumerates the objects in this queue.
compareTo
protected int compareTo(Comparable arg)
- Compares this queue with the specified comparable object.
This method is not implemented.
- Overrides:
compareTo in class AbstractObject
- Parameters:
arg - The comparable object with which this queue is compared.- Throws:
MethodNotImplemented - Always.