Top Description Inners Fields Constructors Methods
rx.internal.operators

public final Class OperatorSwitch<T>

extends Object
implements Observable.Operator<T, Observable<? extends T>>
Class Inheritance
All Implemented Interfaces
rx.Observable.Operator, rx.functions.Func1, rx.functions.Function
Type Parameters
<T>
the value type
Imports
java.util.*, java.util.concurrent.atomic.AtomicLong, rx.*, .Observable, .Observable.Operator, rx.exceptions.CompositeException, rx.functions.Action0, rx.internal.util.RxRingBuffer, rx.internal.util.atomic.SpscLinkedArrayQueue, rx.plugins.RxJavaHooks, rx.subscriptions.*

Transforms an Observable that emits Observables into a single Observable that emits the items emitted by the most recently published of those Observables.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
OperatorSwitch.Holder

Lazy initialization via inner-class holder.

pack-priv static class
OperatorSwitch.HolderDelayError

Lazy initialization via inner-class holder.

pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv final boolean

Constructor Summary

AccessConstructor and Description
pack-priv
OperatorSwitch(boolean delayError)

Method Summary

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

Implements rx.functions.Func1.call.

public static <
the value type
T
>
OperatorSwitch<T>

Returns:

a singleton instance of this stateless operator.
instance
(boolean
should the errors of the inner sources delayed until the main sequence completes?
delayError
)

Returns a singleton instance of the operator based on the delayError parameter.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delayErrorback to summary
pack-priv final boolean delayError

Constructor Detail

OperatorSwitchback to summary
pack-priv OperatorSwitch(boolean delayError)

Method Detail

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

Implements rx.functions.Func1.call.

Annotations
@Override
instanceback to summary
public static <T> OperatorSwitch<T> instance(boolean delayError)

Returns a singleton instance of the operator based on the delayError parameter.

Parameters
<T>
the value type
delayError:boolean

should the errors of the inner sources delayed until the main sequence completes?

Returns:OperatorSwitch<T>

a singleton instance of this stateless operator.

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

pack-priv final Class OperatorSwitch.Holder

extends Object
Class Inheritance

Lazy initialization via inner-class holder.

Field Summary

Modifier and TypeField and Description
pack-priv static final OperatorSwitch<Object>
INSTANCE

A singleton instance.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
pack-priv static final OperatorSwitch<Object> INSTANCE

A singleton instance.

Constructor Detail

Holderback to summary
pack-priv Holder()
rx.internal.operators back to summary

pack-priv final Class OperatorSwitch.HolderDelayError

extends Object
Class Inheritance

Lazy initialization via inner-class holder.

Field Summary

Modifier and TypeField and Description
pack-priv static final OperatorSwitch<Object>
INSTANCE

A singleton instance.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
pack-priv static final OperatorSwitch<Object> INSTANCE

A singleton instance.

Constructor Detail

HolderDelayErrorback to summary
pack-priv HolderDelayError()
rx.internal.operators back to summary

pack-priv final Class OperatorSwitch.InnerSubscriber<T>

extends Subscriber<T>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final long
private final OperatorSwitch.SwitchSubscriber<T>

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(T
the item emitted by the Observable
t
)

Implements rx.Observer.onNext.

Provides the Observer with a new item to observe.
public void
setProducer(Producer
producer to be used by this subscriber or the other subscriber (or recursively its other subscriber) to make requests from
p
)

Overrides rx.Subscriber.setProducer.

If other subscriber is set (by calling constructor Subscriber(Subscriber) or Subscriber(Subscriber, boolean)) then this method calls setProducer on the other subscriber.
Inherited from rx.Subscriber:
addisUnsubscribedonStartrequestunsubscribe

Field Detail

idback to summary
private final long id
parentback to summary
private final OperatorSwitch.SwitchSubscriber<T> parent

Constructor Detail

