Skip to content

Commit 80bf26b

Browse files
committed
add missing window with time overload, the one that has control over every parameter
1 parent 5b8e681 commit 80bf26b

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

rxjava-core/src/main/java/rx/Observable.java

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10018,7 +10018,7 @@ public final Observable<Observable<T>> window(int count, int skip) {
1001810018
* @see <a href="http://msdn.microsoft.com/en-us/library/system.reactive.linq.observable.window.aspx">MSDN: Observable.Window</a>
1001910019
*/
1002010020
public final Observable<Observable<T>> window(long timespan, long timeshift, TimeUnit unit) {
10021-
return lift(new OperatorWindowWithTime<T>(timespan, timeshift, unit, Integer.MAX_VALUE, Schedulers.computation()));
10021+
return window(timespan, timeshift, unit, Integer.MAX_VALUE, Schedulers.computation());
1002210022
}
1002310023

1002410024
/**
@@ -10049,7 +10049,41 @@ public final Observable<Observable<T>> window(long timespan, long timeshift, Tim
1004910049
* @see <a href="http://msdn.microsoft.com/en-us/library/system.reactive.linq.observable.window.aspx">MSDN: Observable.Window</a>
1005010050
*/
1005110051
public final Observable<Observable<T>> window(long timespan, long timeshift, TimeUnit unit, Scheduler scheduler) {
10052-
return lift(new OperatorWindowWithTime<T>(timespan, timeshift, unit, Integer.MAX_VALUE, scheduler));
10052+
return window(timespan, timeshift, unit, Integer.MAX_VALUE, scheduler);
10053+
}
10054+
10055+
/**
10056+
* Returns an Observable that emits windows of items it collects from the source Observable. The resulting
10057+
* Observable starts a new window periodically, as determined by the {@code timeshift} argument or a maximum
10058+
* size as specified by the {@code count} argument (whichever is reached first). It emits
10059+
* each window after a fixed timespan, specified by the {@code timespan} argument. When the source
10060+
* Observable completes or Observable completes or encounters an error, the resulting Observable emits the
10061+
* current window and propagates the notification from the source Observable.
10062+
* <p>
10063+
* <img width="640" height="335" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/window7.s.png" alt="">
10064+
* <dl>
10065+
* <dt><b>Backpressure Support:</b></dt>
10066+
* <dd>This operator does not support backpressure as it uses time to control data flow.</dd>
10067+
* <dt><b>Scheduler:</b></dt>
10068+
* <dd>you specify which {@link Scheduler} this operator will use</dd>
10069+
* </dl>
10070+
*
10071+
* @param timespan
10072+
* the period of time each window collects items before it should be emitted
10073+
* @param timeshift
10074+
* the period of time after which a new window will be created
10075+
* @param unit
10076+
* the unit of time that applies to the {@code timespan} and {@code timeshift} arguments
10077+
* @param count
10078+
* the maximum size of each window before it should be emitted
10079+
* @param scheduler
10080+
* the {@link Scheduler} to use when determining the end and start of a window
10081+
* @return an Observable that emits new windows periodically as a fixed timespan elapses
10082+
* @see <a href="https://github.com/Netflix/RxJava/wiki/Transforming-Observables#window">RxJava wiki: window</a>
10083+
* @see <a href="http://msdn.microsoft.com/en-us/library/system.reactive.linq.observable.window.aspx">MSDN: Observable.Window</a>
10084+
*/
10085+
public final Observable<Observable<T>> window(long timespan, long timeshift, TimeUnit unit, int count, Scheduler scheduler) {
10086+
return lift(new OperatorWindowWithTime<T>(timespan, timeshift, unit, count, scheduler));
1005310087
}
1005410088

1005510089
/**
@@ -10143,7 +10177,7 @@ public final Observable<Observable<T>> window(long timespan, TimeUnit unit, int
1014310177
* @see <a href="http://msdn.microsoft.com/en-us/library/system.reactive.linq.observable.window.aspx">MSDN: Observable.Window</a>
1014410178
*/
1014510179
public final Observable<Observable<T>> window(long timespan, TimeUnit unit, int count, Scheduler scheduler) {
10146-
return lift(new OperatorWindowWithTime<T>(timespan, timespan, unit, count, scheduler));
10180+
return window(timespan, timespan, unit, count, scheduler);
1014710181
}
1014810182

1014910183
/**

0 commit comments

Comments
 (0)