20
20
import rx .operators .DyadOperator ;
21
21
import rx .operators .DyadToSingleOperator ;
22
22
import rx .operators .SingleToDyadOperator ;
23
+
23
24
// dyad, triad, tetrad, pentad
24
25
public class DyadObservable <T0 , T1 > {
25
26
private DyadOnSubscribe <T0 , T1 > onSubscribeFunc ;
@@ -33,13 +34,12 @@ public class DyadObservable<T0, T1> {
33
34
* @param <T1>
34
35
* type of second argument
35
36
*/
36
- public static interface DyadOnSubscribe <T0 , T1 > extends Action1 <DyadSubscriber <? super T0 , ? super T1 >> {
37
- }
37
+ public static interface DyadOnSubscribe <T0 , T1 > extends Action1 <DyadSubscriber <? super T0 , ? super T1 >> {}
38
38
39
39
/**
40
40
* @param onSubscribeFunc
41
41
*/
42
- protected DyadObservable (DyadOnSubscribe <T0 , T1 > onSubscribeFunc ) {
42
+ private DyadObservable (DyadOnSubscribe <T0 , T1 > onSubscribeFunc ) {
43
43
this .onSubscribeFunc = onSubscribeFunc ;
44
44
}
45
45
@@ -59,7 +59,7 @@ public void subcribe(DyadSubscriber<? super T0, ? super T1> subscriber) {
59
59
}
60
60
61
61
/**
62
- * Create a new BiObservable that defers the subscription of {@code this} with a
62
+ * Create a new DyadObservable that defers the subscription of {@code this} with a
63
63
* {@link DyadSubscriber subscriber} that applies the given operator's effect to values produced
64
64
* when subscribed to.
65
65
*
@@ -81,8 +81,8 @@ public void call(DyadSubscriber<? super R0, ? super R1> child) {
81
81
/**
82
82
* Create a new {@link Observable} that defers the subscription of {@code this} with a
83
83
* {@link DyadSubscriber subscriber} that applies the given operator's effect to values produced
84
- * when subscribed to. This overload of {@code lift} converts a BiObservable to a single-valued
85
- * Observable.
84
+ * when subscribed to. This overload of {@code lift} converts a DyadObservable to a
85
+ * single-valued Observable.
86
86
*
87
87
* @param operator
88
88
* a function to adapt the types and semantics of the downstream operator.
@@ -121,29 +121,29 @@ public void call(DyadSubscriber<? super R0, ? super R1> subscriber) {
121
121
}
122
122
123
123
/**
124
- * Converts an Observable to a BiObservable by applying a function to generate a second value
124
+ * Converts an Observable to a DyadObservable by applying a function to generate a second value
125
125
* based on the values produced by the {@code observable}.
126
126
*
127
127
* @param observable
128
128
* the producer
129
129
* @param generatorFunc
130
- * ran once per call made to onNext to produce the paired BiObservable 's second
130
+ * ran once per call made to onNext to produce the paired DyadObservable 's second
131
131
* value
132
- * @return a BiObservable encapsulating the subscription to the given {@code observable}
132
+ * @return a DyadObservable encapsulating the subscription to the given {@code observable}
133
133
*/
134
134
public static <T0 , T1 > DyadObservable <T0 , T1 > generate (final Observable <? extends T0 > observable , final Func1 <? super T0 , ? extends T1 > generatorFunc ) {
135
135
return DyadObservable .lift (observable , new OperatorGenerate <T0 , T1 >(generatorFunc ));
136
136
}
137
137
138
138
/**
139
- * Creates a BiObservable by zipping two observables. Each value produced by the returned
140
- * BiObservable is the pair of each value emitted by the given observables.
139
+ * Creates a DyadObservable by zipping two observables. Each value produced by the returned
140
+ * DyadObservable is the pair of each value emitted by the given observables.
141
141
*
142
142
* @param ob0
143
143
* the first observable
144
144
* @param ob1
145
145
* the second observable
146
- * @return a BiObservable encapsulating the subscription to both observables
146
+ * @return a DyadObservable encapsulating the subscription to both observables
147
147
*/
148
148
public static <T0 , T1 > DyadObservable <T0 , T1 > zip (final Observable <? extends T0 > ob0 , final Observable <? extends T1 > ob1 ) {
149
149
return create (new DyadOnSubscribe <T0 , T1 >() {
@@ -210,13 +210,13 @@ public void onNext(Void t) {
210
210
}
211
211
212
212
/**
213
- * Creates a BiObservable that emits one pair of elements for each combination of the elements
213
+ * Creates a DyadObservable that emits one pair of elements for each combination of the elements
214
214
* emitted by the observables passed as parameters. This produces the Cartesian product of all
215
215
* emitted elements from two observables.
216
216
*
217
217
* @param ob0
218
218
* @param ob1
219
- * @return a BiObservable that produces the Cartesian product of
219
+ * @return a DyadObservable that produces the Cartesian product of
220
220
*/
221
221
public static <T0 , T1 > DyadObservable <T0 , T1 > product (final Observable <? extends T0 > ob0 , final Observable <? extends T1 > ob1 ) {
222
222
return create (new DyadOnSubscribe <T0 , T1 >() {
@@ -253,14 +253,14 @@ public void onNext(Void t) {
253
253
}
254
254
255
255
/**
256
- * Creates a BiObservable from an observable and a non-deterministic-arity generator function.
256
+ * Creates a DyadObservable from an observable and a non-deterministic-arity generator function.
257
257
* This emits a pair of each generatorFunc's output element with the input it was obtained from.
258
258
* Note that if the generatorFunc produces an "empty" observable then no pairs will be emitted
259
259
* for that input element.
260
260
*
261
261
* @param ob0
262
262
* @param generatorFunc
263
- * @return a BiObservable that
263
+ * @return a DyadObservable that
264
264
*/
265
265
public static <T0 , T1 > DyadObservable <T0 , T1 > sparseProduct (final Observable <? extends T0 > ob0 , final Func1 <? super T0 , Observable <T1 >> generatorFunc ) {
266
266
return create (new DyadOnSubscribe <T0 , T1 >() {
@@ -319,28 +319,30 @@ public static <T0, T1> DyadObservable<T0, T1> attach(Observable<? extends T0> ob
319
319
}
320
320
321
321
/**
322
- * Returns a BiObservable that applies a specified function to each pair of items emitted by the
323
- * source BiObservable and emits the results of these function applications, replacing the
322
+ * Returns a DyadObservable that applies a specified function to each pair of items emitted by
323
+ * the source DyadObservable and emits the results of these function applications, replacing the
324
324
* second item with the results. This overload accepts a Func2 that will receive both items
325
- * emitted by the BiObservable as arguments.
325
+ * emitted by the DyadObservable as arguments.
326
326
*
327
327
* @param func
328
328
* the function used to produce the new value.
329
- * @return a BiObservable which transforms the first item emitted using the specified function.
329
+ * @return a DyadObservable which transforms the first item emitted using the specified
330
+ * function.
330
331
*/
331
332
public <R > DyadObservable <? extends R , ? extends T1 > map1 (final Func2 <? super T0 , ? super T1 , ? extends R > func ) {
332
333
return lift (OperatorMapDual .dualMap1Operator (func ));
333
334
}
334
335
335
336
/**
336
- * Returns a BiObservable that applies a specified function to each pair of items emitted by the
337
- * source BiObservable and emits the results of these function applications, replacing the
337
+ * Returns a DyadObservable that applies a specified function to each pair of items emitted by
338
+ * the source DyadObservable and emits the results of these function applications, replacing the
338
339
* second item with the results. This overload accepts a Func1 that will receive the first item
339
- * emitted by the BiObservable as an argument.
340
+ * emitted by the DyadObservable as an argument.
340
341
*
341
342
* @param func
342
343
* the function used to produce the new value.
343
- * @return a BiObservable which transforms the first item emitted using the specified function.
344
+ * @return a DyadObservable which transforms the first item emitted using the specified
345
+ * function.
344
346
*/
345
347
public <R > DyadObservable <? extends R , ? extends T1 > map1 (final Func1 <? super T0 , ? extends R > func ) {
346
348
return lift (OperatorMapDual .singleMap1Operator (func ));
@@ -365,8 +367,8 @@ public static <T0, T1> DyadObservable<T0, T1> attach(Observable<? extends T0> ob
365
367
// <a,b,c,d> -> <r,d>
366
368
// <a,b,c,d> -> <r>
367
369
/**
368
- * Returns a BiObservable that applies a specified function to each pair of items emitted by the
369
- * source BiObservable and emits the results of these function applications, replacing the
370
+ * Returns a DyadObservable that applies a specified function to each pair of items emitted by
371
+ * the source DyadObservable and emits the results of these function applications, replacing the
370
372
* emitted values with the result from the specified function.
371
373
*
372
374
* @param func
@@ -499,28 +501,30 @@ public void onComplete() {
499
501
}
500
502
501
503
/**
502
- * Returns a BiObservable that applies a specified function to each pair of items emitted by the
503
- * source BiObservable and emits the results of these function applications, replacing the
504
+ * Returns a DyadObservable that applies a specified function to each pair of items emitted by
505
+ * the source DyadObservable and emits the results of these function applications, replacing the
504
506
* second item with the results. This overload accepts a Func2 that will receive both items
505
- * emitted by the BiObservable as arguments.
507
+ * emitted by the DyadObservable as arguments.
506
508
*
507
509
* @param func
508
510
* the function used to produce the new value.
509
- * @return a BiObservable which transforms the second item emitted using the specified function.
511
+ * @return a DyadObservable which transforms the second item emitted using the specified
512
+ * function.
510
513
*/
511
514
public <R > DyadObservable <T0 , R > map2 (Func2 <? super T0 , ? super T1 , ? extends R > func ) {
512
515
return lift (OperatorMapDual .dualMap2Operator (func ));
513
516
}
514
517
515
518
/**
516
- * Returns a BiObservable that applies a specified function to each pair of items emitted by the
517
- * source BiObservable and emits the results of these function applications, replacing the
519
+ * Returns a DyadObservable that applies a specified function to each pair of items emitted by
520
+ * the source DyadObservable and emits the results of these function applications, replacing the
518
521
* second item with the results. This overload accepts a Func1 that will receive the second item
519
- * emitted by the BiObservable as an argument.
522
+ * emitted by the DyadObservable as an argument.
520
523
*
521
524
* @param func
522
525
* the function used to produce the new value.
523
- * @return a BiObservable which transforms the second item emitted using the specified function.
526
+ * @return a DyadObservable which transforms the second item emitted using the specified
527
+ * function.
524
528
*/
525
529
public <R > DyadObservable <T0 , R > map2 (final Func1 <? super T1 , ? extends R > func ) {
526
530
return lift (OperatorMapDual .singleMap2Operator (func ));
0 commit comments