Interface EventDispatcher<T>

Type Parameters:
T - - the event type

public interface EventDispatcher<T>
Manages EventSubscribers for a single event type.
  • Method Details

    • register

      boolean register(EventSubscriber<T> subscriber)
      Registers an EventSubscriber.
      Parameters:
      subscriber - - subscriber to register
      Returns:
      true if this dispatcher did not already contain the specified subscriber
    • unregister

      boolean unregister(EventSubscriber<T> subscriber)
      Unregisters an EventSubscriber.
      Parameters:
      subscriber - - subscriber to unregister
      Returns:
      true if this dispatcher contained the specified subscriber
    • hasSubscribers

      boolean hasSubscribers()
      Returns:
      true if this dispatcher contains no subscribers
    • dispatch

      boolean dispatch(T event)
      Dispatches the specified event to all subscribers contained within this dispatcher.
      Parameters:
      event - - event to dispatch
      Returns:
      true if subscribers were removed as a result of the dispatch