Top Description Inners Fields Constructors Methods
rx.internal.operators

public final Class OperatorZip<R>

extends Object
implements Observable.Operator<R, Observable<?>[]>
Class Inheritance
All Implemented Interfaces
rx.Observable.Operator, rx.functions.Func1, rx.functions.Function
Type Parameters
<R>
the result type
Imports
java.util.concurrent.atomic.AtomicLong, rx.*, .Observable.Operator, rx.exceptions.*, rx.functions.*, rx.internal.util.RxRingBuffer, rx.subscriptions.CompositeSubscription

Returns an Observable that emits the results of a function applied to sets of items emitted, in sequence, by two or more other Observables.

The zip operation applies this function in strict sequence, so the first item emitted by the new Observable will be the result of the function applied to the first item emitted by each zipped Observable; the second item emitted by the new Observable will be the result of the function applied to the second item emitted by each zipped Observable; and so forth.

The resulting Observable returned from zip will invoke onNext as many times as the number of onNext invocations of the source Observable that emits the fewest items.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class
pack-priv class

Field Summary

Modifier and TypeField and Description
pack-priv final FuncN<? extends R>

Constructor Summary

AccessConstructor and Description
public
OperatorZip(FuncN<? extends R> f)

public
OperatorZip(Func2<T1, T2, R> f)

public
OperatorZip(Func3<T1, T2, T3, R> f)

public
OperatorZip(Func4<T1, T2, T3, T4, R> f)

public
OperatorZip(Func5<T1, T2, T3, T4, T5, R> f)

public
OperatorZip(Func6<T1, T2, T3, T4, T5, T6, R> f)

public
OperatorZip(Func7<T1, T2, T3, T4, T5, T6, T7, R> f)

public
OperatorZip(Func8<T1, T2, T3, T4, T5, T6, T7, T8, R> f)

public
OperatorZip(Func9<T1, T2, T3, T4, T5, T6, T7, T8, T9, R> f)

Method Summary

Modifier and TypeMethod and Description
public Subscriber<? super Observable<T>[]>
call(final Subscriber<? super R> child)

Implements rx.functions.Func1.call.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

zipFunctionback to summary
pack-priv final FuncN<? extends R> zipFunction

Constructor Detail

OperatorZipback to summary
public OperatorZip(FuncN<? extends R> f)
OperatorZipback to summary
public OperatorZip(Func2<T1, T2, R> f)
Annotations
@SuppressWarnings:unchecked, rawtypes
OperatorZipback to summary
public OperatorZip(Func3<T1, T2, T3, R> f)
Annotations
@SuppressWarnings:unchecked, rawtypes
OperatorZipback to summary
public OperatorZip(Func4<T1, T2, T3, T4, R> f)
Annotations
@SuppressWarnings:unchecked, rawtypes
OperatorZipback to summary
public OperatorZip(Func5<T1, T2, T3, T4, T5, R> f)
Annotations
@SuppressWarnings:unchecked, rawtypes
OperatorZipback to summary
public OperatorZip(Func6<T1, T2, T3, T4, T5, T6, R> f)
Annotations
@SuppressWarnings:unchecked, rawtypes
OperatorZipback to summary
public OperatorZip(Func7<T1, T2, T3, T4, T5, T6, T7, R> f)
Annotations
@SuppressWarnings:unchecked, rawtypes
OperatorZipback to summary
public OperatorZip(Func8<T1, T2, T3, T4, T5, T6, T7, T8, R> f)
Annotations
@SuppressWarnings:unchecked, rawtypes
OperatorZipback to summary
public OperatorZip(Func9<T1, T2, T3, T4, T5, T6, T7, T8, T9, R> f)
Annotations
@SuppressWarnings:unchecked, rawtypes

Method Detail

callback to summary
public Subscriber<? super Observable<T>[]> call(final Subscriber<? super R> child)

Implements rx.functions.Func1.call.

Annotations
@SuppressWarnings:rawtypes
@Override
rx.internal.operators back to summary

pack-priv final Class OperatorZip.Zip<R>

extends AtomicLong
Class Inheritance

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
pack-priv final Observer<? super R>
private final CompositeSubscription
pack-priv int
private AtomicLong
private static final long
private volatile Object[]
pack-priv static final int
private final FuncN<? extends R>

Constructor Summary

AccessConstructor and Description
public
Zip(final Subscriber<? super R> child, FuncN<? extends R> zipFunction)

Method Summary

Modifier and TypeMethod and Description
public void
start(Observable<T>[] os, AtomicLong requested)

pack-priv void
tick()

