Exemple #1
0
        protected override IDisposable Run(IObserver <T> observer)
        {
            var sourcesEnumerable = this.sources;
            var sources           = default(IObservable <T>[]);

            try
            {
                sources = sourcesEnumerable.ToArray();
            }
            catch (Exception ex)
            {
                observer.OnError(ex);
                return(Disposable.Empty);
            }

            return(AmbCoordinator <T> .Create(observer, sources));
        }
Exemple #2
0
        internal static IDisposable Create(IObserver <T> observer, IObservable <T>[] sources)
        {
            var n = sources.Length;

            if (n == 0)
            {
                observer.OnCompleted();
                return(Disposable.Empty);
            }

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

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

            parent.Subscribe(sources);

            return(parent);
        }
Exemple #3
0
 public InnerObserver(AmbCoordinator <T> parent, int index)
 {
     this.downstream = parent.downstream;
     this.parent     = parent;
     this.index      = index;
 }
Exemple #4
0
 protected override IDisposable Run(IObserver <T> observer)
 {
     return(AmbCoordinator <T> .Create(observer, sources));
 }
Exemple #5
0
 public AmbObserver(IObserver <TSource> downstream, AmbCoordinator parent, bool isLeft) : base(downstream)
 {
     _parent = parent;
     _isLeft = isLeft;
 }
Exemple #6
0
 protected override void Run(AmbCoordinator sink) => sink.Run(_left, _right);
Exemple #7
0
 public AmbObserver(IObserver <TSource> downstream, AmbCoordinator parent, bool isLeft)
 {
     this.downstream = downstream;
     this.parent     = parent;
     this.isLeft     = isLeft;
 }
Exemple #8
0
 protected override IDisposable Run(AmbCoordinator sink) => sink.Run(_left, _right);
Exemple #9
0
 public InnerObserver(AmbCoordinator <T> parent, int index) : base(parent._downstream)
 {
     _parent = parent;
     _index  = index;
 }