Esempio n. 1
0
        public void Subscribe(IMaybeObserver <T> observer)
        {
            var n    = 0;
            var srcs = sources;

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

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

            MaybeAmbCoordinator <T> .Run(observer, n, a);
        }
Esempio n. 2
0
        public void Subscribe(IMaybeObserver <T> observer)
        {
            var srcs = sources;
            var n    = srcs.Length;

            MaybeAmbCoordinator <T> .Run(observer, n, srcs);
        }
Esempio n. 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);
        }
Esempio n. 4
0
 public InnerObserver(MaybeAmbCoordinator <T> parent, int index)
 {
     this.parent = parent;
     this.index  = index;
 }