Eidola home

org.eidola.kernel.event
Class EventQueue

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--org.eidola.kernel.event.EventQueue
All Implemented Interfaces:
Runnable

public class EventQueue
extends Thread
implements Runnable

A queue dispatches Events to EventListeners. Typically, a single queue is associated with a listener or a collection of listeners with a single purpose -- i.e. compiling elements or updating a view.

There are two common ways of running an event queue:

Version:
[Development version]
Author:
Paul Cantrell
See Also:
Event, EventBroadcaster, EventListener

Field Summary
static boolean debug
           
 String name
          For debugging.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
EventQueue(String name)
          Constructs a new empty queue.
 
Method Summary
 void addEvent(Event event, EventListener target)
          Adds an event to the queue.
 boolean isEmpty()
          Determines whether this queue is empty.
 void run()
          Consumes and handles events from this queue.
 String toString()
          For debugging -- returns this queue's name.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

public String name
For debugging.

debug

public static boolean debug
Constructor Detail

EventQueue

public EventQueue(String name)
Constructs a new empty queue.
Parameters:
name - For debugging.
Method Detail

toString

public String toString()
For debugging -- returns this queue's name.
Overrides:
toString in class Thread

isEmpty

public boolean isEmpty()
Determines whether this queue is empty.

addEvent

public void addEvent(Event event,
                     EventListener target)
Adds an event to the queue. Typically, you will not call this directly; that's really the job of EventBroadcaster.broadcastEvent(Event).

run

public void run()
Consumes and handles events from this queue. Typically, you will not call this method directly, but rather call Thread.start().
Specified by:
run in interface Runnable
Overrides:
run in class Thread

Eidola home