Top Description Inners Fields Constructors Methods
rx.internal.operators

public final Class OperatorWindowWithSize<T>

extends Object
implements Observable.Operator<Observable<T>, 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.*, rx.*, .Observable, .Observable.Operator, rx.functions.Action0, rx.internal.util.atomic.SpscLinkedArrayQueue, rx.subjects.*, rx.subscriptions.Subscriptions

Creates windows of values into the source sequence with skip frequency and size bounds. If skip == size then the windows are non-overlapping, otherwise, windows may overlap or can be discontinuous. The returned Observable sequence is cold and need to be consumed while the window operation is in progress.

Note that this conforms the Rx.NET behavior, but does not match former RxJava behavior, which operated as a regular buffer and mapped its lists to Observables.

Nested and Inner Type Summary

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

Field Summary

Modifier and TypeField and Description
pack-priv final int
pack-priv final int

Constructor Summary

AccessConstructor and Description
public
OperatorWindowWithSize(int size, int skip)

Method Summary

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

Implements rx.functions.Func1.call.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

sizeback to summary
pack-priv final int size
skipback to summary
pack-priv final int skip

Constructor Detail

OperatorWindowWithSizeback to summary
public OperatorWindowWithSize(int size, int skip)

Method Detail

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

Implements rx.functions.Func1.call.

Annotations
@Override
rx.internal.operators back to summary

pack-priv final Class OperatorWindowWithSize.WindowExact<T>

extends Subscriber<T>
implements Action0
Class Inheritance
All Implemented Interfaces
rx.functions.Action0, rx.functions.Action, rx.functions.Function

Field Summary

Modifier and TypeField and Description
pack-priv final Subscriber<? super Observable<T>>
pack-priv final Subscription
pack-priv int
pack-priv final int
pack-priv Subject<T, T>
pack-priv final AtomicInteger

Constructor Summary

AccessConstructor and Description
public
WindowExact(Subscriber<? super Observable<T>> actual, int size)

Method Summary

Modifier and TypeMethod and Description
public void
pack-priv Producer
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.
Inherited from rx.Subscriber:
addisUnsubscribedonStartrequestsetProducerunsubscribe

Field Detail

actualback to summary
pack-priv final Subscriber<? super Observable<T>> actual
cancelback to summary
pack-priv final Subscription cancel
indexback to summary
pack-priv int index
sizeback to summary
pack-priv final int size
windowback to summary
pack-priv Subject<T, T> window
wipback to summary
pack-priv final AtomicInteger wip

Constructor Detail

WindowExactback to summary
public WindowExact(Subscriber<? super Observable<T>> actual, int size)

Method Detail

callback to summary
public void call()

Implements rx.functions.Action0.call.

Annotations
@Override
createProducerback to summary
pack-priv Producer createProducer()
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
rx.internal.operators back to summary

pack-priv final Class OperatorWindowWithSize.WindowOverlap<T>

extends Subscriber<T>
implements Action0
Class Inheritance
All Implemented Interfaces
rx.functions.Action0, rx.functions.Action, rx.functions.Function

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
pack-priv final Subscriber<? super Observable<T>>
pack-priv final Subscription
pack-priv volatile boolean
pack-priv final AtomicInteger
pack-priv Throwable
pack-priv int
pack-priv int
pack-priv final Queue<Subject<T, T>>
pack-priv final AtomicLong
pack-priv final int
pack-priv final int
pack-priv final ArrayDeque<Subject<T, T>>
pack-priv final AtomicInteger

Constructor Summary

AccessConstructor and Description
public
WindowOverlap(Subscriber<? super Observable<T>> actual, int size, int skip)

Method Summary

Modifier and TypeMethod and Description
public void
pack-priv boolean
checkTerminated(boolean d, boolean empty, Subscriber<? super Subject<T, T>> a, Queue<Subject<T, T>> q)

pack-priv Producer
pack-priv void
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.
Inherited from rx.Subscriber:
addisUnsubscribedonStartrequestsetProducerunsubscribe

