Window is similar to
Buffer, but rather than emitting packets
of items from the source Observable, it emits Observables, each one of which emits a subset of
items from the source Observable and then terminates with an onCompleted
notification.
Like Buffer, Window has many
varieties, each with its own way of subdividing the original Observable into the resulting
Observable emissions, each one of which contains a “window” onto the original
emitted items. In the terminology of the Window operator, when a
window “opens,” this means that a new Observable is emitted and that Observable will
begin emitting items emitted by the source Observable. When a window “closes,” this
means that the emitted Observable stops emitting items from the source Observable and terminates
with an onCompleted
notification to its observers.
RxClojure implements this operator as partition-all
:
partition-all
opens its first window immediately. It opens a new window
beginning with every step
item from the source Observable (so, for example, if
step
is 3, then it opens a new window starting with every third item). It closes
each window when that window has emitted n
items or if it receives an
onCompleted
or onError
notification from the source Observable. If
step = n
(which is the default if you omit the step
parameter) then the window size is the same as the step size and there will be a one-to-one
correspondence between the items emitted by the source Observable and the items emitted by
the collection of window Observables. If step < n
the windows will
overlap by n − step
items; if step > n
the windows will drop step − n
items from the source Observable
between every window.
RxCpp implements this operator as two variants of window
, two variants of
window_with_time
, and as window_with_time_or_count
:
window(count)
This variant of window
opens its first window immediately. It closes the
currently open window and immediately opens a new one whenever the current window has emitted
count
items. It will also close the currently open window if it receives an
onCompleted
or onError
notification from the source Observable.
This variant of window
emits a series of non-overlapping windows whose
collective emissions correspond one-to-one with those of the source Observable.
window(count, skip)
This variant of window
opens its first window immediately. It opens a new window
beginning with every skip
item from the source Observable (so, for example, if
skip
is 3, then it opens a new window starting with every third item). It closes
each window when that window has emitted count
items or if it receives an
onCompleted
or onError
notification from the source Observable. If
skip = count
then this behaves the same as
window(source, count)
; if skip < count
this will
emit windows that overlap by count − skip
items; if
skip > count
this will emit windows that drop
skip − count
items from the source Observable between every
window.
window_with_time(period
[, coordination
])
This variant of window_with_time
opens its first window immediately. It closes
the currently open window and opens another one every period
of time (a
Duration, optionally computed by a given Coordination). It will also close the currently open
window if it receives an onCompleted
or onError
notification from
the source Observable. This variant of window_with_time
emits a series of
non-overlapping windows whose collective emissions correspond one-to-one with those of the
source Observable.
window_with_time(period, skip
[, coordination
])
This variant of window_with_time
opens its first window immediately. It closes
the currently open window after period
amount of time has passed since it was
opened, and opens a new window after skip
amount of time has passed since the
previous window was opened (both times are Durations, optionally computed by a given
Coordination). It will also close the currently open window if it receives an
onCompleted
or onError
notification from the source Observable.
This variant of window_with_time
may emit windows that overlap or that have
gaps, depending on whether skip
is less than or greater than
period
.
window_with_time_or_count(period, count
[, coordination
])
window_with_time_or_count
opens its first window immediately. It closes the
currently open window and opens another one every period
of time (optionally
computed by a given Coordination) or whenever the currently open window has emitted
count
items. It will also close the currently open window if it receives an
onCompleted
or onError
notification from the source Observable.
window_with_time_or_count
emits a series of non-overlapping windows whose
collective emissions correspond one-to-one with those of the source Observable.
There are several varieties of Window in RxGroovy.
window(closingSelector)
This variant of window
opens its first window immediately. It closes the
currently open window and immediately opens a new one each time it observes an object emitted
by the Observable that is returned from closingSelector
. In this way, this
variant of window
emits a series of non-overlapping windows whose collective
emissions correspond one-to-one with those of the source Observable.
window(Func0)
window(windowOpenings, closingSelector)
This variant of window
opens a window whenever it observes the
windowOpenings
Observable emit an Opening
object and at the same
time calls closingSelector
to generate a closing Observable associated with that
window. When that closing Observable emits an object, window
closes that window.
Since the closing of currently open windows and the opening of new windows are activities
that are regulated by independent Observables, this variant of window
may create
windows that overlap (duplicating items from the source Observable) or that leave gaps
(discarding items from the source Observable).
window(Observable,Func1)
window(count)
This variant of window
opens its first window immediately. It closes the
currently open window and immediately opens a new one whenever the current window has emitted
count
items. It will also close the currently open window if it receives an
onCompleted
or onError
notification from the source Observable.
This variant of window
emits a series of non-overlapping windows whose
collective emissions correspond one-to-one with those of the source Observable.
window(int)
window(count, skip)
This variant of window
opens its first window immediately. It opens a new window
beginning with every skip
item from the source Observable (so, for example, if
skip
is 3, then it opens a new window starting with every third item). It closes
each window when that window has emitted count
items or if it receives an
onCompleted
or onError
notification from the source Observable. If
skip = count
then this behaves the same as
window(source, count)
; if skip < count
this will
emit windows that overlap by count − skip
items; if
skip > count
this will emit windows that drop
skip − count
items from the source Observable between every
window.
window(int,int)
window(timespan, unit
[, scheduler
])
This variant of window
opens its first window immediately. It closes the
currently open window and opens another one every timespan
period of time
(measured in unit
, and optionally on a particular
Scheduler
). It
will also close the currently open window if it receives an onCompleted
or
onError
notification from the source Observable. This variant of
window
emits a series of non-overlapping windows whose collective emissions
correspond one-to-one with those of the source Observable.
If you do not specify a Scheduler, this variant of window
uses the
computation
Scheduler for its timer by default.
window(long,TimeUnit)
window(long,TimeUnit,Scheduler)
window(timespan, unit, count
[, scheduler
])
This variant of window
opens its first window immediately. It closes the
currently open window and opens another one every timespan
period of time
(measured in unit
, and optionally on a particular
Scheduler
) or
whenever the currently open window has emitted count
items. It will also close
the currently open window if it receives an onCompleted
or onError
notification from the source Observable. This variant of window
emits a series
of non-overlapping windows whose collective emissions correspond one-to-one with those of the
source Observable.
If you do not specify a Scheduler, this variant of window
uses the
computation
Scheduler for its timer by default.
window(long,TimeUnit,int)
window(long,TimeUnit,int,Scheduler)
window(timespan, timeshift, unit
[, scheduler
])
This variant of window
opens its first window immediately, and thereafter opens
a new window every timeshift
period of time (measured in unit
, and
optionally on a particular Scheduler
). It closes a
currently open window after timespan
period of time has passed since that window was
opened. It will also close any currently open window if it receives an onCompleted
or
onError
notification from the source Observable. Depending on how you set
timespan
and timeshift
the windows that result from this operation
may overlap or may have gaps.
If you do not specify a Scheduler, this variant of window
uses the
computation
Scheduler for its timer by default.
window(long,long,TimeUnit)
window(long,long,TimeUnit,Scheduler)
You can use the Window operator to implement backpressure (that is, to cope with an Observable that may produce items too quickly for its observer to consume).
Window can reduce a sequence of many items to a sequence of fewer windows-of-items, making them more manageable. You could, for example, emit a window of items from a bursty Observable periodically, at a regular interval of time.
Observable<Observable<Integer>> burstyWindowed = bursty.window(500, TimeUnit.MILLISECONDS);
Or you could choose to emit a new window of items for every n items emitted by the bursty Observable.
Observable<Observable<Integer>> burstyWindowed = bursty.window(5);
There are several varieties of Window in RxJava.
window(closingSelector)
This variant of window
opens its first window immediately. It closes the
currently open window and immediately opens a new one each time it observes an object emitted
by the Observable that is returned from closingSelector
. In this way, this
variant of window
emits a series of non-overlapping windows whose collective
emissions correspond one-to-one with those of the source Observable.
window(Func0)
window(windowOpenings, closingSelector)
This variant of window
opens a window whenever it observes the
windowOpenings
Observable emit an Opening
object and at the same
time calls closingSelector
to generate a closing Observable associated with that
window. When that closing Observable emits an object, window
closes that window.
Since the closing of currently open windows and the opening of new windows are activities
that are regulated by independent Observables, this variant of window
may create
windows that overlap (duplicating items from the source Observable) or that leave gaps
(discarding items from the source Observable).
window(Observable,Func1)
window(count)
This variant of window
opens its first window immediately. It closes the
currently open window and immediately opens a new one whenever the current window has emitted
count
items. It will also close the currently open window if it receives an
onCompleted
or onError
notification from the source Observable.
This variant of window
emits a series of non-overlapping windows whose
collective emissions correspond one-to-one with those of the source Observable.
window(int)
window(count, skip)
This variant of window
opens its first window immediately. It opens a new window
beginning with every skip
item from the source Observable (so, for example, if
skip
is 3, then it opens a new window starting with every third item). It closes
each window when that window has emitted count
items or if it receives an
onCompleted
or onError
notification from the source Observable. If
skip = count
then this behaves the same as
window(source, count)
; if skip < count
this will
emit windows that overlap by count − skip
items; if
skip > count
this will emit windows that drop
skip − count
items from the source Observable between every
window.
window(int,int)
window(timespan, unit
[, scheduler
])
This variant of window
opens its first window immediately. It closes the
currently open window and opens another one every timespan
period of time
(measured in unit
, and optionally on a particular
Scheduler
). It
will also close the currently open window if it receives an onCompleted
or
onError
notification from the source Observable. This variant of
window
emits a series of non-overlapping windows whose collective emissions
correspond one-to-one with those of the source Observable.
If you do not specify a Scheduler, this variant of window
uses the
computation
Scheduler for its timer by default.
window(long,TimeUnit)
window(long,TimeUnit,Scheduler)
window(timespan, unit, count
[, scheduler
])
This variant of window
opens its first window immediately. It closes the
currently open window and opens another one every timespan
period of time
(measured in unit
, and optionally on a particular
Scheduler
) or
whenever the currently open window has emitted count
items. It will also close
the currently open window if it receives an onCompleted
or onError
notification from the source Observable. This variant of window
emits a series
of non-overlapping windows whose collective emissions correspond one-to-one with those of the
source Observable.
If you do not specify a Scheduler, this variant of window
uses the
computation
Scheduler for its timer by default.
window(long,TimeUnit,int)
window(long,TimeUnit,int,Scheduler)
window(timespan, timeshift, unit
[, scheduler
])
This variant of window
opens its first window immediately, and thereafter opens
a new window every timeshift
period of time (measured in unit
, and
optionally on a particular Scheduler
). It closes a
currently open window after timespan
period of time has passed since that window was
opened. It will also close any currently open window if it receives an onCompleted
or
onError
notification from the source Observable. Depending on how you set
timespan
and timeshift
the windows that result from this operation
may overlap or may have gaps.
If you do not specify a Scheduler, this variant of window
uses the
computation
Scheduler for its timer by default.
window(long,long,TimeUnit)
window(long,long,TimeUnit,Scheduler)
You can use the Window operator to implement backpressure (that is, to cope with an Observable that may produce items too quickly for its observer to consume).
Window can reduce a sequence of many items to a sequence of fewer windows-of-items, making them more manageable. You could, for example, emit a window of items from a bursty Observable periodically, at a regular interval of time.
Observable<Observable<Integer>> burstyWindowed = bursty.window(500, TimeUnit.MILLISECONDS);
Or you could choose to emit a new window of items for every n items emitted by the bursty Observable.
Observable<Observable<Integer>> burstyWindowed = bursty.window(5);
window(windowClosingSelector)
window(windowOpenings, windowClosingSelector)
window(windowBoundaries)
This variant of window
takes a second Observable as a parameter. Whenever this
second Observable emits an item, window
closes the current Observable window
(if any) and opens a new one.
windowWithCount(count)
This variant of windowWithCount
opens its first window immediately. It closes
the currently open window and immediately opens a new one whenever the current window has
emitted count
items. It will also close the currently open window if it
receives an onCompleted
or onError
notification from the source
Observable. This variant of windowWithCount
emits a series of non-overlapping
windows whose collective emissions correspond one-to-one with those of the source
Observable.
windowWithCount(count, skip)
This variant of windowWithCount
opens its first window immediately. It opens a
new window beginning with every skip
item from the source Observable (so, for
example, if skip
is 3, then it opens a new window starting with every third
item). It closes each window when that window has emitted count
items or if it
receives an onCompleted
or onError
notification from the source
Observable. If skip = count
then this behaves the same as
windowWithCount(count)
; if skip < count
this will
emit windows that overlap by count − skip
items; if
skip > count
this will emit windows that drop
skip − count
items from the source Observable between every
window.
windowWithTime(timeSpan
[,scheduler
])
This variant of windowWithTime
opens its first window immediately. It closes the
currently open window and opens another one every timespan
period of time (in
milliseconds, optionally measured on a particular Scheduler). It will
also close the currently open window if it receives an onCompleted
or onError
notification from the source Observable. This variant of windowWithTime
emits a
series of non-overlapping windows whose collective emissions correspond one-to-one with those
of the source Observable.
If you do not specify a Scheduler, this variant of windowWithTime
uses the
timeout
Scheduler for its timer by default.
windowWithTime(timeSpan,timeShift
[,scheduler
])
This variant of windowWithTime
opens its first window immediately, and
thereafter opens a new window every timeshift
milliseconds (optionally measured
on a particular Scheduler). It closes a currently open window after
timespan
milliseconds have passed since that window was opened. It will also close any
currently open window if it receives an onCompleted
or onError
notification
from the source Observable. Depending on how you set timespan
and
timeshift
the windows that result from this operation may overlap or may have
gaps.
If you do not specify a Scheduler, this variant of windowWithTime
uses the
timeout
Scheduler for its timer by default.
windowWithTimeOrCount(timeSpan,count
[,scheduler
])
windowWithTimeOrCount
opens its first window immediately. It closes the
currently open window and opens another one every timespan
milliseconds (optionally
measured on a particular Scheduler) or whenever the currently open
window has emitted count
items. It will also close the currently open window if it receives
an onCompleted
or onError
notification from the source Observable.
windowWithTimeOrCount
emits a series of non-overlapping windows whose collective
emissions correspond one-to-one with those of the source Observable.
If you do not specify a Scheduler, this variant of windowWithTimeOrCount
uses
the timeout
Scheduler for its timer by default.
There are several varieties of Window in RxKotlin.
window(closingSelector)
This variant of window
opens its first window immediately. It closes the
currently open window and immediately opens a new one each time it observes an object emitted
by the Observable that is returned from closingSelector
. In this way, this
variant of window
emits a series of non-overlapping windows whose collective
emissions correspond one-to-one with those of the source Observable.
window(windowOpenings, closingSelector)
This variant of window
opens a window whenever it observes the
windowOpenings
Observable emit an Opening
object and at the same
time calls closingSelector
to generate a closing Observable associated with that
window. When that closing Observable emits an object, window
closes that window.
Since the closing of currently open windows and the opening of new windows are activities
that are regulated by independent Observables, this variant of window
may create
windows that overlap (duplicating items from the source Observable) or that leave gaps
(discarding items from the source Observable).
window(count)
This variant of window
opens its first window immediately. It closes the
currently open window and immediately opens a new one whenever the current window has emitted
count
items. It will also close the currently open window if it receives an
onCompleted
or onError
notification from the source Observable.
This variant of window
emits a series of non-overlapping windows whose
collective emissions correspond one-to-one with those of the source Observable.
window(count, skip)
This variant of window
opens its first window immediately. It opens a new window
beginning with every skip
item from the source Observable (so, for example, if
skip
is 3, then it opens a new window starting with every third item). It closes
each window when that window has emitted count
items or if it receives an
onCompleted
or onError
notification from the source Observable. If
skip = count
then this behaves the same as
window(source, count)
; if skip < count
this will
emit windows that overlap by count − skip
items; if
skip > count
this will emit windows that drop
skip − count
items from the source Observable between every
window.
window(timespan, unit
[, scheduler
])
This variant of window
opens its first window immediately. It closes the
currently open window and opens another one every timespan
period of time
(measured in unit
, and optionally on a particular
Scheduler
). It
will also close the currently open window if it receives an onCompleted
or
onError
notification from the source Observable. This variant of
window
emits a series of non-overlapping windows whose collective emissions
correspond one-to-one with those of the source Observable.
If you do not specify a Scheduler, this variant of window
uses the
computation
Scheduler for its timer by default.
window(timespan, unit, count
[, scheduler
])
This variant of window
opens its first window immediately. It closes the
currently open window and opens another one every timespan
period of time
(measured in unit
, and optionally on a particular
Scheduler
) or
whenever the currently open window has emitted count
items. It will also close
the currently open window if it receives an onCompleted
or onError
notification from the source Observable. This variant of window
emits a series
of non-overlapping windows whose collective emissions correspond one-to-one with those of the
source Observable.
If you do not specify a Scheduler, this variant of window
uses the
computation
Scheduler for its timer by default.
window(timespan, timeshift, unit
[, scheduler
])
This variant of window
opens its first window immediately, and thereafter opens
a new window every timeshift
period of time (measured in unit
, and
optionally on a particular Scheduler
). It closes a currently
open window after timespan
period of time has passed since that window was opened. It will
also close any currently open window if it receives an onCompleted
or
onError
notification from the source Observable. Depending on how you set
timespan
and timeshift
the windows that result from this operation
may overlap or may have gaps.
If you do not specify a Scheduler, this variant of window
uses the
computation
Scheduler for its timer by default.
There are several variants of the Window operator in Rx.NET.
Window(windowClosingSelector)
This variant of Window
opens its first window immediately and calls the
windowClosingSelector
function to obtain a second Observable. Whenever this second
Observable emits a TWindowClosing
object, Window
closes the
currently open window, and immediately opens a new one. It repeats this process until either
Observable terminates. In this way, this variant of Window
emits a series of
non-overlapping windows whose collective emissions correspond one-to-one with those of the
source Observable, until the closing selector observable terminates.
Window(count)
This variant of Window
opens its first window immediately. It closes the
currently open window and immediately opens a new one whenever the current window has emitted
count
items. It will also close the currently open window if it receives an
onCompleted
or onError
notification from the source Observable.
This variant of Window
emits a series of non-overlapping windows whose
collective emissions correspond one-to-one with those of the source Observable.
Window(timeSpan
[,scheduler
])
This variant of Window
opens its first window immediately. It closes the
currently open window and opens another one every timespan
period of time
(in the form of a TimeSpan
object, and optionally on a particular
IScheduler
). It will also close the currently open window if
it receives an onCompleted
or onError
notification from the source Observable.
This variant of Window
emits a series of non-overlapping windows whose
collective emissions correspond one-to-one with those of the source Observable.
Window(count,skip)
This variant of Window
opens its first window immediately. It opens a new window
beginning with every skip
item from the source Observable (so, for example, if
skip
is 3, then it opens a new window starting with every third item). It closes
each window when that window has emitted count
items or if it receives an
onCompleted
or onError
notification from the source Observable. If
skip = count
then this behaves the same as
Window(source, count)
; if skip < count
this will
emit windows that overlap by count − skip
items; if
skip > count
this will emit windows that drop
skip − count
items from the source Observable between every
window.
Window(windowOpenings,windowClosingSelector)
This variant of Window
opens a window whenever it observes the
windowOpenings
Observable emit an TWindowOpening
object and at the
same time calls the windowClosingSelector
, passing it that
TWindowOpening
object, to generate a closing Observable associated with that
window. When that closing Observable emits a TWindowClosing
object,
Window
closes the associated window. Since the closing of currently open windows
and the opening of new windows are activities that are regulated by independent Observables,
this variant of Window
may create windows that overlap (duplicating items from
the source Observable) or that leave gaps (discarding items from the source Observable).
Window(timeSpan,count
[,scheduler
])
This variant of Window
opens its first window immediately. It closes the
currently open window and opens another one every timeSpan
period of time
(in the form of a TimeSpan
object, and optionally on a particular
IScheduler
) or whenever the currently open window has
emitted count
items. It will also close the currently open window if it receives an
onCompleted
or onError
notification from the source Observable.
This variant of window
emits a series of non-overlapping windows whose
collective emissions correspond one-to-one with those of the source Observable.
Window(timeSpan,timeShift
[,scheduler
])
This variant of Window
opens its first window immediately, and thereafter opens
a new window every timeShift
period of time (in the form of a
TimeSpan
object, and optionally on a particular
IScheduler
). It
closes a currently open window after timeSpan
period of time has passed since
that window was opened. It will also close any currently open window if it receives an
onCompleted
or onError
notification from the source Observable.
Depending on how you set timeSpan
and timeShift
the windows that
result from this operation may overlap or may have gaps.
RxPY implements this operator with several variants of four different functions.
window(window_closing_selector)
This variant of window
opens its first window immediately and calls the
closing_selector
function to obtain a second Observable. When this second
Observable emits an item, window
closes the currently open window, immediately
opens a new one, and again calls the closing_selector
function to obtain a fresh
Observable. It repeats this process until the source Observable terminates. In this way, this
variant of window
emits a series of non-overlapping windows whose collective
emissions correspond one-to-one with those of the source Observable.
window(window_openings,window_closing_selector)
This variant of window
opens a window whenever it observes the
window_openings
Observable emit an item, and at the same time calls
closing_selector
to generate a closing Observable associated with that window.
When that closing Observable emits an object, window
closes that window.
Since the closing of currently open windows and the opening of new windows are activities
that are regulated by independent Observables, this variant of window
may create
windows that overlap (duplicating items from the source Observable) or that leave gaps
(discarding items from the source Observable).
window(window_openings)
This variant of window
takes a second Observable as a parameter. Whenever this
second Observable emits an item, window
closes the current Observable window
(if any) and opens a new one.
window_with_count(count)
This variant of window_with_count
opens its first window immediately. It closes
the currently open window and immediately opens a new one whenever the current window has
emitted count
items. It will also close the currently open window if it receives
an onCompleted
or onError
notification from the source Observable.
This variant of window_with_count
emits a series of non-overlapping windows
whose collective emissions correspond one-to-one with those of the source Observable.
window_with_count(count,skip)
This variant of window_with_count
opens its first window immediately. It opens
a new window beginning with every skip
item from the source Observable (so, for
example, if skip
is 3, then it opens a new window starting with every third
item). It closes each window when that window has emitted count
items or if it
receives an onCompleted
or onError
notification from the source
Observable. If skip = count
then this behaves the same as
window_with_count(count)
; if skip < count
this will
emit windows that overlap by count − skip
items; if
skip > count
this will emit windows that drop
skip − count
items from the source Observable between every
window.
window_with_time(timespan
[,scheduler
])
window_with_time(timespan,timeshift
[,scheduler
])
This variant of window_with_time
opens its first window immediately. It closes
the currently open window and opens another one every timespan
milliseconds (optionally
measured on a particular Scheduler
). It will also close the
currently open window if it receives an onCompleted
or onError
notification from the source Observable. This variant of window_with_time
emits
a series of non-overlapping windows whose collective emissions correspond one-to-one with
those of the source Observable.
If you do not specify a Scheduler, this variant of window_with_time
uses the
timeout
Scheduler for its timer by default.
window_with_time_or_count(timespan,count
[,scheduler
])
window_with_time_or_count
opens its first window immediately. It closes the
currently open window and opens another one every timespan
milliseconds (optionally measured
on a particular Scheduler) or whenever the currently open window has
emitted count
items. It will also close the currently open window if it receives
an onCompleted
or onError
notification from the source Observable.
window_with_time_or_count
emits a series of non-overlapping windows whose
collective emissions correspond one-to-one with those of the source Observable.
If you do not specify a Scheduler, this variant of window_with_time_or_count
uses the timeout
Scheduler for its timer by default.
window_with_count(count,skip)
Rx.rb implements this operator as window_with_count
. It opens its first window
immediately. It then opens a new window beginning with every skip
item from the
source Observable (so, for example, if skip
is 3, then it opens a new window
starting with every third item). It closes each window when that window has emitted
count
items or if it receives an onCompleted
or
onError
notification from the source Observable. If
skip = count
then there is a one-to-one correspondence between the
items emitted by the source Observable and those emitted by the window Observables; if
skip < count
the windows will overlap by
count − skip
items; if skip > count
the
windows will drop skip − count
items from the source Observable
between every window.
RxScala implements this operator as sliding
(creates windows that may overlap or
have gaps) and tumbling
(creates windows whose collective emissions match those
of the source Observable one-to-one).
sliding(timespan,timeshift,count
[,scheduler
])
This variant of sliding
opens its first window immediately, and thereafter opens
a new window every timeshift
period of time (in the form of a Duration
object,
and optionally on a particular Scheduler
). It
closes a currently open window after timespan
period of time has passed since
that window was opened or once count
items have been emitted on that window. It
will also close any currently open window if it receives an onCompleted
or
onError
notification from the source Observable.
sliding(timespan,timeshift
[,scheduler
])
This variant of sliding
opens its first window immediately, and thereafter opens
a new window every timeshift
period of time (in the form of a Duration
object,
and optionally on a particular Scheduler
). It
closes a currently open window after timespan
period of time has passed since
that window was opened. It will also close any currently open window if it receives an
onCompleted
or onError
notification from the source Observable.
sliding(count,skip)
This variant of sliding
opens its first window immediately. It opens a new
window beginning with every skip
item from the source Observable (so, for
example, if skip
is 3, then it opens a new window starting with every third
item). It closes each window when that window has emitted count
items or if it
receives an onCompleted
or onError
notification from the source
Observable. If skip = count
then this behaves the same as
tumbling(count)
; if skip < count
this will
emit windows that overlap by count − skip
items; if
skip > count
this will emit windows that drop
skip − count
items from the source Observable between every
window.
sliding(openings,closings)
This variant of sliding
opens a window whenever it observes the
openings
Observable emit an Opening
object and at the same
time calls closings
to generate a closing Observable associated with that
window. When that closing Observable emits an item, sliding
closes that window.
tumbling(timespan,count
[,scheduler
])
This variant of tumbling
opens its first window immediately. It closes the currently open
window and opens another one every timespan
period of time (a Duration
,
optionally measured on a particular Scheduler
) or
whenever the currently open window has emitted count
items. It will also close
the currently open window if it receives an onCompleted
or onError
notification from the source Observable.
tumbling(timespan
[,scheduler
])
This variant of tumbling
opens its first window immediately. It closes the currently open
window and opens another one every timespan
period of time (a Duration
,
optionally measured on a particular scheduler
). It
will also close the currently open window if it receives an onCompleted
or
onError
notification from the source Observable.
tumbling(count)
This variant of tumbling
opens its first window immediately. It closes the
currently open window and immediately opens a new one whenever the current window has emitted
count
items. It will also close the currently open window if it receives an
onCompleted
or onError
notification from the source Observable.
tumbling(boundary)
This variant of tumbling
takes a second Observable as a parameter. Whenever this
second Observable emits an item, tumbling
closes the current Observable window
(if any) and opens a new one.
TBD