InnerSubscriberback to summary
pack-priv InnerSubscriber(long id, OperatorSwitch.SwitchSubscriber<T> parent)

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(T 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:T

the item emitted by the Observable

Annotations
@Override
setProducerback to summary
public void setProducer(Producer p)

Overrides rx.Subscriber.setProducer.

Doc from rx.Subscriber.setProducer.

If other subscriber is set (by calling constructor Subscriber(Subscriber) or Subscriber(Subscriber, boolean)) then this method calls setProducer on the other subscriber. If the other subscriber is not set and no requests have been made to this subscriber then p.request(Long.MAX_VALUE) is called. If the other subscriber is not set and some requests have been made to this subscriber then p.request(n) is called where n is the accumulated requests to this subscriber.

Parameters
p:Producer

producer to be used by this subscriber or the other subscriber (or recursively its other subscriber) to make requests from

Annotations
@Override
rx.internal.operators back to summary

pack-priv final Class OperatorSwitch.SwitchSubscriber<T>

extends Subscriber<Observable<? extends T>>
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final Subscriber<? super T>
pack-priv final boolean
pack-priv boolean
pack-priv Throwable
pack-priv final AtomicLong
pack-priv boolean
pack-priv volatile boolean
pack-priv boolean
pack-priv Producer
pack-priv final SpscLinkedArrayQueue<Object>
pack-priv long
pack-priv final SerialSubscription
pack-priv static final Throwable

Constructor Summary

AccessConstructor and Description
pack-priv
SwitchSubscriber(Subscriber<? super T> child, boolean delayError)

Method Summary

Modifier and TypeMethod and Description
protected boolean
checkTerminated(boolean localMainDone, boolean localInnerActive, Throwable localError, final SpscLinkedArrayQueue<Object> localQueue, final Subscriber<? super T> localChild, boolean empty)

pack-priv void
pack-priv void
pack-priv void
complete(long id)

pack-priv void
pack-priv void
emit(T value, OperatorSwitch.InnerSubscriber<T> inner)

pack-priv void
error(Throwable e, long id)

pack-priv void
init()

pack-priv void
innerProducer(Producer p, long id)

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<? extends T>
the item emitted by the Observable
t
)

Implements rx.Observer.onNext.

Provides the Observer with a new item to observe.
pack-priv void
pack-priv boolean
Inherited from rx.Subscriber:
addisUnsubscribedonStartrequestsetProducerunsubscribe

Field Detail

childback to summary
pack-priv final Subscriber<? super T> child
delayErrorback to summary
pack-priv final boolean delayError
emittingback to summary
pack-priv boolean emitting
errorback to summary
pack-priv Throwable error
indexback to summary
pack-priv final AtomicLong index
innerActiveback to summary
pack-priv boolean innerActive
mainDoneback to summary
pack-priv volatile boolean mainDone
missedback to summary
pack-priv boolean missed
producerback to summary
pack-priv Producer producer

Hides rx.Subscriber.producer.

queueback to summary
pack-priv final SpscLinkedArrayQueue<Object> queue
requestedback to summary
pack-priv long requested

Hides rx.Subscriber.requested.

serialback to summary
pack-priv final SerialSubscription serial
TERMINAL_ERRORback to summary
pack-priv static final Throwable TERMINAL_ERROR

Constructor Detail

SwitchSubscriberback to summary
pack-priv SwitchSubscriber(Subscriber<? super T> child, boolean delayError)

Method Detail

checkTerminatedback to summary
protected boolean checkTerminated(boolean localMainDone, boolean localInnerActive, Throwable localError, final SpscLinkedArrayQueue<Object> localQueue, final Subscriber<? super T> localChild, boolean empty)
childRequestedback to summary
pack-priv void childRequested(long n)
clearProducerback to summary
pack-priv void clearProducer()
completeback to summary
pack-priv void complete(long id)
drainback to summary
pack-priv void drain()
emitback to summary
pack-priv void emit(T value, OperatorSwitch.InnerSubscriber<T> inner)
errorback to summary
pack-priv void error(Throwable e, long id)
initback to summary
pack-priv void init()
innerProducerback to summary
pack-priv void innerProducer(Producer p, long id)
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<? extends T> 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:Observable<? extends T>

the item emitted by the Observable

Annotations
@Override
pluginErrorback to summary
pack-priv void pluginError(Throwable e)
updateErrorback to summary
pack-priv boolean updateError(Throwable next)