예제 #1
0
 internal static FlowablePeek <T> Create(IFlowable <T> source,
                                         Action <T> onNext                  = null,
                                         Action <T> onAfterNext             = null,
                                         Action <Exception> onError         = null,
                                         Action onComplete                  = null,
                                         Action onTerminated                = null,
                                         Action onAfterTerminated           = null,
                                         Action <ISubscription> onSubscribe = null,
                                         Action <long> onRequest            = null,
                                         Action onCancel = null)
 {
     if (source is FlowablePeek <T> s)
     {
         source            = s.source;
         onNext            = Combine(s.onNext, onNext);
         onAfterNext       = Combine(s.onAfterNext, onAfterNext);
         onError           = Combine(s.onError, onError);
         onComplete        = Combine(s.onComplete, onComplete);
         onTerminated      = Combine(s.onTerminated, onTerminated);
         onAfterTerminated = Combine(s.onAfterTerminated, onAfterTerminated);
         onSubscribe       = Combine(s.onSubscribe, onSubscribe);
         onRequest         = Combine(s.onRequest, onRequest);
         onCancel          = Combine(s.onCancel, onCancel);
     }
     return(new FlowablePeek <T>(source, onNext, onAfterNext, onError, onComplete, onTerminated, onAfterTerminated, onSubscribe, onRequest, onCancel));
 }
예제 #2
0
 public FlowableTimeout(IFlowable <T> source, TimeSpan firstTimeout, TimeSpan itemTimeout, IExecutorService executor, IPublisher <T> fallback) : base(source)
 {
     this.firstTimeout = firstTimeout;
     this.itemTimeout  = itemTimeout;
     this.executor     = executor;
     this.fallback     = fallback;
 }
 internal RepeatWhenSubscriber(IFlowableSubscriber <T> actual, IFlowableProcessor <object> signaller, IFlowable <T> source)
 {
     this.actual    = actual;
     this.signaller = signaller;
     this.source    = source;
     this.handler   = new HandlerSubscriber(this);
 }
예제 #4
0
 internal RetryWhenSubscriber(IFlowableSubscriber <T> actual, IFlowableProcessor <Exception> signaller, IFlowable <T> source)
 {
     this.actual    = actual;
     this.signaller = signaller;
     this.source    = source;
     this.handler   = new HandlerSubscriber(this);
 }
예제 #5
0
            internal void Run()
            {
                var f = source;

                source = null;
                f.Subscribe(this);
            }
예제 #6
0
 internal RepeatSubscriber(IFlowableSubscriber <T> actual, Func <bool> stop, long times, IFlowable <T> source)
 {
     this.actual    = actual;
     this.stop      = stop;
     this.remaining = times;
     this.source    = source;
 }
예제 #7
0
 internal SubscribeOnSubscriber(IFlowableSubscriber <T> actual, IExecutorWorker worker, bool requestOn, IFlowable <T> source)
 {
     this.actual    = actual;
     this.worker    = worker;
     this.source    = source;
     this.requestOn = requestOn;
 }
예제 #8
0
 internal RetrySubscriber(IFlowableSubscriber <T> actual, Func <Exception, bool> handler, long times, IFlowable <T> source)
 {
     this.actual    = actual;
     this.handler   = handler;
     this.remaining = times;
     this.source    = source;
 }
 public FlowableConcatMapEager(IFlowable <T> source, Func <T, IPublisher <R> > mapper,
                               int maxConcurrency, int prefetch) : base(source)
 {
     this.mapper         = mapper;
     this.maxConcurrency = maxConcurrency;
     this.prefetch       = prefetch;
 }
예제 #10
0
 public static IFlowable <TSource> Delay <TSource>(this IFlowable <TSource> inflow, int miliseconds)
 {
     return(new FlowableWithUpstream <TSource, TSource>(inflow,
                                                        (x, s) => {
         Thread.Sleep(miliseconds);
         s.OnNext(x);
     }));
 }
예제 #11
0
 public static IFlowable <TSource> Delay <TSource>(this IFlowable <TSource> inflow, TimeSpan delay)
 {
     return(new FlowableWithUpstream <TSource, TSource>(inflow,
                                                        (x, s) => {
         Thread.Sleep(delay);
         s.OnNext(x);
     }));
 }
예제 #12
0
 public FlowableWithUpstream(IFlowable <T> upstream, Action <T, ISubscriber <R> > onNextFilter, Action <int, ISubscription> onRequestFilter = null)
 {
     this.upstream        = upstream;
     this.onNextFilter    = onNextFilter;
     this.onRequestFilter = onRequestFilter ?? ((n, s) => {
         s.Request(n);
     });
 }
예제 #13
0
 public FlowableFlatMap(IFlowable <T> source,
                        Func <T, IPublisher <R> > mapper,
                        int maxConcurrency,
                        int bufferSize) : base(source)
 {
     this.mapper         = mapper;
     this.maxConcurrency = maxConcurrency;
     this.bufferSize     = bufferSize;
 }
예제 #14
0
        public static IFlowable <T> Merge <T>(this IFlowable <T> first, IEnumerable <IFlowable <T> > rest)
        {
            var lst = new List <IFlowable <T> >()
            {
                first
            };

            lst.AddRange(rest);
            return(new FlowableMerge <T>(lst));
        }
