1
1
/**
2
- * Copyright 2013 Netflix, Inc.
2
+ * Copyright 2014 Netflix, Inc.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5
5
* use this file except in compliance with the License. You may obtain a copy of
54
54
import rx .subjects .Subject ;
55
55
import rx .subscriptions .SerialSubscription ;
56
56
import rx .util .async .operators .Functionals ;
57
- import rx .util .async .operators .OperationDeferFuture ;
58
- import rx .util .async .operators .OperationForEachFuture ;
59
- import rx .util .async .operators .OperationFromFunctionals ;
60
- import rx .util .async .operators .OperationStartFuture ;
57
+ import rx .util .async .operators .OperatorDeferFuture ;
58
+ import rx .util .async .operators .OperatorForEachFuture ;
59
+ import rx .util .async .operators .OperatorFromFunctionals ;
60
+ import rx .util .async .operators .OperatorStartFuture ;
61
61
62
62
/**
63
63
* Utility methods to convert functions and actions into asynchronous operations
@@ -1377,7 +1377,7 @@ public static <R> FuncN<Observable<R>> asyncFunc(final FuncN<? extends R> func,
1377
1377
* @see <a href="https://github.com/Netflix/RxJava/wiki/Async-Operators#startfuture">RxJava Wiki: startFuture()</a>
1378
1378
*/
1379
1379
public static <T > Observable <T > startFuture (Func0 <? extends Future <? extends T >> functionAsync ) {
1380
- return OperationStartFuture .startFuture (functionAsync );
1380
+ return OperatorStartFuture .startFuture (functionAsync );
1381
1381
}
1382
1382
1383
1383
/**
@@ -1395,7 +1395,7 @@ public static <T> Observable<T> startFuture(Func0<? extends Future<? extends T>>
1395
1395
*/
1396
1396
public static <T > Observable <T > startFuture (Func0 <? extends Future <? extends T >> functionAsync ,
1397
1397
Scheduler scheduler ) {
1398
- return OperationStartFuture .startFuture (functionAsync , scheduler );
1398
+ return OperatorStartFuture .startFuture (functionAsync , scheduler );
1399
1399
}
1400
1400
1401
1401
/**
@@ -1416,7 +1416,7 @@ public static <T> Observable<T> startFuture(Func0<? extends Future<? extends T>>
1416
1416
* @see <a href="https://github.com/Netflix/RxJava/wiki/Async-Operators#deferfuture">RxJava Wiki: deferFuture()</a>
1417
1417
*/
1418
1418
public static <T > Observable <T > deferFuture (Func0 <? extends Future <? extends Observable <? extends T >>> observableFactoryAsync ) {
1419
- return OperationDeferFuture .deferFuture (observableFactoryAsync );
1419
+ return OperatorDeferFuture .deferFuture (observableFactoryAsync );
1420
1420
}
1421
1421
1422
1422
/**
@@ -1437,7 +1437,7 @@ public static <T> Observable<T> deferFuture(Func0<? extends Future<? extends Obs
1437
1437
public static <T > Observable <T > deferFuture (
1438
1438
Func0 <? extends Future <? extends Observable <? extends T >>> observableFactoryAsync ,
1439
1439
Scheduler scheduler ) {
1440
- return OperationDeferFuture .deferFuture (observableFactoryAsync , scheduler );
1440
+ return OperatorDeferFuture .deferFuture (observableFactoryAsync , scheduler );
1441
1441
}
1442
1442
1443
1443
/**
@@ -1453,13 +1453,13 @@ public static <T> Observable<T> deferFuture(
1453
1453
* @param source the source Observable
1454
1454
* @param onNext the action to call with each emitted element
1455
1455
* @return the Future representing the entire for-each operation
1456
- * @see #forEachFuture(rx.functions.Action1, rx.Scheduler)
1456
+ * @see #forEachFuture(rx.Observable, rx. functions.Action1, rx.Scheduler)
1457
1457
* @see <a href="https://github.com/Netflix/RxJava/wiki/Async-Operators#foreachfuture">RxJava Wiki: forEachFuture()</a>
1458
1458
*/
1459
1459
public static <T > FutureTask <Void > forEachFuture (
1460
1460
Observable <? extends T > source ,
1461
1461
Action1 <? super T > onNext ) {
1462
- return OperationForEachFuture .forEachFuture (source , onNext );
1462
+ return OperatorForEachFuture .forEachFuture (source , onNext );
1463
1463
}
1464
1464
1465
1465
@@ -1477,14 +1477,14 @@ public static <T> FutureTask<Void> forEachFuture(
1477
1477
* @param onNext the action to call with each emitted element
1478
1478
* @param onError the action to call when an exception is emitted
1479
1479
* @return the Future representing the entire for-each operation
1480
- * @see #forEachFuture(rx.functions.Action1, rx.functions.Action1, rx.Scheduler)
1480
+ * @see #forEachFuture(rx.Observable, rx. functions.Action1, rx.functions.Action1, rx.Scheduler)
1481
1481
* @see <a href="https://github.com/Netflix/RxJava/wiki/Async-Operators#foreachfuture">RxJava Wiki: forEachFuture()</a>
1482
1482
*/
1483
1483
public static <T > FutureTask <Void > forEachFuture (
1484
1484
Observable <? extends T > source ,
1485
1485
Action1 <? super T > onNext ,
1486
1486
Action1 <? super Throwable > onError ) {
1487
- return OperationForEachFuture .forEachFuture (source , onNext , onError );
1487
+ return OperatorForEachFuture .forEachFuture (source , onNext , onError );
1488
1488
}
1489
1489
1490
1490
@@ -1503,15 +1503,15 @@ public static <T> FutureTask<Void> forEachFuture(
1503
1503
* @param onError the action to call when an exception is emitted
1504
1504
* @param onCompleted the action to call when the source completes
1505
1505
* @return the Future representing the entire for-each operation
1506
- * @see #forEachFuture(rx.functions.Action1, rx.functions.Action1, rx.functions.Action0, rx.Scheduler)
1506
+ * @see #forEachFuture(rx.Observable, rx. functions.Action1, rx.functions.Action1, rx.functions.Action0, rx.Scheduler)
1507
1507
* @see <a href="https://github.com/Netflix/RxJava/wiki/Async-Operators#foreachfuture">RxJava Wiki: forEachFuture()</a>
1508
1508
*/
1509
1509
public static <T > FutureTask <Void > forEachFuture (
1510
1510
Observable <? extends T > source ,
1511
1511
Action1 <? super T > onNext ,
1512
1512
Action1 <? super Throwable > onError ,
1513
1513
Action0 onCompleted ) {
1514
- return OperationForEachFuture .forEachFuture (source , onNext , onError , onCompleted );
1514
+ return OperatorForEachFuture .forEachFuture (source , onNext , onError , onCompleted );
1515
1515
}
1516
1516
1517
1517
@@ -1534,7 +1534,7 @@ public static <T> FutureTask<Void> forEachFuture(
1534
1534
Observable <? extends T > source ,
1535
1535
Action1 <? super T > onNext ,
1536
1536
Scheduler scheduler ) {
1537
- FutureTask <Void > task = OperationForEachFuture .forEachFuture (source , onNext );
1537
+ FutureTask <Void > task = OperatorForEachFuture .forEachFuture (source , onNext );
1538
1538
final Worker inner = scheduler .createWorker ();
1539
1539
inner .schedule (Functionals .fromRunnable (task , inner ));
1540
1540
return task ;
@@ -1562,7 +1562,7 @@ public static <T> FutureTask<Void> forEachFuture(
1562
1562
Action1 <? super T > onNext ,
1563
1563
Action1 <? super Throwable > onError ,
1564
1564
Scheduler scheduler ) {
1565
- FutureTask <Void > task = OperationForEachFuture .forEachFuture (source , onNext , onError );
1565
+ FutureTask <Void > task = OperatorForEachFuture .forEachFuture (source , onNext , onError );
1566
1566
final Worker inner = scheduler .createWorker ();
1567
1567
inner .schedule (Functionals .fromRunnable (task , inner ));
1568
1568
return task ;
@@ -1592,7 +1592,7 @@ public static <T> FutureTask<Void> forEachFuture(
1592
1592
Action1 <? super Throwable > onError ,
1593
1593
Action0 onCompleted ,
1594
1594
Scheduler scheduler ) {
1595
- FutureTask <Void > task = OperationForEachFuture .forEachFuture (source , onNext , onError , onCompleted );
1595
+ FutureTask <Void > task = OperatorForEachFuture .forEachFuture (source , onNext , onError , onCompleted );
1596
1596
final Worker inner = scheduler .createWorker ();
1597
1597
inner .schedule (Functionals .fromRunnable (task , inner ));
1598
1598
return task ;
@@ -1617,30 +1617,6 @@ public static <R> Observable<R> fromAction(Action0 action, R result) {
1617
1617
return fromAction (action , result , Schedulers .computation ());
1618
1618
}
1619
1619
1620
- /**
1621
- * Return an Observable that calls the given function and emits its
1622
- * result when an Observer subscribes.
1623
- * <p>
1624
- * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/fromFunc0.png">
1625
- * <p>
1626
- * The function is called on the default thread pool for computation.
1627
- *
1628
- * @param <R> the return type
1629
- * @param function the function to call on each subscription
1630
- * @return an Observable that calls the given function and emits its
1631
- * result when an Observer subscribes
1632
- * @see #start(rx.functions.Func0)
1633
- * @see #fromCallable(java.util.concurrent.Callable)
1634
- * @see <a href="https://github.com/Netflix/RxJava/wiki/Async-Operators#fromfunc0">RxJava Wiki: fromFunc0()</a>
1635
- *
1636
- * @deprecated Unnecessary now that Func0 extends Callable. Just call
1637
- * {@link #fromCallable(Callable)} instead.
1638
- */
1639
- @ Deprecated
1640
- public static <R > Observable <R > fromFunc0 (Func0 <? extends R > function ) {
1641
- return fromCallable (function );
1642
- }
1643
-
1644
1620
/**
1645
1621
* Return an Observable that calls the given Callable and emits its
1646
1622
* result or Exception when an Observer subscribes.
@@ -1654,7 +1630,6 @@ public static <R> Observable<R> fromFunc0(Func0<? extends R> function) {
1654
1630
* @return an Observable that calls the given Callable and emits its
1655
1631
* result or Exception when an Observer subscribes
1656
1632
* @see #start(rx.functions.Func0)
1657
- * @see #fromFunc0(rx.functions.Func0)
1658
1633
* @see <a href="https://github.com/Netflix/RxJava/wiki/Async-Operators#fromcallable">RxJava Wiki: fromCallable()</a>
1659
1634
*/
1660
1635
public static <R > Observable <R > fromCallable (Callable <? extends R > callable ) {
@@ -1696,33 +1671,9 @@ public static <R> Observable<R> fromRunnable(final Runnable run, final R result)
1696
1671
* @see <a href="https://github.com/Netflix/RxJava/wiki/Async-Operators#fromaction">RxJava Wiki: fromAction()</a>
1697
1672
*/
1698
1673
public static <R > Observable <R > fromAction (Action0 action , R result , Scheduler scheduler ) {
1699
- return Observable .create (OperationFromFunctionals .fromAction (action , result )).subscribeOn (scheduler );
1674
+ return Observable .create (OperatorFromFunctionals .fromAction (action , result )).subscribeOn (scheduler );
1700
1675
}
1701
1676
1702
- /**
1703
- * Return an Observable that calls the given function and emits its
1704
- * result when an Observer subscribes.
1705
- * <p>
1706
- * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/fromFunc0.s.png">
1707
- *
1708
- * @param <R> the return type
1709
- * @param function the function to call on each subscription
1710
- * @param scheduler the scheduler where the function is called and the
1711
- * result is emitted
1712
- * @return an Observable that calls the given function and emits its
1713
- * result when an Observer subscribes
1714
- * @see #start(rx.functions.Func0)
1715
- * @see #fromCallable(java.util.concurrent.Callable)
1716
- * @see <a href="https://github.com/Netflix/RxJava/wiki/Async-Operators#fromfunc0">RxJava Wiki: fromFunc0()</a>
1717
- *
1718
- * @deprecated Unnecessary now that Func0 extends Callable. Just call
1719
- * {@link #fromCallable(Callable, Scheduler)} instead.
1720
- */
1721
- @ Deprecated
1722
- public static <R > Observable <R > fromFunc0 (Func0 <? extends R > function , Scheduler scheduler ) {
1723
- return fromCallable (function , scheduler );
1724
- }
1725
-
1726
1677
/**
1727
1678
* Return an Observable that calls the given Callable and emits its
1728
1679
* result or Exception when an Observer subscribes.
@@ -1736,11 +1687,10 @@ public static <R> Observable<R> fromFunc0(Func0<? extends R> function, Scheduler
1736
1687
* @return an Observable that calls the given Callable and emits its
1737
1688
* result or Exception when an Observer subscribes
1738
1689
* @see #start(rx.functions.Func0)
1739
- * @see #fromFunc0(rx.functions.Func0)
1740
1690
* @see <a href="https://github.com/Netflix/RxJava/wiki/Async-Operators#fromcallable">RxJava Wiki: fromCallable()</a>
1741
1691
*/
1742
1692
public static <R > Observable <R > fromCallable (Callable <? extends R > callable , Scheduler scheduler ) {
1743
- return Observable .create (OperationFromFunctionals .fromCallable (callable )).subscribeOn (scheduler );
1693
+ return Observable .create (OperatorFromFunctionals .fromCallable (callable )).subscribeOn (scheduler );
1744
1694
}
1745
1695
1746
1696
/**
@@ -1759,7 +1709,7 @@ public static <R> Observable<R> fromCallable(Callable<? extends R> callable, Sch
1759
1709
* @see <a href="https://github.com/Netflix/RxJava/wiki/Async-Operators#fromrunnable">RxJava Wiki: fromRunnable()</a>
1760
1710
*/
1761
1711
public static <R > Observable <R > fromRunnable (final Runnable run , final R result , Scheduler scheduler ) {
1762
- return Observable .create (OperationFromFunctionals .fromRunnable (run , result )).subscribeOn (scheduler );
1712
+ return Observable .create (OperatorFromFunctionals .fromRunnable (run , result )).subscribeOn (scheduler );
1763
1713
}
1764
1714
/**
1765
1715
* Runs the provided action on the given scheduler and allows propagation
0 commit comments