Top Description Inners Fields Constructors Methods
rx.internal.operators

public final Class OperatorWindowWithTime<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.TimeUnit, rx.*, .Observable, .Observable.Operator, .Observer, .Scheduler.Worker, rx.functions.Action0, rx.observers.*, rx.subjects.UnicastSubject, rx.subscriptions.Subscriptions

Creates windows of values into the source sequence with timed window creation, length and size bounds. If timespan == timeshift, windows are non-overlapping but always continuous, i.e., when the size bound is reached, a new window is opened.

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
OperatorWindowWithTime.CountedSerializedSubject<
the subject's in-out type
T
>

Record to store the subject and the emission count.

pack-priv class
OperatorWindowWithTime.ExactSubscriber

Subscriber with exact, non-overlapping windows.

pack-priv class
OperatorWindowWithTime.InexactSubscriber

Subscriber with inexact, potentially overlapping or discontinuous windows.

pack-priv static class
OperatorWindowWithTime.State<T>

The immutable windowing state with one subject.

Field Summary

Modifier and TypeField and Description
pack-priv static final Object
NEXT_SUBJECT

Indicate the current subject should complete and a new subject be emitted.

pack-priv final Scheduler
pack-priv final int
pack-priv final long
timeshift

Period of creating new windows.

pack-priv final long
timespan

Length of each window.

pack-priv final TimeUnit

Constructor Summary

AccessConstructor and Description
public
OperatorWindowWithTime(long timespan, long timeshift, TimeUnit unit, int size, Scheduler scheduler)

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

NEXT_SUBJECTback to summary
pack-priv static final Object NEXT_SUBJECT

Indicate the current subject should complete and a new subject be emitted.

schedulerback to summary
pack-priv final Scheduler scheduler
sizeback to summary
pack-priv final int size
timeshiftback to summary
pack-priv final long timeshift

Period of creating new windows.

timespanback to summary
pack-priv final long timespan

Length of each window.

unitback to summary
pack-priv final TimeUnit unit

Constructor Detail

OperatorWindowWithTimeback to summary
public OperatorWindowWithTime(long timespan, long timeshift, TimeUnit unit, int size, Scheduler scheduler)

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 OperatorWindowWithTime.CountedSerializedSubject<T>

extends Object
Class Inheritance
  • java.lang.Object
  • rx.internal.operators.OperatorWindowWithTime.CountedSerializedSubject
Type Parameters
<T>
the subject's in-out type

Record to store the subject and the emission count.

Field Summary

Modifier and TypeField and Description
pack-priv final Observer<T>
pack-priv int
pack-priv final Observable<T>

Constructor Summary

AccessConstructor and Description
public
CountedSerializedSubject(Observer<T> consumer, Observable<T> producer)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

consumerback to summary
pack-priv final Observer<T> consumer
countback to summary
pack-priv int count
producerback to summary
pack-priv final Observable<T> producer

Constructor Detail

CountedSerializedSubjectback to summary
public CountedSerializedSubject(Observer<T> consumer, Observable<T> producer)
rx.internal.operators back to summary

pack-priv final Class OperatorWindowWithTime.ExactSubscriber

extends Subscriber<T>
Class Inheritance

Subscriber with exact, non-overlapping windows.

Field Summary

Modifier and TypeField and Description
pack-priv final Subscriber<? super Observable<T>>
pack-priv boolean
emitting

Guarded by guard.

pack-priv final Object
pack-priv List<Object>
queue

Guarded by guard.

pack-priv volatile OperatorWindowWithTime.State<T>
pack-priv final Scheduler.Worker

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv void
pack-priv boolean
drain(List<Object> queue)

pack-priv boolean
emitValue(T t)

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

Field Detail

childback to summary
pack-priv final Subscriber<? super Observable<T>> child
emittingback to summary
pack-priv boolean emitting

Guarded by guard.

guardback to summary
pack-priv final Object guard
queueback to summary
pack-priv List<Object> queue

Guarded by guard.

