|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectscranton.queue.QueueViaLinear1Circ
Implements the Queue interface via composition of the Linear1 class, which is used to represent the array as a circularly linked structure.
| Field Summary | |
protected Linear1 |
actual
Reference (possibly null) to the circularly recursively referenced structure that holds the queue's objects. |
| Constructor Summary | |
QueueViaLinear1Circ()
Constructs and empty queue |
|
| Method Summary | |
java.lang.Object |
dequeue()
Decrease the size of the queue by one by removing and returning reference to the object that was at the front of the queue. |
void |
enqueue(java.lang.Object item)
Increase the size of the queue by one by placing item as the rear of the queue. |
Queue |
factory()
|
java.lang.Object |
frontOf()
Queue does not change, returns the reference to the front object in the queue. |
boolean |
isEmpty()
Queue does not change, returns true iff the queue is empty. |
java.lang.String |
toString()
Returns a string representation of the queue. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected Linear1 actual
| Constructor Detail |
public QueueViaLinear1Circ()
| Method Detail |
public boolean isEmpty()
Queue
|
Q'=Q Return Q==() |
isEmpty in interface QueueQueue.isEmpty()public java.lang.Object frontOf()
Queue
|
Q!=() Q'=Q Return a0 |
frontOf in interface QueueQueue.frontOf()public void enqueue(java.lang.Object item)
Queue
| Q'=(Q, obj) |
enqueue in interface Queueitem - The new rear of the queueQueue.enqueue(java.lang.Object)public java.lang.Object dequeue()
Queue
|
Q!=() Q = (a0, Q') Return: a0 |
dequeue in interface QueueQueue.dequeue()public Queue factory()
public java.lang.String toString()
Queue
toString in interface Queue
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||