check if we have values for each and emit if we do This will only allow one thread at a time to do the work, but ensures via `counter` increment/decrement that there is always once who acts on each `tick`.

Inherited from java.util.concurrent.atomic.AtomicLong:
accumulateAndGetaddAndGetcompareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetdecrementAndGetdoubleValuefloatValuegetgetAcquiregetAndAccumulategetAndAddgetAndDecrementgetAndIncrementgetAndSetgetAndUpdategetOpaquegetPlainincrementAndGetintValuelazySetlongValuesetsetOpaquesetPlainsetReleasetoStringupdateAndGetweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetReleaseweakCompareAndSetVolatile

Field Detail

childback to summary
pack-priv final Observer<? super R> child
childSubscriptionback to summary
private final CompositeSubscription childSubscription
emittedback to summary
pack-priv int emitted
requestedback to summary
private AtomicLong requested
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.concurrent.atomic.AtomicLong.serialVersionUID.

subscribersback to summary
private volatile Object[] subscribers
THRESHOLDback to summary
pack-priv static final int THRESHOLD
zipFunctionback to summary
private final FuncN<? extends R> zipFunction

Constructor Detail

Zipback to summary
public Zip(final Subscriber<? super R> child, FuncN<? extends R> zipFunction)

Method Detail

startback to summary
public void start(Observable<T>[] os, AtomicLong requested)
Annotations
@SuppressWarnings:unchecked
tickback to summary
pack-priv void tick()

check if we have values for each and emit if we do This will only allow one thread at a time to do the work, but ensures via `counter` increment/decrement that there is always once who acts on each `tick`. Same concept as used in OperationObserveOn.

Annotations
@SuppressWarnings:unchecked
rx.internal.operators back to summary

pack-priv final Class OperatorZip.Zip.InnerSubscriber

extends Subscriber
Class Inheritance
Annotations
@SuppressWarnings:rawtypes

Field Summary

Modifier and TypeField and Description
pack-priv final RxRingBuffer

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
onCompleted()

Implements rx.Observer.onCompleted.

Notifies the Observer that the Observable has finished sending push-based notifications.
public void
onError(Throwable
the exception encountered by the Observable
e
)

Implements rx.Observer.onError.

Notifies the Observer that the Observable has experienced an error condition.
public void
onNext(Object
the item emitted by the Observable
t
)

Implements rx.Observer.onNext.

Provides the Observer with a new item to observe.
public void
onStart()

Overrides rx.Subscriber.onStart.

This method is invoked when the Subscriber and Observable have been connected but the Observable has not yet begun to emit items or send notifications to the Subscriber.
public void
requestMore(long n)

Inherited from rx.Subscriber:
addisUnsubscribedrequestsetProducerunsubscribe

Field Detail

itemsback to summary
pack-priv final RxRingBuffer items

Constructor Detail

InnerSubscriberback to summary
pack-priv InnerSubscriber()

Method Detail

onCompletedback to summary
public void onCompleted()

Implements rx.Observer.onCompleted.

Doc from rx.Observer.onCompleted.

Notifies the Observer that the Observable has finished sending push-based notifications.

The Observable will not call this method if it calls onError.

Annotations
@Override
onErrorback to summary
public void onError(Throwable e)

Implements rx.Observer.onError.

Doc from rx.Observer.onError.

Notifies the Observer that the Observable has experienced an error condition.

If the Observable calls this method, it will not thereafter call onNext or onCompleted.

Parameters
e:Throwable

the exception encountered by the Observable

Annotations
@Override
onNextback to summary
public void onNext(Object t)

Implements rx.Observer.onNext.

Doc from rx.Observer.onNext.

Provides the Observer with a new item to observe.

The Observable may call this method 0 or more times.

The Observable will not call this method again after it calls either onCompleted or onError.

Parameters
t:Object

the item emitted by the Observable

Annotations
@Override
onStartback to summary
public void onStart()

Overrides rx.Subscriber.onStart.

Doc from rx.Subscriber.onStart.

This method is invoked when the Subscriber and Observable have been connected but the Observable has not yet begun to emit items or send notifications to the Subscriber. Override this method to add any useful initialization to your subscription, for instance to initiate backpressure.

Annotations
@Override
requestMoreback to summary
public void requestMore(long n)
rx.internal.operators back to summary

pack-priv final Class OperatorZip.ZipProducer<R>

extends AtomicLong
implements Producer
Class Inheritance
All Implemented Interfaces
rx.Producer

Field Summary

