public final class Transformers extends Object
| Constructor and Description |
|---|
Transformers() |
| Modifier and Type | Method and Description |
|---|---|
static <T> rx.Observable.Transformer<T,T> |
bufferEmissions() |
static <T> rx.Observable.Transformer<T,T> |
bufferEmissions(rx.Scheduler scheduler) |
static <T extends Number> |
collectStats() |
static <T> rx.Observable.Transformer<T,MapWithIndex.Indexed<T>> |
mapWithIndex() |
static <T extends Comparable<T>> |
sort() |
static <T extends Comparable<T>> |
sort(Comparator<T> comparator) |
static <State,In,Out> |
stateMachine(rx.functions.Func0<State> initialState,
rx.functions.Func3<State,In,rx.Observer<Out>,State> transition,
rx.functions.Action2<State,rx.Observer<Out>> completionAction)
Returns a
Observable.Transformer that allows processing of the source stream
to be defined in a state machine where transitions of the state machine
may also emit items to downstream that are buffered if necessary when
backpressure is requested. |
static <State,In,Out> |
stateMachine(State initialState,
rx.functions.Func3<State,In,rx.Observer<Out>,State> transition) |
static <State,In,Out> |
stateMachine(State initialState,
rx.functions.Func3<State,In,rx.Observer<Out>,State> transition,
rx.functions.Action2<State,rx.Observer<Out>> completionAction) |
static <T,R> rx.Observable.Operator<R,T> |
toOperator(rx.functions.Func1<rx.Observable<T>,rx.Observable<R>> function) |
static <T> rx.Observable.Transformer<T,Set<T>> |
toSet() |
public static <T,R> rx.Observable.Operator<R,T> toOperator(rx.functions.Func1<rx.Observable<T>,rx.Observable<R>> function)
public static <T extends Number> rx.Observable.Transformer<T,Statistics> collectStats()
public static <T extends Comparable<T>> rx.Observable.Transformer<T,T> sort()
public static <T extends Comparable<T>> rx.Observable.Transformer<T,T> sort(Comparator<T> comparator)
public static <T> rx.Observable.Transformer<T,Set<T>> toSet()
public static <T> rx.Observable.Transformer<T,MapWithIndex.Indexed<T>> mapWithIndex()
public static <T> rx.Observable.Transformer<T,T> bufferEmissions(rx.Scheduler scheduler)
public static <State,In,Out> rx.Observable.Transformer<In,Out> stateMachine(rx.functions.Func0<State> initialState,
rx.functions.Func3<State,In,rx.Observer<Out>,State> transition,
rx.functions.Action2<State,rx.Observer<Out>> completionAction)
Observable.Transformer that allows processing of the source stream
to be defined in a state machine where transitions of the state machine
may also emit items to downstream that are buffered if necessary when
backpressure is requested. flatMap is part of the processing
chain so the source may experience requests for more items than are
strictly required by the endpoint subscriber.
Internally this transformer uses Observable.scan(rx.functions.Func2<T, T, T>) emitting a
stream of new states composed with emissions from the transition to each
state and Observable.flatMap(rx.functions.Func1<? super T, ? extends rx.Observable<? extends R>>) to emit the recorded emissions with
backpressure.
initialState - the initial state of the state machinetransition - defines state transitions and consequent emissions to
downstream when an item arrives from upstreamcompletionAction - defines activity that should happen based on the final state
just before downstream onCompleted() is called.
For example any buffered emissions in state could be emitted
at this point. Don't call observer.onCompleted()
as it is called for you after the action completes. .public static <State,In,Out> rx.Observable.Transformer<In,Out> stateMachine(State initialState,
rx.functions.Func3<State,In,rx.Observer<Out>,State> transition,
rx.functions.Action2<State,rx.Observer<Out>> completionAction)
public static <State,In,Out> rx.Observable.Transformer<In,Out> stateMachine(State initialState,
rx.functions.Func3<State,In,rx.Observer<Out>,State> transition)
public static <T> rx.Observable.Transformer<T,T> bufferEmissions()
Copyright © 2013–2015. All rights reserved.