| Modifier and Type | Field and Description |
|---|---|
protected Node<E> |
head |
protected int |
size |
protected Node<E> |
tail |
| 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 element)
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.
|
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 int size()
Queuepublic boolean isEmpty()
Queuepublic void enqueue(E element)
Queuepublic E front() throws EmptyQueueException
Queuefront in interface Queue<E>EmptyQueueException - if the queue is empty.public E dequeue() throws EmptyQueueException
Queuedequeue in interface Queue<E>EmptyQueueException - if the queue is empty.public java.lang.String toString()
toString in class java.lang.Objectpublic static void status(Queue Q, java.lang.String op, java.lang.Object element)
op - operation performedelement - element returned by the operation