Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OperatorTimerAndSample #1098

Merged
merged 1 commit into from
Apr 30, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions rxjava-core/src/main/java/rx/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
import rx.operators.OperationDelay;
import rx.operators.OperationGroupByUntil;
import rx.operators.OperationGroupJoin;
import rx.operators.OperationInterval;
import rx.operators.OperationJoin;
import rx.operators.OperationMergeDelayError;
import rx.operators.OperationMergeMaxConcurrent;
Expand All @@ -62,7 +61,6 @@
import rx.operators.OperationOnExceptionResumeNextViaObservable;
import rx.operators.OperationParallelMerge;
import rx.operators.OperationReplay;
import rx.operators.OperationSample;
import rx.operators.OperationSequenceEqual;
import rx.operators.OperationSkip;
import rx.operators.OperationSkipUntil;
Expand All @@ -73,7 +71,6 @@
import rx.operators.OperationTakeWhile;
import rx.operators.OperationThrottleFirst;
import rx.operators.OperationTimeInterval;
import rx.operators.OperationTimer;
import rx.operators.OperationToMap;
import rx.operators.OperationToMultimap;
import rx.operators.OperationUsing;
Expand Down Expand Up @@ -112,6 +109,8 @@
import rx.operators.OperatorPivot;
import rx.operators.OperatorRepeat;
import rx.operators.OperatorRetry;
import rx.operators.OperatorSampleWithObservable;
import rx.operators.OperatorSampleWithTime;
import rx.operators.OperatorScan;
import rx.operators.OperatorSerialize;
import rx.operators.OperatorSingle;
Expand All @@ -123,6 +122,8 @@
import rx.operators.OperatorTake;
import rx.operators.OperatorTimeout;
import rx.operators.OperatorTimeoutWithSelector;
import rx.operators.OperatorTimerOnce;
import rx.operators.OperatorTimerPeriodically;
import rx.operators.OperatorTimestamp;
import rx.operators.OperatorToObservableFuture;
import rx.operators.OperatorToObservableList;
Expand Down Expand Up @@ -1505,7 +1506,7 @@ public final static <T> Observable<T> from(T[] items, Scheduler scheduler) {
* @see <a href="http://msdn.microsoft.com/en-us/library/hh229027.aspx">MSDN: Observable.Interval</a>
*/
public final static Observable<Long> interval(long interval, TimeUnit unit) {
return create(OperationInterval.interval(interval, unit));
return create(new OperatorTimerPeriodically(interval, interval, unit, Schedulers.computation()));
}

/**
Expand All @@ -1525,7 +1526,7 @@ public final static Observable<Long> interval(long interval, TimeUnit unit) {
* @see <a href="http://msdn.microsoft.com/en-us/library/hh228911.aspx">MSDN: Observable.Interval</a>
*/
public final static Observable<Long> interval(long interval, TimeUnit unit, Scheduler scheduler) {
return create(OperationInterval.interval(interval, unit, scheduler));
return create(new OperatorTimerPeriodically(interval, interval, unit, scheduler));
}

/**
Expand Down Expand Up @@ -2540,7 +2541,7 @@ public final static Observable<Long> timer(long initialDelay, long period, TimeU
* @see <a href="http://msdn.microsoft.com/en-us/library/hh229652.aspx">MSDN: Observable.Timer</a>
*/
public final static Observable<Long> timer(long initialDelay, long period, TimeUnit unit, Scheduler scheduler) {
return create(new OperationTimer.TimerPeriodically(initialDelay, period, unit, scheduler));
return create(new OperatorTimerPeriodically(initialDelay, period, unit, scheduler));
}

/**
Expand All @@ -2552,6 +2553,7 @@ public final static Observable<Long> timer(long initialDelay, long period, TimeU
* the initial delay before emitting a single 0L
* @param unit
* time units to use for {@code delay}
* @return an Observable that emits one item after a specified delay, and then completes
* @see <a href="https://github.com/Netflix/RxJava/wiki/Creating-Observables#wiki-timer">RxJava wiki: timer()</a>
*/
public final static Observable<Long> timer(long delay, TimeUnit unit) {
Expand All @@ -2570,10 +2572,12 @@ public final static Observable<Long> timer(long delay, TimeUnit unit) {
* time units to use for {@code delay}
* @param scheduler
* the Scheduler to use for scheduling the item
* @return Observable that emits one item after a specified delay, on a specified Scheduler, and then
* completes
* @see <a href="https://github.com/Netflix/RxJava/wiki/Creating-Observables#wiki-timer">RxJava wiki: timer()</a>
*/
public final static Observable<Long> timer(long delay, TimeUnit unit, Scheduler scheduler) {
return create(new OperationTimer.TimerOnce(delay, unit, scheduler));
return create(new OperatorTimerOnce(delay, unit, scheduler));
}

/**
Expand Down Expand Up @@ -5322,7 +5326,7 @@ public final Observable<T> retry(int retryCount) {
* @see <a href="https://github.com/Netflix/RxJava/wiki/Filtering-Observables#wiki-sample-or-throttlelast">RxJava Wiki: sample()</a>
*/
public final Observable<T> sample(long period, TimeUnit unit) {
return create(OperationSample.sample(this, period, unit));
return lift(new OperatorSampleWithTime<T>(period, unit, Schedulers.computation()));
}

/**
Expand All @@ -5342,7 +5346,7 @@ public final Observable<T> sample(long period, TimeUnit unit) {
* @see <a href="https://github.com/Netflix/RxJava/wiki/Filtering-Observables#wiki-sample-or-throttlelast">RxJava Wiki: sample()</a>
*/
public final Observable<T> sample(long period, TimeUnit unit, Scheduler scheduler) {
return create(OperationSample.sample(this, period, unit, scheduler));
return lift(new OperatorSampleWithTime<T>(period, unit, scheduler));
}

/**
Expand All @@ -5359,7 +5363,7 @@ public final Observable<T> sample(long period, TimeUnit unit, Scheduler schedule
* @see <a href="https://github.com/Netflix/RxJava/wiki/Filtering-Observables#wiki-sample-or-throttlelast">RxJava Wiki: sample()</a>
*/
public final <U> Observable<T> sample(Observable<U> sampler) {
return create(new OperationSample.SampleWithObservable<T, U>(this, sampler));
return lift(new OperatorSampleWithObservable<T, U>(sampler));
}

/**
Expand Down
80 changes: 0 additions & 80 deletions rxjava-core/src/main/java/rx/operators/OperationInterval.java

This file was deleted.

Loading