brf.j2me.dynaworks.env
Class EventQueue

java.lang.Object
  |
  +--brf.j2me.dynaworks.env.EventQueue

public final class EventQueue
extends java.lang.Object

The EventQueue represents a FIFO stack of events.

An Event is appended to the EventQueue via the 'push()' method. It is appended at the end of the queue and is processed after all previous events have been handled.

The next event from the EventQueue is retreived with the 'pop()' method. The boolean argument to the method decides whether the method should block until there is an Event available.

When an application registers with the Environment, it passes its EventQueue object to the environment. There the implementation dependend event sources (system event loop) are linked to that EventQueue. That ensures that all system and user interaction events are passed to the EventQueue and can be processed by the application.

Version:
1.0
Author:
Bernd R. Fix
See Also:
Application, Event, Environment

Field Summary
private  java.util.Vector queue
          vector holding the events.
private  java.lang.Object semaphore
          semaphore for 'wait for event'.
 
Constructor Summary
EventQueue()
          constructor.
 
Method Summary
 Event pop(boolean wait)
          push an event onto the event stack (queue = fifo stack).
 boolean push(Event e)
          push an event onto the event stack (queue = fifo stack).
 void reset()
          reset the EventQueue.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

queue

private java.util.Vector queue
vector holding the events.


semaphore

private java.lang.Object semaphore
semaphore for 'wait for event'.

Constructor Detail

EventQueue

public EventQueue()
constructor.

Method Detail

push

public boolean push(Event e)
push an event onto the event stack (queue = fifo stack).


pop

public Event pop(boolean wait)
push an event onto the event stack (queue = fifo stack).


reset

public void reset()
reset the EventQueue.