Class ScanningEventBus<E,​S,​C>

  • All Implemented Interfaces:
    EventBus<E,​S,​C>

    public abstract class ScanningEventBus<E,​S,​C>
    extends java.lang.Object
    implements EventBus<E,​S,​C>
    Provides a total ordering of Classifiers (think java.util.Comparator.compare)
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract int compareClassifiers​(C a, C b)
      Provides a total ordering of Classifiers (think java.util.Comparator.compare)
      protected abstract int compareSubscribers​(S a, S b)
      Provides a total ordering of Subscribers (think java.util.Comparator.compare)
      protected abstract boolean matches​(C classifier, E event)
      Returns whether the specified Classifier matches the specified Event
      void publish​(E event)
      Publishes the specified Event to this bus
      protected abstract void publish​(E event, S subscriber)
      Publishes the specified Event to the specified Subscriber
      boolean subscribe​(S subscriber, C to)
      Attempts to register the subscriber to the specified Classifier
      void unsubscribe​(S subscriber)
      Attempts to deregister the subscriber from all Classifiers it may be subscribed to
      boolean unsubscribe​(S subscriber, C from)
      Attempts to deregister the subscriber from the specified Classifier
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ScanningEventBus

        public ScanningEventBus()
    • Method Detail

      • compareClassifiers

        protected abstract int compareClassifiers​(C a,
                                                  C b)
        Provides a total ordering of Classifiers (think java.util.Comparator.compare)
        Parameters:
        a - (undocumented)
        b - (undocumented)
        Returns:
        (undocumented)
      • compareSubscribers

        protected abstract int compareSubscribers​(S a,
                                                  S b)
        Provides a total ordering of Subscribers (think java.util.Comparator.compare)
        Parameters:
        a - (undocumented)
        b - (undocumented)
        Returns:
        (undocumented)
      • matches

        protected abstract boolean matches​(C classifier,
                                           E event)
        Returns whether the specified Classifier matches the specified Event
        Parameters:
        classifier - (undocumented)
        event - (undocumented)
        Returns:
        (undocumented)
      • publish

        protected abstract void publish​(E event,
                                        S subscriber)
        Publishes the specified Event to the specified Subscriber
        Parameters:
        event - (undocumented)
        subscriber - (undocumented)
      • publish

        public void publish​(E event)
        Description copied from interface: EventBus
        Publishes the specified Event to this bus
        Specified by:
        publish in interface EventBus<E,​S,​C>
        Parameters:
        event - (undocumented)
      • subscribe

        public boolean subscribe​(S subscriber,
                                 C to)
        Description copied from interface: EventBus
        Attempts to register the subscriber to the specified Classifier
        Specified by:
        subscribe in interface EventBus<E,​S,​C>
        Parameters:
        subscriber - (undocumented)
        to - (undocumented)
        Returns:
        true if successful and false if not (because it was already subscribed to that Classifier, or otherwise)
      • unsubscribe

        public boolean unsubscribe​(S subscriber,
                                   C from)
        Description copied from interface: EventBus
        Attempts to deregister the subscriber from the specified Classifier
        Specified by:
        unsubscribe in interface EventBus<E,​S,​C>
        Parameters:
        subscriber - (undocumented)
        from - (undocumented)
        Returns:
        true if successful and false if not (because it wasn't subscribed to that Classifier, or otherwise)
      • unsubscribe

        public void unsubscribe​(S subscriber)
        Description copied from interface: EventBus
        Attempts to deregister the subscriber from all Classifiers it may be subscribed to
        Specified by:
        unsubscribe in interface EventBus<E,​S,​C>
        Parameters:
        subscriber - (undocumented)