Field Detail

actualback to summary
pack-priv final Subscriber<? super Observable<T>> actual
cancelback to summary
pack-priv final Subscription cancel
doneback to summary
pack-priv volatile boolean done
drainWipback to summary
pack-priv final AtomicInteger drainWip
errorback to summary
pack-priv Throwable error
indexback to summary
pack-priv int index
producedback to summary
pack-priv int produced
queueback to summary
pack-priv final Queue<Subject<T, T>> queue
requestedback to summary
pack-priv final AtomicLong requested

Hides rx.Subscriber.requested.

sizeback to summary
pack-priv final int size
skipback to summary
pack-priv final int skip
windowsback to summary
pack-priv final ArrayDeque<Subject<T, T>> windows
wipback to summary
pack-priv final AtomicInteger wip

Constructor Detail

WindowOverlapback to summary
public WindowOverlap(Subscriber<? super Observable<T>> actual, int size, int skip)

Method Detail

callback to summary
public void call()

Implements rx.functions.Action0.call.

Annotations
@Override
checkTerminatedback to summary
pack-priv boolean checkTerminated(boolean d, boolean empty, Subscriber<? super Subject<T, T>> a, Queue<Subject<T, T>> q)
createProducerback to summary
pack-priv Producer createProducer()
drainback to summary
pack-priv void drain()
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
rx.internal.operators back to summary

pack-priv final Class OperatorWindowWithSize.WindowOverlap.WindowOverlapProducer

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

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv

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.AtomicBoolean:
compareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetgetgetAcquiregetAndSetgetOpaquegetPlainlazySetsetsetOpaquesetPlainsetReleasetoStringweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetReleaseweakCompareAndSetVolatile

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.concurrent.atomic.AtomicBoolean.serialVersionUID.

Constructor Detail

WindowOverlapProducerback to summary
pack-priv WindowOverlapProducer()

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 OperatorWindowWithSize.WindowSkip<T>

extends Subscriber<T>
implements Action0
Class Inheritance
All Implemented Interfaces
rx.functions.Action0, rx.functions.Action, rx.functions.Function

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
pack-priv final Subscriber<? super Observable<T>>
pack-priv final Subscription
pack-priv int
pack-priv final int
pack-priv final int
pack-priv Subject<T, T>
pack-priv final AtomicInteger

Constructor Summary

AccessConstructor and Description
public
WindowSkip(Subscriber<? super Observable<T>> actual, int size, int skip)

Method Summary

Modifier and TypeMethod and Description
public void
pack-priv Producer
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.
Inherited from rx.Subscriber:
addisUnsubscribedonStartrequestsetProducerunsubscribe

Field Detail

actualback to summary
pack-priv final Subscriber<? super Observable<T>> actual
cancelback to summary
pack-priv final Subscription cancel
indexback to summary
pack-priv int index
sizeback to summary
pack-priv final int size
skipback to summary
pack-priv final int skip
windowback to summary
pack-priv Subject<T, T> window
wipback to summary
pack-priv final AtomicInteger wip

Constructor Detail

WindowSkipback to summary
public WindowSkip(Subscriber<? super Observable<T>> actual, int size, int skip)

Method Detail

callback to summary
public void call()

Implements rx.functions.Action0.call.

Annotations
@Override
createProducerback to summary
pack-priv Producer createProducer()
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
rx.internal.operators back to summary

pack-priv final Class OperatorWindowWithSize.WindowSkip.WindowSkipProducer

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

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv

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.AtomicBoolean:
compareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetgetgetAcquiregetAndSetgetOpaquegetPlainlazySetsetsetOpaquesetPlainsetReleasetoStringweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetReleaseweakCompareAndSetVolatile

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.concurrent.atomic.AtomicBoolean.serialVersionUID.

Constructor Detail

WindowSkipProducerback to summary
pack-priv WindowSkipProducer()

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