Пример #1
0
        internal static void Subscribe(ICompletableObserver observer, ICompletableSource[] sources, int n)
        {
            if (n == 0)
            {
                DisposableHelper.Complete(observer);
                return;
            }
            if (n == 1)
            {
                sources[0].Subscribe(observer);
                return;
            }

            var parent = new AmbDisposable(observer, n);

            observer.OnSubscribe(parent);

            var co = parent.observers;

            for (int i = 0; i < n; i++)
            {
                if (!parent.IsDisposed())
                {
                    sources[i].Subscribe(co[i]);
                }
            }
        }
Пример #2
0
 public void OnSubscribe(IDisposable d)
 {
     upstream = d;
     if (remaining <= 0)
     {
         d.Dispose();
         DisposableHelper.Complete(downstream);
     }
     else
     {
         downstream.OnSubscribe(this);
     }
 }
Пример #3
0
        internal static void Run(IMaybeObserver <T> observer, int n, IMaybeSource <T>[] sources)
        {
            if (n == 0)
            {
                DisposableHelper.Complete(observer);
                return;
            }

            if (n == 1)
            {
                sources[0].Subscribe(observer);
                return;
            }

            var parent = new MaybeAmbCoordinator <T>(observer, n);

            observer.OnSubscribe(parent);

            parent.Subscribe(sources, n);
        }
        internal static void Subscribe(ISignalObserver <T> observer, IObservableSource <T>[] sources)
        {
            var n = sources.Length;

            if (n == 0)
            {
                DisposableHelper.Complete(observer);
            }
            else
            if (n == 1)
            {
                sources[0].Subscribe(observer);
            }
            else
            {
                var parent = new ObservableSourceAmbCoordinator <T>(observer, n);
                observer.OnSubscribe(parent);

                parent.Subscribe(sources);
            }
        }
Пример #5
0
        public void Subscribe(ICompletableObserver observer)
        {
            var srcs = sources;
            var n    = srcs.Length;

            if (n == 0)
            {
                DisposableHelper.Complete(observer);
                return;
            }

            if (n == 1)
            {
                srcs[0].Subscribe(observer);
                return;
            }

            var parent = new ConcatDisposable(observer, srcs, delayErrors);

            observer.OnSubscribe(parent);
            parent.Drain();
        }
Пример #6
0
        internal static void Run(IMaybeSource <T>[] srcs, int n, IMaybeObserver <R> observer, Func <T[], R> mapper, bool delayErrors)
        {
            if (n == 0)
            {
                DisposableHelper.Complete(observer);
                return;
            }

            if (n == 1)
            {
                new MaybeMap <T, R>(srcs[0],
                                    v => mapper(new T[] { v })
                                    ).Subscribe(observer);
                return;
            }

            var parent = new MaybeZipCoordinator <T, R>(observer, n, mapper, delayErrors);

            observer.OnSubscribe(parent);

            parent.Subscribe(srcs, n);
        }
 public void Subscribe(ISignalObserver <T> observer)
 {
     DisposableHelper.Complete(observer);
 }