front, rear; // reference to the front and rear of this deque
protected int numElements = 0; // number of elements in this deque
public DeQueDLL() {
front = null;
rear = null;
}
public void enqueueFront(T element) {
// TODO Auto-generated method stub
}
public void enqueueRear(T element) {
// TODO Auto-generated method stub
}
public T dequeueFront() throws QueueUnderflowException {
// TODO Auto-generated method stub
return null;
}
public T dequeueRear() throws QueueUnderflowException {
// TODO Auto-generated method stub
return null;
}
public boolean isFull() {
// TODO Auto-generated method stub
return false;
}
public boolean isEmpty() {
// TODO Auto-generated method stub
return false;
}
public int size() {
// TODO Auto-generated method stub
return 0;
}
}
import ch04.queues.QueueOverflowException;
import ch04.queues.QueueUnderflowException;
public interface DequeInterface
{
void enqueueFront(T element) throws QueueOverflowException;
// Throws QueueOverflowException if this queue is full;
// otherwise, adds element to the front of this queue.
void enqueueRear(T element) throws QueueOverflowException;
// Throws QueueOverflowException if this queue is full;
// otherwise, adds element to the rear of this queue.
T dequeueFront() throws QueueUnderflowException;
// Throws QueueUnderflowException if this queue is empty;
// otherwise, removes front element from this queue and returns it.
T dequeueRear() throws QueueUnderflowException;
// Throws QueueUnderflowException if this queue is empty;
// otherwise, removes rear element from this queue and returns it.
boolean isFull();
// Returns true if this queue is full; otherwise, returns false.
boolean isEmpty();
// Returns true if this queue is empty; otherwise, returns false.
int size();
// Returns the number of elements in this queue.
}