|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.jaetzold.util.Queue
A class for passing Objects from one Thread to another. The Threads have to
take care for themselves that the Objects passed are from the correct type.
Usually there is only one thread on the reading end, which retrieves the posted Objects
by calling getNext()
. However there can be more than one Thread
calling getNext()
but then, each object will always be returned
only to one of them.
Constructor Summary | |
Queue()
|
Method Summary | |
boolean |
contains(Object object)
|
Object |
getNext()
Returns and deletes the next object in the queue. |
Object |
getNext(int timeout)
Returns and deletes the next event in the queue if there is any before the specified timeout. |
Object |
getNextEqual(Object object)
|
Object |
getNextEqual(Object object,
int timeout)
|
boolean |
hasMoreElements()
|
boolean |
isEmpty()
Tells whether there are any objects in the queue. |
Object |
nextElement()
|
Object |
peekNext()
Return but not delete. |
Object |
peekNext(int timeout)
Return but not delete. |
void |
post(Object object)
Adds the given object to the end of the queue. |
boolean |
remove(Object object)
Removes the first occurence of an element equal to the given object from this queue if there is any. |
int |
removeAll(Object object)
Removes the all elements equal to the given object from this queue. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Queue()
Method Detail |
public boolean isEmpty()
getNext()
does not
block if both calls are in the same block, synchronized to this queue.getNext()
public boolean hasMoreElements()
hasMoreElements
in interface Enumeration
public Object nextElement()
nextElement
in interface Enumeration
public Object peekNext() throws InterruptedException
public Object peekNext(int timeout) throws InterruptedException
public Object getNext() throws InterruptedException
post(java.lang.Object)
.post(java.lang.Object)
,
getNext(int)
public Object getNext(int timeout) throws InterruptedException
post(de.jaetzold.util.Event)
or
until after timeout
milliseconds have elapsed. In this case
it is possible that this method returns null
.post(Object)
,
getNext()
public void post(Object object)
public boolean remove(Object object)
object.equals()
to
determine equality.
Implementation note: It relies on the underlying List to do it that way.public int removeAll(Object object)
object.equals()
to determine equality.
Implementation note: It relies on the underlying List to do it that way.public boolean contains(Object object)
public Object getNextEqual(Object object) throws InterruptedException
public Object getNextEqual(Object object, int timeout) throws InterruptedException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |