|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.datastructures.NodeQueue<E>
public class NodeQueue<E>
Realization of a queue by means of a singly-linked list of nodes. All operations are performed in constant time.
| Constructor Summary | |
|---|---|
NodeQueue()
Creates an empty queue. |
|
| Method Summary | |
|---|---|
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()
Return string equivalent of the queue |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public NodeQueue()
| Method Detail |
|---|
public int size()
size in interface Queue<E>public boolean isEmpty()
isEmpty in interface Queue<E>public void enqueue(E elem)
enqueue in interface Queue<E>element - new element to be inserted.
public E front()
throws EmptyQueueException
front in interface Queue<E>EmptyQueueException - if the queue is empty.
public E dequeue()
throws EmptyQueueException
dequeue in interface Queue<E>EmptyQueueException - if the queue is empty.public java.lang.String toString()
toString in class java.lang.Object
public static void status(Queue Q,
java.lang.String op,
java.lang.Object element)
op - operation performedelement - element returned by the operationpublic static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||