| Constructor and Description |
|---|
NodeQueue()
Creates an empty queue.
|
| Modifier and Type | Method and Description |
|---|---|
E |
dequeue()
Removes the element at the front of the queue.
|
void |
enqueue(E elem)
Inserts an element at the rear of the queue.
|
E |
front()
Inspects the element at the front of the queue.
|
boolean |
isEmpty()
Returns whether the queue is empty.
|
static void |
main(java.lang.String[] args)
Test program that performs a series of operations on on a queue and
prints the operation performed, the returned element and the
content of the stack after each operation.
|
int |
size()
Returns the number of elements in the queue.
|
static void |
status(Queue Q,
java.lang.String op,
java.lang.Object element)
Prints information about an operation and the queue.
|
java.lang.String |
toString() |
public E dequeue() throws EmptyQueueException
Queuedequeue in interface Queue<E>EmptyQueueException - if the queue is empty.public void enqueue(E elem)
Queuepublic E front() throws EmptyQueueException
Queuefront in interface Queue<E>EmptyQueueException - if the queue is empty.public boolean isEmpty()
Queuepublic static void main(java.lang.String[] args)
public int size()
Queuepublic static void status(Queue Q, java.lang.String op, java.lang.Object element)
op - operation performedelement - element returned by the operationpublic java.lang.String toString()
toString in class java.lang.Object