|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Specifications for a queue, the semi-formal notation for specifications appears on the notation page.
A queue, Q, is
|
| 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. |
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. |
| Method Detail |
public boolean isEmpty()
|
Q'=Q Return Q==() |
public java.lang.Object frontOf()
|
Q!=() Q'=Q Return a0 |
Assertion - When queue is emptypublic void enqueue(java.lang.Object item)
| Q'=(Q, obj) |
item - The new rear of the queuepublic java.lang.Object dequeue()
|
Q!=() Q = (a0, Q') Return: a0 |
Assertion - When queue is emptypublic java.lang.String toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||