Пример #1
0
  /**
   * Method used to post new events and send them to the listeners
   *
   * @param e event object
   */
  public void postEvent(Event e) {
    int etype = e.getType();
    if (etype < 100) LOG.info("" + event_t.get(etype).toString());
    else if (etype < 1000) LOG.info("   - " + event_t.get(etype).toString());
    else LOG.info("      >> " + event_t.get(etype).toString());

    List<EventPoolListener> auxl = _registeredListeners.get(e.getType());
    if (auxl != null) {
      for (EventPoolListener l : auxl) {
        l.onEvent(e.getType(), e);
      }
    }
  }
Пример #2
0
 /**
  * Method used to post new events and send them to the listeners, but using a customized timestamp
  *
  * @param e event object
  * @param timestamp customized timestamp
  */
 public void postEvent(Event e, long timestamp) {
   // modify timestamp
   if (timestamp >= 0) {
     e.setTimestamp(timestamp);
   }
   // post event
   postEvent(e);
 }