Beispiel #1
0
        public override void Subscribe(IFlowableSubscriber <R> subscriber)
        {
            var s      = sources;
            var n      = s.Length;
            var parent = new CombineLatestSubscription(subscriber, combiner, n, prefetch);

            subscriber.OnSubscribe(parent);

            parent.Subscribe(s);
        }
Beispiel #2
0
        public void Subscribe(ISubscriber <R> s)
        {
            int n;

            IPublisher <T>[] a;

            if (!MultiSourceHelper.ToArray(sources, sourcesEnumerable, s, out n, out a))
            {
                return;
            }

            if (n == 0)
            {
                EmptySubscription <R> .Complete(s);

                return;
            }
            else
            if (n == 1)
            {
                new PublisherMap <T, R>(a[0], v => combiner(new T[] { v })).Subscribe(s);
                return;
            }

            if (s is IConditionalSubscriber <R> )
            {
                CombineLatestConditionalSubscription parent = new CombineLatestConditionalSubscription((IConditionalSubscriber <R>)s, prefetch, delayError, combiner, n);

                s.OnSubscribe(parent);

                parent.Subscribe(a, n);
            }
            else
            {
                CombineLatestSubscription parent = new CombineLatestSubscription(s, prefetch, delayError, combiner, n);

                s.OnSubscribe(parent);

                parent.Subscribe(a, n);
            }
        }