예제 #15
0
 public static IFlowable <TSource> Where <TSource>(this IFlowable <TSource> inflow, Func <TSource, bool> filter)
 {
     return(new FlowableWithUpstream <TSource, TSource>(inflow,
                                                        (x, s) => {
         if (filter(x))
         {
             s.OnNext(x);
         }
     }));
 }
 public bool Poll(out IFlowable <T> item)
 {
     if (windows.Poll(out var v))
     {
         item = v;
         return(true);
     }
     item = default(IFlowable <T>);
     return(false);
 }
예제 #17
0
        public static IFlowable <T> Merge <T>(this IFlowable <T> first, params IFlowable <T>[] list)
        {
            var lst = new List <IFlowable <T> >()
            {
                first
            };

            lst.AddRange(list);
            return(new FlowableMerge <T>(lst));
        }
            internal void Subscribe(IFlowable <T> source)
            {
                if (Interlocked.Increment(ref wip) == 1)
                {
                    do
                    {
                        if (ArbiterIsCancelled())
                        {
                            return;
                        }
                        if (source == null)
                        {
                            var fs = fallbacks;

                            bool b;

                            try
                            {
                                b = fs.MoveNext();
                            }
                            catch (Exception ex)
                            {
                                fs.Dispose();
                                actual.OnError(ex);
                                return;
                            }

                            if (!b)
                            {
                                actual.OnComplete();
                                return;
                            }
                            else
                            {
                                fs.Current.Subscribe(this);
                            }
                        }
                        else
                        {
                            source.Subscribe(this);
                            source = null;
                        }
                    }while (Interlocked.Decrement(ref wip) != 0);
                }
            }
 internal void Subscribe(IFlowable <T> source)
 {
     if (Interlocked.Increment(ref wip) == 1)
     {
         do
         {
             if (source == null)
             {
                 hasValue = true;
                 fallback.Subscribe(this);
             }
             else
             {
                 source.Subscribe(this);
                 source = null;
             }
         }while (Interlocked.Decrement(ref wip) != 0);
     }
 }
예제 #20
0
 FlowablePeek(IFlowable <T> source,
              Action <T> onNext                  = null,
              Action <T> onAfterNext             = null,
              Action <Exception> onError         = null,
              Action onComplete                  = null,
              Action onTerminated                = null,
              Action onAfterTerminated           = null,
              Action <ISubscription> onSubscribe = null,
              Action <long> onRequest            = null,
              Action onCancel = null) : base(source)
 {
     this.onNext            = onNext;
     this.onAfterNext       = onAfterNext;
     this.onError           = onError;
     this.onComplete        = onComplete;
     this.onTerminated      = onTerminated;
     this.onAfterTerminated = onAfterTerminated;
     this.onSubscribe       = onSubscribe;
     this.onRequest         = onRequest;
     this.onCancel          = onCancel;
 }
예제 #21
0
            internal void Subscribe(IFlowable <T> source)
            {
                if (Interlocked.Increment(ref wip) == 1)
                {
                    do
                    {
                        if (ArbiterIsCancelled())
                        {
                            return;
                        }
                        if (source == null)
                        {
                            var fs = fallbacks;
                            var n  = fs.Length;

                            var i = index;

                            if (i == n)
                            {
                                actual.OnComplete();
                                return;
                            }
                            else
                            {
                                index = i + 1;
                                fs[i].Subscribe(this);
                            }
                        }
                        else
                        {
                            source.Subscribe(this);
                            source = null;
                        }
                    }while (Interlocked.Decrement(ref wip) != 0);
                }
            }
 public FlowableGroupBy(IFlowable <T> source, Func <T, K> keySelector, Func <T, V> valueSelector, int bufferSize) : base(source)
 {
     this.keySelector   = keySelector;
     this.valueSelector = valueSelector;
     this.bufferSize    = bufferSize;
 }
예제 #23
0
 public FlowableWindowSizeExact(IFlowable <T> source, int size) : base(source)
 {
     this.size = size;
 }
 public FlowableBufferSizeExact(IFlowable <T> source, int size, Func <C> collectionSupplier) : base(source)
 {
     this.size = size;
     this.collectionSupplier = collectionSupplier;
 }
 public FlowableSwitchIfEmpty(IFlowable <T> source, IPublisher <T> fallback) : base(source)
 {
     this.fallback = fallback;
 }
예제 #26
0
 public FlowableSubscribeOn(IFlowable <T> source, IExecutorService executor, bool requestOn) : base(source)
 {
     this.executor  = executor;
     this.requestOn = requestOn;
 }
 public FlowableTakeLastOne(IFlowable <T> source) : base(source)
 {
 }
예제 #28
0
 public bool Poll(out IFlowable <T> item)
 {
     return(queue.Poll(out item));
 }
예제 #29
0
 public FlowableWindowBoundary(IFlowable <T> source, IPublisher <U> boundary, int bufferSize) : base(source)
 {
     this.boundary   = boundary;
     this.bufferSize = bufferSize;
 }
 public ConnectableFlowableMulticast(IFlowable <T> source, Func <IFlowableProcessor <T> > processorSupplier) : base(source)
 {
     this.processorSupplier = processorSupplier;
     this.processor         = processorSupplier();
 }
예제 #31
0
 public TaskInfo(Identity identity, IFlowable<object> flowable, Identity[] dependencies)
 {
     _identity = identity;
     _flowable = flowable;
     _dependencies = dependencies;
 }