Interface Subject<T>

  • Type Parameters:
    T - The type that is stored within the subject that is sent to all the registered observers whenever it is updated.
    All Known Implementing Classes:
    StationCollider

    public interface Subject<T>
    A Subject contains a list of registered observers which all receive the same value of type T whenever it is updated.
    • Method Detail

      • register

        void register​(Observer<T> observer)
        Add an observer which will be notified with every new T
        Parameters:
        observer - the observer to register to this subject
      • deregister

        void deregister​(Observer<T> observer)
        Stop an observer from receiving future updates from this subject
        Parameters:
        observer - the observer to deregister from this subject
      • clearAllObservers

        void clearAllObservers()
      • notifyObservers

        void notifyObservers​(T update)
        Parameters:
        update - The new T to send to every registered observer
      • getLastNotification

        T getLastNotification()
        Returns:
        the most recent value that was sent to the observers.