|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--SLQueue
SLQueue is an implementation of Queue, a repository for Objects. Objects are inserted using enqueue and removed using dequeue. Objects are removed in the same order in which they are inserted. A singly-linked list is used to maintain the Queue.
| Nested Class Summary | |
(package private) class |
SLQueue.Cell
A Cell stores one Object in the Queue and points to the next newer Object if any. |
| Field Summary | |
protected SLQueue.Cell |
head
the Cell containing the next Object to be removed |
protected SLQueue.Cell |
tail
the Cell containing the most recent Object inserted |
| Constructor Summary | |
SLQueue()
Construct an empty SLQueue. |
|
| Method Summary | |
java.lang.Object |
dequeue()
Remove an Object from the queue. |
void |
enqueue(java.lang.Object item)
Insert an Object in the queue. |
boolean |
isEmpty()
Indicate whether or not the Queue is empty |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected SLQueue.Cell head
protected SLQueue.Cell tail
| Constructor Detail |
public SLQueue()
| Method Detail |
public void enqueue(java.lang.Object item)
enqueue in interface Queueitem - the Object to be inserted
public java.lang.Object dequeue()
throws EmptyQueueException
dequeue in interface QueueEmptyQueueException - if the Queue is emptypublic boolean isEmpty()
isEmpty in interface Queue
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||