Class AbstractStateZipper<T,​S extends Enum>

    • Constructor Detail

      • AbstractStateZipper

        protected AbstractStateZipper​(S initialState)
    • Method Detail

      • zipWith

        protected abstract S zipWith​(Collection<S> states)
        The zip function to map from N states to one that represents the state of the zipper.
        Parameters:
        states - all subscribed states.
        Returns:
        the zipped state which represents the zipper state.
      • register

        public void register​(T identifier,
                             Stateful<S> upstream)
        Description copied from interface: StateZipper
        Register the given stream to be zipped into the state computation.
        Specified by:
        register in interface StateZipper<T,​S extends Enum>
        Parameters:
        identifier - the identifier used to uniquely identify the stream.
        upstream - the stateful compontent to be registered.
      • deregister

        public void deregister​(T identifier)
        Description copied from interface: StateZipper
        Deregisters a stream identified by the identifier from the state computation.
        Specified by:
        deregister in interface StateZipper<T,​S extends Enum>
        Parameters:
        identifier - the identifier used to uniquely identify the stream.
      • terminate

        public void terminate()
        Description copied from interface: StateZipper
        Terminate the zipper and deregister all registered streams.
        Specified by:
        terminate in interface StateZipper<T,​S extends Enum>
      • currentSubscriptions

        protected Map<T,​rx.Subscription> currentSubscriptions()
        Helper method to export the current internal subscriptions.
        Returns:
        the internally stored subscriptions.
      • currentStates

        protected Map<T,​S> currentStates()
        Helper method to export the current internal states. Should only be used for testing.
        Returns:
        the internally stored states.