@@ -10018,7 +10018,7 @@ public final Observable<Observable<T>> window(int count, int skip) {
10018
10018
* @see <a href="http://msdn.microsoft.com/en-us/library/system.reactive.linq.observable.window.aspx">MSDN: Observable.Window</a>
10019
10019
*/
10020
10020
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());
10022
10022
}
10023
10023
10024
10024
/**
@@ -10049,7 +10049,41 @@ public final Observable<Observable<T>> window(long timespan, long timeshift, Tim
10049
10049
* @see <a href="http://msdn.microsoft.com/en-us/library/system.reactive.linq.observable.window.aspx">MSDN: Observable.Window</a>
10050
10050
*/
10051
10051
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));
10053
10087
}
10054
10088
10055
10089
/**
@@ -10143,7 +10177,7 @@ public final Observable<Observable<T>> window(long timespan, TimeUnit unit, int
10143
10177
* @see <a href="http://msdn.microsoft.com/en-us/library/system.reactive.linq.observable.window.aspx">MSDN: Observable.Window</a>
10144
10178
*/
10145
10179
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);
10147
10181
}
10148
10182
10149
10183
/**
0 commit comments