Modifier and TypeField and Description
private static final long
pack-priv final OperatorZip.Zip<R>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
request(long
the maximum number of items you want this Producer to produce, or Long.MAX_VALUE if you want the Producer to produce items at its own pace
n
)

Implements rx.Producer.request.

Request a certain maximum number of items from this Producer.
Inherited from java.util.concurrent.atomic.AtomicLong:
accumulateAndGetaddAndGetcompareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetdecrementAndGetdoubleValuefloatValuegetgetAcquiregetAndAccumulategetAndAddgetAndDecrementgetAndIncrementgetAndSetgetAndUpdategetOpaquegetPlainincrementAndGetintValuelazySetlongValuesetsetOpaquesetPlainsetReleasetoStringupdateAndGetweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetReleaseweakCompareAndSetVolatile

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.concurrent.atomic.AtomicLong.serialVersionUID.

zipperback to summary
pack-priv final OperatorZip.Zip<R> zipper

Constructor Detail

ZipProducerback to summary
public ZipProducer(OperatorZip.Zip<R> zipper)

Method Detail

requestback to summary
public void request(long n)

Implements rx.Producer.request.

Doc from rx.Producer.request.

Request a certain maximum number of items from this Producer. This is a way of requesting backpressure. To disable backpressure, pass Long.MAX_VALUE to this method.

Requests are additive but if a sequence of requests totals more than Long.MAX_VALUE then Long.MAX_VALUE requests will be actioned and the extras may be ignored. Arriving at Long.MAX_VALUE by addition of requests cannot be assumed to disable backpressure. For example, the code below may result in Long.MAX_VALUE requests being actioned only.

request(100);
request(Long.MAX_VALUE-1);
Parameters
n:long

the maximum number of items you want this Producer to produce, or Long.MAX_VALUE if you want the Producer to produce items at its own pace

Annotations
@Override
rx.internal.operators back to summary

pack-priv final Class OperatorZip.ZipSubscriber

extends Subscriber<Observable<T>[]>
Class Inheritance
Annotations
@SuppressWarnings:rawtypes

Field Summary

Modifier and TypeField and Description
pack-priv final Subscriber<? super R>
pack-priv final OperatorZip.ZipProducer<R>
pack-priv boolean
pack-priv final OperatorZip.Zip<R>

Constructor Summary

AccessConstructor and Description
public
ZipSubscriber(Subscriber<? super R> child, OperatorZip.Zip<R> zipper, OperatorZip.ZipProducer<R> producer)

Method Summary

Modifier and TypeMethod and Description
public void
onCompleted()

Implements rx.Observer.onCompleted.

Notifies the Observer that the Observable has finished sending push-based notifications.
public void
onError(Throwable
the exception encountered by the Observable
e
)

Implements rx.Observer.onError.

Notifies the Observer that the Observable has experienced an error condition.
public void
onNext(Observable<T>[]
the item emitted by the Observable
observables
)

Implements rx.Observer.onNext.

Provides the Observer with a new item to observe.
Inherited from rx.Subscriber:
addisUnsubscribedonStartrequestsetProducerunsubscribe

Field Detail

childback to summary
pack-priv final Subscriber<? super R> child
producerback to summary
pack-priv final OperatorZip.ZipProducer<R> producer

Hides rx.Subscriber.producer.

startedback to summary
pack-priv boolean started
zipperback to summary
pack-priv final OperatorZip.Zip<R> zipper

Constructor Detail

ZipSubscriberback to summary
public ZipSubscriber(Subscriber<? super R> child, OperatorZip.Zip<R> zipper, OperatorZip.ZipProducer<R> producer)

Method Detail

onCompletedback to summary
public void onCompleted()

Implements rx.Observer.onCompleted.

Doc from rx.Observer.onCompleted.

Notifies the Observer that the Observable has finished sending push-based notifications.

The Observable will not call this method if it calls onError.

Annotations
@Override
onErrorback to summary
public void onError(Throwable e)

Implements rx.Observer.onError.

Doc from rx.Observer.onError.

Notifies the Observer that the Observable has experienced an error condition.

If the Observable calls this method, it will not thereafter call onNext or onCompleted.

Parameters
e:Throwable

the exception encountered by the Observable

Annotations
@Override
onNextback to summary
public void onNext(Observable<T>[] observables)

Implements rx.Observer.onNext.

Doc from rx.Observer.onNext.

Provides the Observer with a new item to observe.

The Observable may call this method 0 or more times.

The Observable will not call this method again after it calls either onCompleted or onError.

Parameters
observables:Observable<T>[]

the item emitted by the Observable

Annotations
@Override