|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.jaetzold.util.EventQueue
A class for passing events from one Thread to another.
Usually there is only one thread on one end, which retrieves the posted events
by calling getNextEvent()
. However there can be more than one Thread
calling getNextEvent()
but then, each event will always be returned
only to one of them.
Constructor Summary | |
EventQueue()
|
Method Summary | |
boolean |
contains(Event event)
|
Event |
getNextEvent()
Returns and deletes the next event in the queue. |
Event |
getNextEvent(int timeout)
Returns and deletes the next event in the queue if there is any before the specified timeout. |
Event |
getNextEventEqual(Event event,
int timeout)
|
boolean |
isEmpty()
Tells whether there are any events in the queue. |
Event |
peekNextEvent(int timeout)
Return but not delete. |
void |
post(Event theEvent)
Adds the given event-object to the end of the queue. |
boolean |
remove(Event theEvent)
Removes the first occurence of an element equal to the given Event from this queue if there is any. |
int |
removeAll(Event theEvent)
Removes the all elements equal to the given Event from this queue. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EventQueue()
Method Detail |
public boolean isEmpty()
getNextEvent()
does not block
if both calls are in the same block, synchronized to this queue.
#see #getNextEvent()public Event peekNextEvent(int timeout) throws InterruptedException
public Event getNextEvent() throws InterruptedException
post(de.jaetzold.util.Event)
.post(de.jaetzold.util.Event)
,
getNextEvent(int)
public Event getNextEvent(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(de.jaetzold.util.Event)
,
getNextEvent()
public void post(Event theEvent)
public boolean remove(Event theEvent)
theEvent.equals()
to
determine equality.
Implementation note: It relies on the underlying List to do it that way.public int removeAll(Event theEvent)
theEvent.equals()
to determine equality.
Implementation note: It relies on the underlying List to do it that way.public boolean contains(Event event)
public Event getNextEventEqual(Event event, int timeout)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |