示例#1
0
        public void Subscribe(ISingleObserver <T> 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;
            }

            SingleAmbCoordinator <T> .Run(observer, n, a);
        }
示例#2
0
        public void Subscribe(ISingleObserver <T> observer)
        {
            var srcs = sources;
            var n    = srcs.Length;

            SingleAmbCoordinator <T> .Run(observer, n, srcs);
        }
示例#3
0
        internal static void Run(ISingleObserver <T> observer, int n, ISingleSource <T>[] sources)
        {
            if (n == 0)
            {
                DisposableHelper.Complete(observer);
                return;
            }

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

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

            observer.OnSubscribe(parent);

            parent.Subscribe(sources, n);
        }
示例#4
0
 public InnerObserver(SingleAmbCoordinator <T> parent, int index)
 {
     this.parent = parent;
     this.index  = index;
 }