|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecteu.larkc.core.queue.Queue<E>
E
- The class of objects passed along the queue.public class Queue<E>
A blocking queue. Not as good as Queue1 (which uses one of Doug Lea's nifty queue classes), but this one does allow the putting of 'null' on the queue. Of course, this doesn't make much sense if the consumer is polling, but it's useful in the short term.
Constructor Summary | |
---|---|
Queue()
Constructor that initializes listeners. |
Method Summary | |
---|---|
void |
addListener(QueueListener<E> theQueueListener)
Adds a listener to the queue. |
void |
fireElementAdded(E e)
Informs all listener that a element was added. |
boolean |
isEmpty()
Answers the question if the queue is empty. |
E |
poll()
Returns the first element of the queue. |
void |
put(E item)
Puts one element to the queue. |
int |
size()
Returns the size of the queue. |
E |
take()
Returns one element of the queue and deletes it. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Queue()
Method Detail |
---|
public E take()
public void put(E item)
item
- The item to put in the queue.public int size()
public boolean isEmpty()
public E poll()
public void addListener(QueueListener<E> theQueueListener)
theQueueListener
- The listener to add.public void fireElementAdded(E e)
e
- The added element.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |