## org.w3c.tools.timers
Class EventManager

    java.lang.Object
      |
      +--java.lang.Thread
            |
            +--org.w3c.tools.timers.EventManager

public class EventManager
extends java.lang.Thread
implements EventHandler

This implements an event manager for timer events. Timer events are a way to have events occur some time in the future. They are an alternative to using separate threads which issue sleep requests themselves.

Fields inherited from class java.lang.Thread
`MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

Constructor Summary
`EventManager()`

Method Summary
`void` | `handleTimerEvent(java.lang.Object rock, long time)`
`static void` | `main(java.lang.String[] args)`
`java.lang.Object` | `recallTimer(java.lang.Object timer)` This recalls a previously registered timer event.
`java.lang.Object` | `registerTimer(org.w3c.tools.timers.Event newEvent)` This is like the above registerTimer, except it takes an event object with the deliver time filled in.
`java.lang.Object` | `registerTimer(long ms, EventHandler handler, java.lang.Object data)` registerTimer inserts a new timer event into the queue.
`void` | `run()`
`void` | `stopEventManager()`

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, toString, yield`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### EventManager

    public EventManager()

Method Detail

### registerTimer

    public java.lang.Object registerTimer(long ms,
                                          EventHandler handler,
                                          java.lang.Object data)

  registerTimer inserts a new timer event into the queue. The queue is always sorted by time, in increasing order. That is, things farther into the future are further down in the queue. ms is milliseconds in the future, handler is the object that will handle the event, and data is a "rock" that is passed to the handler to do with what it will. This returns an opaque object which can be used to recall the timer before it is delivered.

### stopEventManager

    public void stopEventManager()

### registerTimer

    public java.lang.Object registerTimer(org.w3c.tools.timers.Event newEvent)

  This is like the above registerTimer, except it takes an event object with the deliver time filled in. If deliver time is before the current time, the event is "immediately" delivered. Do a binary search to figure out where the event goes.

### recallTimer

    public java.lang.Object recallTimer(java.lang.Object timer)

  This recalls a previously registered timer event.

### run

    public void run()

  Overrides:
    run in class java.lang.Thread

### handleTimerEvent

    public void handleTimerEvent(java.lang.Object rock,
                                 long time)

  Specified by:
    handleTimerEvent in interface EventHandler

### main

    public static void main(java.lang.String[] args)