public abstract class AbstractStateZipper<T,S extends Enum> extends AbstractStateMachine<S> implements StateZipper<T,S>
The default implementation of a StateZipper.
The implementing class only needs to provide the zip function, as well as a initial state that is always used when no source stream is registered.
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractStateZipper(S initialState) |
| Modifier and Type | Method and Description |
|---|---|
protected Map<T,S> |
currentStates()
Helper method to export the current internal states.
|
protected Map<T,Subscription> |
currentSubscriptions()
Helper method to export the current internal subscriptions.
|
void |
deregister(T identifier)
Deregisters a stream identified by the identifier from the state computation.
|
void |
register(T identifier,
Stateful<S> upstream)
Register the given stream to be zipped into the state computation.
|
void |
terminate()
Terminate the zipper and deregister all registered streams.
|
protected abstract S |
zipWith(Collection<S> states)
The zip function to map from N states to one that represents the state of the zipper.
|
hasSubscribers, isState, state, states, transitionStateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithasSubscribers, isState, state, statesprotected AbstractStateZipper(S initialState)
protected abstract S zipWith(Collection<S> states)
The zip function to map from N states to one that represents the state of the zipper.
states - all subscribed states.public void register(T identifier, Stateful<S> upstream)
StateZipperRegister the given stream to be zipped into the state computation.
register in interface StateZipper<T,S extends Enum>identifier - the identifier used to uniquely identify the stream.upstream - the stateful compontent to be registered.public void deregister(T identifier)
StateZipperDeregisters a stream identified by the identifier from the state computation.
deregister in interface StateZipper<T,S extends Enum>identifier - the identifier used to uniquely identify the stream.public void terminate()
StateZipperTerminate the zipper and deregister all registered streams.
terminate in interface StateZipper<T,S extends Enum>protected Map<T,Subscription> currentSubscriptions()
Helper method to export the current internal subscriptions.
Copyright © 2016 Couchbase, Inc.. All rights reserved.