|
| 1 | +package rx.simple; |
| 2 | + |
| 3 | +import rx.Observable; |
| 4 | +import rx.Observable.OnSubscribe; |
| 5 | +import rx.Observable.Operator; |
| 6 | +import rx.Subscriber; |
| 7 | +import rx.functions.Func1; |
| 8 | +import rx.functions.Func2; |
| 9 | +import rx.internal.operators.OperatorFilter; |
| 10 | +import rx.internal.operators.OperatorMap; |
| 11 | +import rx.internal.operators.OperatorScan; |
| 12 | +import rx.single.MonoConversion; |
| 13 | +import rx.single.MonoObservable; |
| 14 | + |
| 15 | +public class CoreObservable<T> extends SimpleMonoObservable<T> { |
| 16 | + |
| 17 | + private CoreObservable(OnSubscribe<T> onSubscribe) { |
| 18 | + super(onSubscribe); |
| 19 | + } |
| 20 | + |
| 21 | + public static <T> CoreObservable<T> create(OnSubscribe<T> onSubscribe) { |
| 22 | + return new CoreObservable<T>(onSubscribe); |
| 23 | + } |
| 24 | + |
| 25 | + @Override |
| 26 | + public void subscribe(Subscriber<T> subscriber) { |
| 27 | + |
| 28 | + } |
| 29 | + |
| 30 | + @Override |
| 31 | + public <R> CoreObservable<R> lift(Operator<? extends R, ? super T> operator) { |
| 32 | + // TODO Auto-generated method stub |
| 33 | + return null; |
| 34 | + } |
| 35 | + |
| 36 | + @Override |
| 37 | + public <R, O> O extend(MonoConversion<O, T> operator) { |
| 38 | + // TODO Auto-generated method stub |
| 39 | + return null; |
| 40 | + } |
| 41 | + |
| 42 | + @Override |
| 43 | + public <R> MonoObservable<? extends R> compose(Func1<? super MonoObservable<? super T>, ? extends MonoObservable<? extends R>> composition) { |
| 44 | + // TODO Auto-generated method stub |
| 45 | + return null; |
| 46 | + } |
| 47 | + |
| 48 | + public final <R> CoreObservable<R> map(Func1<? super T, ? extends R> func) { |
| 49 | + return lift(new OperatorMap<T, R>(func)); |
| 50 | + } |
| 51 | + |
| 52 | + public final CoreObservable<T> filter(Func1<? super T, Boolean> predicate) { |
| 53 | + return lift(new OperatorFilter<T>(predicate)); |
| 54 | + } |
| 55 | + |
| 56 | + public final <R> CoreObservable<R> scan(R initialValue, Func2<R, ? super T, R> accumulator) { |
| 57 | + return lift(new OperatorScan<R, T>(initialValue, accumulator)); |
| 58 | + } |
| 59 | + |
| 60 | + public final <R> CoreObservable<R> flatMap(Func1<? super T, ? extends Observable<? extends R>> func) { |
| 61 | +// return map(func).lift(OperatorMerge.<T>instance(false)); |
| 62 | +// return map(func).extend(new CoreObservableConversion<R, Observable<R>>(OperatorMerge.<T>instance(false))); |
| 63 | + return null; |
| 64 | + } |
| 65 | + |
| 66 | +} |
0 commit comments