stateback to summary
pack-priv volatile OperatorWindowWithTime.State<T> state
workerback to summary
pack-priv final Scheduler.Worker worker

Constructor Detail

ExactSubscriberback to summary
public ExactSubscriber(Subscriber<? super Observable<T>> child, Scheduler.Worker worker)

Method Detail

completeback to summary
pack-priv void complete()
drainback to summary
pack-priv boolean drain(List<Object> queue)
emitValueback to summary
pack-priv boolean emitValue(T t)
errorback to summary
pack-priv void error(Throwable e)
nextWindowback to summary
pack-priv void nextWindow()
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
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
replaceSubjectback to summary
pack-priv boolean replaceSubject()
scheduleExactback to summary
pack-priv void scheduleExact()
rx.internal.operators back to summary

pack-priv final Class OperatorWindowWithTime.InexactSubscriber

extends Subscriber<T>
Class Inheritance

Subscriber with inexact, potentially overlapping or discontinuous windows.

Field Summary

Modifier and TypeField and Description
pack-priv final Subscriber<? super Observable<T>>
pack-priv final List<OperatorWindowWithTime.CountedSerializedSubject<T>>
chunks

Guarded by this.

pack-priv boolean
done

Guarded by this.

pack-priv final Object
pack-priv final Scheduler.Worker

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv OperatorWindowWithTime.CountedSerializedSubject<T>
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
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.
pack-priv void
pack-priv void
pack-priv void
Inherited from rx.Subscriber:
addisUnsubscribedrequestsetProducerunsubscribe

Field Detail

childback to summary
pack-priv final Subscriber<? super Observable<T>> child
chunksback to summary
pack-priv final List<OperatorWindowWithTime.CountedSerializedSubject<T>> chunks

Guarded by this.

doneback to summary
pack-priv boolean done

Guarded by this.

guardback to summary
pack-priv final Object guard
workerback to summary
pack-priv final Scheduler.Worker worker

Constructor Detail

InexactSubscriberback to summary
public InexactSubscriber(Subscriber<? super Observable<T>> child, Scheduler.Worker worker)

Method Detail

createCountedSerializedSubjectback to summary
pack-priv OperatorWindowWithTime.CountedSerializedSubject<T> createCountedSerializedSubject()
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
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
scheduleChunkback to summary
pack-priv void scheduleChunk()
startNewChunkback to summary
pack-priv void startNewChunk()
terminateChunkback to summary
pack-priv void terminateChunk(OperatorWindowWithTime.CountedSerializedSubject<T> chunk)
rx.internal.operators back to summary

pack-priv final Class OperatorWindowWithTime.State<T>

extends Object
Class Inheritance

The immutable windowing state with one subject.

Field Summary

Modifier and TypeField and Description
pack-priv final Observer<T>
pack-priv final int
pack-priv static final OperatorWindowWithTime.State<Object>
pack-priv final Observable<T>

Constructor Summary

AccessConstructor and Description
public
State(Observer<T> consumer, Observable<T> producer, int count)

Method Summary

Modifier and TypeMethod and Description
public OperatorWindowWithTime.State<T>
public OperatorWindowWithTime.State<T>
create(Observer<T> consumer, Observable<T> producer)

public static <T> OperatorWindowWithTime.State<T>
public OperatorWindowWithTime.State<T>
next()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

consumerback to summary
pack-priv final Observer<T> consumer
countback to summary
pack-priv final int count
EMPTYback to summary
pack-priv static final OperatorWindowWithTime.State<Object> EMPTY
producerback to summary
pack-priv final Observable<T> producer

Constructor Detail

Stateback to summary
public State(Observer<T> consumer, Observable<T> producer, int count)

Method Detail

clearback to summary
public OperatorWindowWithTime.State<T> clear()
createback to summary
public OperatorWindowWithTime.State<T> create(Observer<T> consumer, Observable<T> producer)
emptyback to summary
public static <T> OperatorWindowWithTime.State<T> empty()
Annotations
@SuppressWarnings:unchecked
nextback to summary
public OperatorWindowWithTime.State<T> next()