public void Subscribe(ISingleObserver <R> observer)
        {
            var n    = 0;
            var srcs = sources;

            var a = new ISingleSource <T> [8];

            try
            {
                foreach (var m in srcs)
                {
                    if (n == a.Length)
                    {
                        var b = new ISingleSource <T> [n + (n >> 2)];
                        Array.Copy(a, 0, b, 0, n);
                        a = b;
                    }
                    a[n++] = m;
                }
            }
            catch (Exception ex)
            {
                DisposableHelper.Error(observer, ex);
                return;
            }

            SingleZipCoordinator <T, R> .Run(a, n, observer, mapper, delayErrors);
        }
        public void Subscribe(ISingleObserver <R> observer)
        {
            var srcs = sources;
            var n    = srcs.Length;

            SingleZipCoordinator <T, R> .Run(srcs, n, observer, mapper, delayErrors);
        }
        internal static void Run(ISingleSource <T>[] srcs, int n, ISingleObserver <R> observer, Func <T[], R> mapper, bool delayErrors)
        {
            if (n == 0)
            {
                DisposableHelper.Complete(observer);
                return;
            }

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

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

            observer.OnSubscribe(parent);

            parent.Subscribe(srcs, n);
        }
 public InnerObserver(SingleZipCoordinator <T, R> parent, int index)
 {
     this.parent = parent;
     this.index  = index;
 }