Opus5
Class DequeAsArray
java.lang.Object
|
+--Opus5.AbstractObject
|
+--Opus5.AbstractContainer
|
+--Opus5.QueueAsArray
|
+--Opus5.DequeAsArray
- All Implemented Interfaces:
- Comparable, Container, Deque, Queue
- public class DequeAsArray
- extends QueueAsArray
- implements Deque
A deque (double-ended queue) implemented using an array.
- Version:
- $Id: DequeAsArray.java,v 3.1 1998/07/28 01:32:17 brpreiss Exp $
- Author:
- Bruno R. Preiss, P.Eng.
|
Constructor Summary |
DequeAsArray(int size)
Constructs a Deque with the specified array length. |
|
Method Summary |
java.lang.Object |
dequeueHead()
Dequeues and returns the object at the head of this queue. |
java.lang.Object |
dequeueTail()
Dequeues and returns the object at the tail of this queue. |
void |
enqueueHead(java.lang.Object object)
Enqueues the specified object at the head of this queue. |
void |
enqueueTail(java.lang.Object object)
Enqueues the specified object at the tail of this queue. |
java.lang.Object |
getTail()
Returns the object at the tail of this deque. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
DequeAsArray
public DequeAsArray(int size)
- Constructs a
Deque with the specified array length.
- Parameters:
size - The desired array length.
enqueueHead
public void enqueueHead(java.lang.Object object)
- Enqueues the specified object at the head of this queue.
- Specified by:
enqueueHead in interface Deque
- Parameters:
object - The object to be enqueued.- Throws:
ContainerFullException - If this deque is full.
dequeueHead
public java.lang.Object dequeueHead()
- Dequeues and returns the object at the head of this queue.
- Specified by:
dequeueHead in interface Deque
- Returns:
- The object at the head of this queue.
- Throws:
ContainerEmptyException - If this deque is empty.
getTail
public java.lang.Object getTail()
- Returns the object at the tail of this deque.
- Specified by:
getTail in interface Deque
- Returns:
- the object at the tail of this deque.
- Throws:
ContainerEmptyException - If this deque is empty.
enqueueTail
public void enqueueTail(java.lang.Object object)
- Enqueues the specified object at the tail of this queue.
- Specified by:
enqueueTail in interface Deque
- Parameters:
object - The object to be enqueued.- Throws:
ContainerFullException - If this deque is full.
dequeueTail
public java.lang.Object dequeueTail()
- Dequeues and returns the object at the tail of this queue.
- Specified by:
dequeueTail in interface Deque
- Returns:
- The object at the tail of this queue.
- Throws:
ContainerEmptyException - If this deque is empty.