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,R extends Number> |
collectStats(rx.functions.Func1<T,R> function) |
static <T> rx.Observable.Transformer<T,MapWithIndex.Indexed<T>> |
mapWithIndex() |
static <T> rx.Observable.Transformer<T,T> |
orderedMergeWith(rx.Observable<T> other,
rx.functions.Func2<? super T,? super T,Integer> comparator)
Returns the source Observable merged with the
other
observable using the given Comparator for order. |
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,R extends Number> rx.Observable.Transformer<T,Pair<T,Statistics>> collectStats(rx.functions.Func1<T,R> function)
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.
State - the class representing the state of the state machineIn - the input observable typeOut - the output observable typeinitialState - 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()
public static final <T> rx.Observable.Transformer<T,T> orderedMergeWith(rx.Observable<T> other,
rx.functions.Func2<? super T,? super T,Integer> comparator)
other
observable using the given Comparator for order. A precondition
is that the source and other are already ordered. This transformer does
not support backpressure but its inputs must support backpressure. If you
need backpressure support then compose with
.onBackpressureXXX.T - the generic type of the objects being comparedother - the other already ordered observablecomparator - the ordering to useCopyright © 2013–2015. All rights reserved.