// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT License. // See the LICENSE file in the project root for more information. using System.Collections.Generic; namespace System.Reactive.Joins { internal abstract class ActivePlan { private readonly Dictionary _joinObservers = new(); protected readonly Action _onCompleted; internal abstract void Match(); protected ActivePlan(Action onCompleted) { _onCompleted = onCompleted; } protected void AddJoinObserver(IJoinObserver joinObserver) { if (!_joinObservers.ContainsKey(joinObserver)) { _joinObservers.Add(joinObserver, joinObserver); } } protected void Dequeue() { foreach (var joinObserver in _joinObservers.Values) { joinObserver.Dequeue(); } } } internal sealed class ActivePlan : ActivePlan { private readonly Action _onNext; private readonly JoinObserver _first; internal ActivePlan(JoinObserver first, Action onNext, Action onCompleted) : base(onCompleted) { _onNext = onNext; _first = first; AddJoinObserver(first); } internal override void Match() { if (_first.Queue.Count > 0) { var n1 = _first.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted) { _onCompleted(); } else { Dequeue(); _onNext(n1.Value); } } } } internal sealed class ActivePlan : ActivePlan { private readonly Action _onNext; private readonly JoinObserver _first; private readonly JoinObserver _second; internal ActivePlan(JoinObserver first, JoinObserver second, Action onNext, Action onCompleted) : base(onCompleted) { _onNext = onNext; _first = first; _second = second; AddJoinObserver(first); AddJoinObserver(second); } internal override void Match() { if (_first.Queue.Count > 0 && _second.Queue.Count > 0) { var n1 = _first.Queue.Peek(); var n2 = _second.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted) { _onCompleted(); } else { Dequeue(); _onNext(n1.Value, n2.Value ); } } } } internal sealed class ActivePlan : ActivePlan { private readonly Action _onNext; private readonly JoinObserver _first; private readonly JoinObserver _second; private readonly JoinObserver _third; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, Action onNext, Action onCompleted) : base(onCompleted) { _onNext = onNext; _first = first; _second = second; _third = third; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); } internal override void Match() { if (_first.Queue.Count > 0 && _second.Queue.Count > 0 && _third.Queue.Count > 0) { var n1 = _first.Queue.Peek(); var n2 = _second.Queue.Peek(); var n3 = _third.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted || n3.Kind == NotificationKind.OnCompleted) { _onCompleted(); } else { Dequeue(); _onNext(n1.Value, n2.Value, n3.Value ); } } } } internal sealed class ActivePlan : ActivePlan { private readonly Action _onNext; private readonly JoinObserver _first; private readonly JoinObserver _second; private readonly JoinObserver _third; private readonly JoinObserver _fourth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, Action onNext, Action onCompleted) : base(onCompleted) { _onNext = onNext; _first = first; _second = second; _third = third; _fourth = fourth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); AddJoinObserver(fourth); } internal override void Match() { if (_first.Queue.Count > 0 && _second.Queue.Count > 0 && _third.Queue.Count > 0 && _fourth.Queue.Count > 0) { var n1 = _first.Queue.Peek(); var n2 = _second.Queue.Peek(); var n3 = _third.Queue.Peek(); var n4 = _fourth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted || n3.Kind == NotificationKind.OnCompleted || n4.Kind == NotificationKind.OnCompleted) { _onCompleted(); } else { Dequeue(); _onNext(n1.Value, n2.Value, n3.Value, n4.Value ); } } } } internal sealed class ActivePlan : ActivePlan { private readonly Action _onNext; private readonly JoinObserver _first; private readonly JoinObserver _second; private readonly JoinObserver _third; private readonly JoinObserver _fourth; private readonly JoinObserver _fifth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, Action onNext, Action onCompleted) : base(onCompleted) { _onNext = onNext; _first = first; _second = second; _third = third; _fourth = fourth; _fifth = fifth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); AddJoinObserver(fourth); AddJoinObserver(fifth); } internal override void Match() { if (_first.Queue.Count > 0 && _second.Queue.Count > 0 && _third.Queue.Count > 0 && _fourth.Queue.Count > 0 && _fifth.Queue.Count > 0) { var n1 = _first.Queue.Peek(); var n2 = _second.Queue.Peek(); var n3 = _third.Queue.Peek(); var n4 = _fourth.Queue.Peek(); var n5 = _fifth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted || n3.Kind == NotificationKind.OnCompleted || n4.Kind == NotificationKind.OnCompleted || n5.Kind == NotificationKind.OnCompleted) { _onCompleted(); } else { Dequeue(); _onNext(n1.Value, n2.Value, n3.Value, n4.Value, n5.Value ); } } } } internal sealed class ActivePlan : ActivePlan { private readonly Action _onNext; private readonly JoinObserver _first; private readonly JoinObserver _second; private readonly JoinObserver _third; private readonly JoinObserver _fourth; private readonly JoinObserver _fifth; private readonly JoinObserver _sixth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, Action onNext, Action onCompleted) : base(onCompleted) { _onNext = onNext; _first = first; _second = second; _third = third; _fourth = fourth; _fifth = fifth; _sixth = sixth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); AddJoinObserver(fourth); AddJoinObserver(fifth); AddJoinObserver(sixth); } internal override void Match() { if (_first.Queue.Count > 0 && _second.Queue.Count > 0 && _third.Queue.Count > 0 && _fourth.Queue.Count > 0 && _fifth.Queue.Count > 0 && _sixth.Queue.Count > 0) { var n1 = _first.Queue.Peek(); var n2 = _second.Queue.Peek(); var n3 = _third.Queue.Peek(); var n4 = _fourth.Queue.Peek(); var n5 = _fifth.Queue.Peek(); var n6 = _sixth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted || n3.Kind == NotificationKind.OnCompleted || n4.Kind == NotificationKind.OnCompleted || n5.Kind == NotificationKind.OnCompleted || n6.Kind == NotificationKind.OnCompleted) { _onCompleted(); } else { Dequeue(); _onNext(n1.Value, n2.Value, n3.Value, n4.Value, n5.Value, n6.Value ); } } } } internal sealed class ActivePlan : ActivePlan { private readonly Action _onNext; private readonly JoinObserver _first; private readonly JoinObserver _second; private readonly JoinObserver _third; private readonly JoinObserver _fourth; private readonly JoinObserver _fifth; private readonly JoinObserver _sixth; private readonly JoinObserver _seventh; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, JoinObserver seventh, Action onNext, Action onCompleted) : base(onCompleted) { _onNext = onNext; _first = first; _second = second; _third = third; _fourth = fourth; _fifth = fifth; _sixth = sixth; _seventh = seventh; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); AddJoinObserver(fourth); AddJoinObserver(fifth); AddJoinObserver(sixth); AddJoinObserver(seventh); } internal override void Match() { if (_first.Queue.Count > 0 && _second.Queue.Count > 0 && _third.Queue.Count > 0 && _fourth.Queue.Count > 0 && _fifth.Queue.Count > 0 && _sixth.Queue.Count > 0 && _seventh.Queue.Count > 0) { var n1 = _first.Queue.Peek(); var n2 = _second.Queue.Peek(); var n3 = _third.Queue.Peek(); var n4 = _fourth.Queue.Peek(); var n5 = _fifth.Queue.Peek(); var n6 = _sixth.Queue.Peek(); var n7 = _seventh.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted || n3.Kind == NotificationKind.OnCompleted || n4.Kind == NotificationKind.OnCompleted || n5.Kind == NotificationKind.OnCompleted || n6.Kind == NotificationKind.OnCompleted || n7.Kind == NotificationKind.OnCompleted) { _onCompleted(); } else { Dequeue(); _onNext(n1.Value, n2.Value, n3.Value, n4.Value, n5.Value, n6.Value, n7.Value ); } } } } internal sealed class ActivePlan : ActivePlan { private readonly Action _onNext; private readonly JoinObserver _first; private readonly JoinObserver _second; private readonly JoinObserver _third; private readonly JoinObserver _fourth; private readonly JoinObserver _fifth; private readonly JoinObserver _sixth; private readonly JoinObserver _seventh; private readonly JoinObserver _eighth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, JoinObserver seventh, JoinObserver eighth, Action onNext, Action onCompleted) : base(onCompleted) { _onNext = onNext; _first = first; _second = second; _third = third; _fourth = fourth; _fifth = fifth; _sixth = sixth; _seventh = seventh; _eighth = eighth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); AddJoinObserver(fourth); AddJoinObserver(fifth); AddJoinObserver(sixth); AddJoinObserver(seventh); AddJoinObserver(eighth); } internal override void Match() { if (_first.Queue.Count > 0 && _second.Queue.Count > 0 && _third.Queue.Count > 0 && _fourth.Queue.Count > 0 && _fifth.Queue.Count > 0 && _sixth.Queue.Count > 0 && _seventh.Queue.Count > 0 && _eighth.Queue.Count > 0) { var n1 = _first.Queue.Peek(); var n2 = _second.Queue.Peek(); var n3 = _third.Queue.Peek(); var n4 = _fourth.Queue.Peek(); var n5 = _fifth.Queue.Peek(); var n6 = _sixth.Queue.Peek(); var n7 = _seventh.Queue.Peek(); var n8 = _eighth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted || n3.Kind == NotificationKind.OnCompleted || n4.Kind == NotificationKind.OnCompleted || n5.Kind == NotificationKind.OnCompleted || n6.Kind == NotificationKind.OnCompleted || n7.Kind == NotificationKind.OnCompleted || n8.Kind == NotificationKind.OnCompleted ) { _onCompleted(); } else { Dequeue(); _onNext(n1.Value, n2.Value, n3.Value, n4.Value, n5.Value, n6.Value, n7.Value, n8.Value ); } } } } internal sealed class ActivePlan : ActivePlan { private readonly Action _onNext; private readonly JoinObserver _first; private readonly JoinObserver _second; private readonly JoinObserver _third; private readonly JoinObserver _fourth; private readonly JoinObserver _fifth; private readonly JoinObserver _sixth; private readonly JoinObserver _seventh; private readonly JoinObserver _eighth; private readonly JoinObserver _ninth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, JoinObserver seventh, JoinObserver eighth, JoinObserver ninth, Action onNext, Action onCompleted) : base(onCompleted) { _onNext = onNext; _first = first; _second = second; _third = third; _fourth = fourth; _fifth = fifth; _sixth = sixth; _seventh = seventh; _eighth = eighth; _ninth = ninth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); AddJoinObserver(fourth); AddJoinObserver(fifth); AddJoinObserver(sixth); AddJoinObserver(seventh); AddJoinObserver(eighth); AddJoinObserver(ninth); } internal override void Match() { if (_first.Queue.Count > 0 && _second.Queue.Count > 0 && _third.Queue.Count > 0 && _fourth.Queue.Count > 0 && _fifth.Queue.Count > 0 && _sixth.Queue.Count > 0 && _seventh.Queue.Count > 0 && _eighth.Queue.Count > 0 && _ninth.Queue.Count > 0 ) { var n1 = _first.Queue.Peek(); var n2 = _second.Queue.Peek(); var n3 = _third.Queue.Peek(); var n4 = _fourth.Queue.Peek(); var n5 = _fifth.Queue.Peek(); var n6 = _sixth.Queue.Peek(); var n7 = _seventh.Queue.Peek(); var n8 = _eighth.Queue.Peek(); var n9 = _ninth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted || n3.Kind == NotificationKind.OnCompleted || n4.Kind == NotificationKind.OnCompleted || n5.Kind == NotificationKind.OnCompleted || n6.Kind == NotificationKind.OnCompleted || n7.Kind == NotificationKind.OnCompleted || n8.Kind == NotificationKind.OnCompleted || n9.Kind == NotificationKind.OnCompleted ) { _onCompleted(); } else { Dequeue(); _onNext(n1.Value, n2.Value, n3.Value, n4.Value, n5.Value, n6.Value, n7.Value, n8.Value, n9.Value ); } } } } internal sealed class ActivePlan : ActivePlan { private readonly Action _onNext; private readonly JoinObserver _first; private readonly JoinObserver _second; private readonly JoinObserver _third; private readonly JoinObserver _fourth; private readonly JoinObserver _fifth; private readonly JoinObserver _sixth; private readonly JoinObserver _seventh; private readonly JoinObserver _eighth; private readonly JoinObserver _ninth; private readonly JoinObserver _tenth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, JoinObserver seventh, JoinObserver eighth, JoinObserver ninth, JoinObserver tenth, Action onNext, Action onCompleted) : base(onCompleted) { _onNext = onNext; _first = first; _second = second; _third = third; _fourth = fourth; _fifth = fifth; _sixth = sixth; _seventh = seventh; _eighth = eighth; _ninth = ninth; _tenth = tenth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); AddJoinObserver(fourth); AddJoinObserver(fifth); AddJoinObserver(sixth); AddJoinObserver(seventh); AddJoinObserver(eighth); AddJoinObserver(ninth); AddJoinObserver(tenth); } internal override void Match() { if (_first.Queue.Count > 0 && _second.Queue.Count > 0 && _third.Queue.Count > 0 && _fourth.Queue.Count > 0 && _fifth.Queue.Count > 0 && _sixth.Queue.Count > 0 && _seventh.Queue.Count > 0 && _eighth.Queue.Count > 0 && _ninth.Queue.Count > 0 && _tenth.Queue.Count > 0 ) { var n1 = _first.Queue.Peek(); var n2 = _second.Queue.Peek(); var n3 = _third.Queue.Peek(); var n4 = _fourth.Queue.Peek(); var n5 = _fifth.Queue.Peek(); var n6 = _sixth.Queue.Peek(); var n7 = _seventh.Queue.Peek(); var n8 = _eighth.Queue.Peek(); var n9 = _ninth.Queue.Peek(); var n10 = _tenth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted || n3.Kind == NotificationKind.OnCompleted || n4.Kind == NotificationKind.OnCompleted || n5.Kind == NotificationKind.OnCompleted || n6.Kind == NotificationKind.OnCompleted || n7.Kind == NotificationKind.OnCompleted || n8.Kind == NotificationKind.OnCompleted || n9.Kind == NotificationKind.OnCompleted || n10.Kind == NotificationKind.OnCompleted ) { _onCompleted(); } else { Dequeue(); _onNext(n1.Value, n2.Value, n3.Value, n4.Value, n5.Value, n6.Value, n7.Value, n8.Value, n9.Value, n10.Value ); } } } } internal sealed class ActivePlan : ActivePlan { private readonly Action _onNext; private readonly JoinObserver _first; private readonly JoinObserver _second; private readonly JoinObserver _third; private readonly JoinObserver _fourth; private readonly JoinObserver _fifth; private readonly JoinObserver _sixth; private readonly JoinObserver _seventh; private readonly JoinObserver _eighth; private readonly JoinObserver _ninth; private readonly JoinObserver _tenth; private readonly JoinObserver _eleventh; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, JoinObserver seventh, JoinObserver eighth, JoinObserver ninth, JoinObserver tenth, JoinObserver eleventh, Action onNext, Action onCompleted) : base(onCompleted) { _onNext = onNext; _first = first; _second = second; _third = third; _fourth = fourth; _fifth = fifth; _sixth = sixth; _seventh = seventh; _eighth = eighth; _ninth = ninth; _tenth = tenth; _eleventh = eleventh; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); AddJoinObserver(fourth); AddJoinObserver(fifth); AddJoinObserver(sixth); AddJoinObserver(seventh); AddJoinObserver(eighth); AddJoinObserver(ninth); AddJoinObserver(tenth); AddJoinObserver(eleventh); } internal override void Match() { if (_first.Queue.Count > 0 && _second.Queue.Count > 0 && _third.Queue.Count > 0 && _fourth.Queue.Count > 0 && _fifth.Queue.Count > 0 && _sixth.Queue.Count > 0 && _seventh.Queue.Count > 0 && _eighth.Queue.Count > 0 && _ninth.Queue.Count > 0 && _tenth.Queue.Count > 0 && _eleventh.Queue.Count > 0 ) { var n1 = _first.Queue.Peek(); var n2 = _second.Queue.Peek(); var n3 = _third.Queue.Peek(); var n4 = _fourth.Queue.Peek(); var n5 = _fifth.Queue.Peek(); var n6 = _sixth.Queue.Peek(); var n7 = _seventh.Queue.Peek(); var n8 = _eighth.Queue.Peek(); var n9 = _ninth.Queue.Peek(); var n10 = _tenth.Queue.Peek(); var n11 = _eleventh.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted || n3.Kind == NotificationKind.OnCompleted || n4.Kind == NotificationKind.OnCompleted || n5.Kind == NotificationKind.OnCompleted || n6.Kind == NotificationKind.OnCompleted || n7.Kind == NotificationKind.OnCompleted || n8.Kind == NotificationKind.OnCompleted || n9.Kind == NotificationKind.OnCompleted || n10.Kind == NotificationKind.OnCompleted || n11.Kind == NotificationKind.OnCompleted ) { _onCompleted(); } else { Dequeue(); _onNext(n1.Value, n2.Value, n3.Value, n4.Value, n5.Value, n6.Value, n7.Value, n8.Value, n9.Value, n10.Value, n11.Value ); } } } } internal sealed class ActivePlan : ActivePlan { private readonly Action _onNext; private readonly JoinObserver _first; private readonly JoinObserver _second; private readonly JoinObserver _third; private readonly JoinObserver _fourth; private readonly JoinObserver _fifth; private readonly JoinObserver _sixth; private readonly JoinObserver _seventh; private readonly JoinObserver _eighth; private readonly JoinObserver _ninth; private readonly JoinObserver _tenth; private readonly JoinObserver _eleventh; private readonly JoinObserver _twelfth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, JoinObserver seventh, JoinObserver eighth, JoinObserver ninth, JoinObserver tenth, JoinObserver eleventh, JoinObserver twelfth, Action onNext, Action onCompleted) : base(onCompleted) { _onNext = onNext; _first = first; _second = second; _third = third; _fourth = fourth; _fifth = fifth; _sixth = sixth; _seventh = seventh; _eighth = eighth; _ninth = ninth; _tenth = tenth; _eleventh = eleventh; _twelfth = twelfth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); AddJoinObserver(fourth); AddJoinObserver(fifth); AddJoinObserver(sixth); AddJoinObserver(seventh); AddJoinObserver(eighth); AddJoinObserver(ninth); AddJoinObserver(tenth); AddJoinObserver(eleventh); AddJoinObserver(twelfth); } internal override void Match() { if (_first.Queue.Count > 0 && _second.Queue.Count > 0 && _third.Queue.Count > 0 && _fourth.Queue.Count > 0 && _fifth.Queue.Count > 0 && _sixth.Queue.Count > 0 && _seventh.Queue.Count > 0 && _eighth.Queue.Count > 0 && _ninth.Queue.Count > 0 && _tenth.Queue.Count > 0 && _eleventh.Queue.Count > 0 && _twelfth.Queue.Count > 0 ) { var n1 = _first.Queue.Peek(); var n2 = _second.Queue.Peek(); var n3 = _third.Queue.Peek(); var n4 = _fourth.Queue.Peek(); var n5 = _fifth.Queue.Peek(); var n6 = _sixth.Queue.Peek(); var n7 = _seventh.Queue.Peek(); var n8 = _eighth.Queue.Peek(); var n9 = _ninth.Queue.Peek(); var n10 = _tenth.Queue.Peek(); var n11 = _eleventh.Queue.Peek(); var n12 = _twelfth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted || n3.Kind == NotificationKind.OnCompleted || n4.Kind == NotificationKind.OnCompleted || n5.Kind == NotificationKind.OnCompleted || n6.Kind == NotificationKind.OnCompleted || n7.Kind == NotificationKind.OnCompleted || n8.Kind == NotificationKind.OnCompleted || n9.Kind == NotificationKind.OnCompleted || n10.Kind == NotificationKind.OnCompleted || n11.Kind == NotificationKind.OnCompleted || n12.Kind == NotificationKind.OnCompleted ) { _onCompleted(); } else { Dequeue(); _onNext(n1.Value, n2.Value, n3.Value, n4.Value, n5.Value, n6.Value, n7.Value, n8.Value, n9.Value, n10.Value, n11.Value, n12.Value ); } } } } internal sealed class ActivePlan : ActivePlan { private readonly Action _onNext; private readonly JoinObserver _first; private readonly JoinObserver _second; private readonly JoinObserver _third; private readonly JoinObserver _fourth; private readonly JoinObserver _fifth; private readonly JoinObserver _sixth; private readonly JoinObserver _seventh; private readonly JoinObserver _eighth; private readonly JoinObserver _ninth; private readonly JoinObserver _tenth; private readonly JoinObserver _eleventh; private readonly JoinObserver _twelfth; private readonly JoinObserver _thirteenth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, JoinObserver seventh, JoinObserver eighth, JoinObserver ninth, JoinObserver tenth, JoinObserver eleventh, JoinObserver twelfth, JoinObserver thirteenth, Action onNext, Action onCompleted) : base(onCompleted) { _onNext = onNext; _first = first; _second = second; _third = third; _fourth = fourth; _fifth = fifth; _sixth = sixth; _seventh = seventh; _eighth = eighth; _ninth = ninth; _tenth = tenth; _eleventh = eleventh; _twelfth = twelfth; _thirteenth = thirteenth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); AddJoinObserver(fourth); AddJoinObserver(fifth); AddJoinObserver(sixth); AddJoinObserver(seventh); AddJoinObserver(eighth); AddJoinObserver(ninth); AddJoinObserver(tenth); AddJoinObserver(eleventh); AddJoinObserver(twelfth); AddJoinObserver(thirteenth); } internal override void Match() { if (_first.Queue.Count > 0 && _second.Queue.Count > 0 && _third.Queue.Count > 0 && _fourth.Queue.Count > 0 && _fifth.Queue.Count > 0 && _sixth.Queue.Count > 0 && _seventh.Queue.Count > 0 && _eighth.Queue.Count > 0 && _ninth.Queue.Count > 0 && _tenth.Queue.Count > 0 && _eleventh.Queue.Count > 0 && _twelfth.Queue.Count > 0 && _thirteenth.Queue.Count > 0 ) { var n1 = _first.Queue.Peek(); var n2 = _second.Queue.Peek(); var n3 = _third.Queue.Peek(); var n4 = _fourth.Queue.Peek(); var n5 = _fifth.Queue.Peek(); var n6 = _sixth.Queue.Peek(); var n7 = _seventh.Queue.Peek(); var n8 = _eighth.Queue.Peek(); var n9 = _ninth.Queue.Peek(); var n10 = _tenth.Queue.Peek(); var n11 = _eleventh.Queue.Peek(); var n12 = _twelfth.Queue.Peek(); var n13 = _thirteenth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted || n3.Kind == NotificationKind.OnCompleted || n4.Kind == NotificationKind.OnCompleted || n5.Kind == NotificationKind.OnCompleted || n6.Kind == NotificationKind.OnCompleted || n7.Kind == NotificationKind.OnCompleted || n8.Kind == NotificationKind.OnCompleted || n9.Kind == NotificationKind.OnCompleted || n10.Kind == NotificationKind.OnCompleted || n11.Kind == NotificationKind.OnCompleted || n12.Kind == NotificationKind.OnCompleted || n13.Kind == NotificationKind.OnCompleted ) { _onCompleted(); } else { Dequeue(); _onNext(n1.Value, n2.Value, n3.Value, n4.Value, n5.Value, n6.Value, n7.Value, n8.Value, n9.Value, n10.Value, n11.Value, n12.Value, n13.Value ); } } } } internal sealed class ActivePlan : ActivePlan { private readonly Action _onNext; private readonly JoinObserver _first; private readonly JoinObserver _second; private readonly JoinObserver _third; private readonly JoinObserver _fourth; private readonly JoinObserver _fifth; private readonly JoinObserver _sixth; private readonly JoinObserver _seventh; private readonly JoinObserver _eighth; private readonly JoinObserver _ninth; private readonly JoinObserver _tenth; private readonly JoinObserver _eleventh; private readonly JoinObserver _twelfth; private readonly JoinObserver _thirteenth; private readonly JoinObserver _fourteenth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, JoinObserver seventh, JoinObserver eighth, JoinObserver ninth, JoinObserver tenth, JoinObserver eleventh, JoinObserver twelfth, JoinObserver thirteenth, JoinObserver fourteenth, Action onNext, Action onCompleted) : base(onCompleted) { _onNext = onNext; _first = first; _second = second; _third = third; _fourth = fourth; _fifth = fifth; _sixth = sixth; _seventh = seventh; _eighth = eighth; _ninth = ninth; _tenth = tenth; _eleventh = eleventh; _twelfth = twelfth; _thirteenth = thirteenth; _fourteenth = fourteenth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); AddJoinObserver(fourth); AddJoinObserver(fifth); AddJoinObserver(sixth); AddJoinObserver(seventh); AddJoinObserver(eighth); AddJoinObserver(ninth); AddJoinObserver(tenth); AddJoinObserver(eleventh); AddJoinObserver(twelfth); AddJoinObserver(thirteenth); AddJoinObserver(fourteenth); } internal override void Match() { if (_first.Queue.Count > 0 && _second.Queue.Count > 0 && _third.Queue.Count > 0 && _fourth.Queue.Count > 0 && _fifth.Queue.Count > 0 && _sixth.Queue.Count > 0 && _seventh.Queue.Count > 0 && _eighth.Queue.Count > 0 && _ninth.Queue.Count > 0 && _tenth.Queue.Count > 0 && _eleventh.Queue.Count > 0 && _twelfth.Queue.Count > 0 && _thirteenth.Queue.Count > 0 && _fourteenth.Queue.Count > 0 ) { var n1 = _first.Queue.Peek(); var n2 = _second.Queue.Peek(); var n3 = _third.Queue.Peek(); var n4 = _fourth.Queue.Peek(); var n5 = _fifth.Queue.Peek(); var n6 = _sixth.Queue.Peek(); var n7 = _seventh.Queue.Peek(); var n8 = _eighth.Queue.Peek(); var n9 = _ninth.Queue.Peek(); var n10 = _tenth.Queue.Peek(); var n11 = _eleventh.Queue.Peek(); var n12 = _twelfth.Queue.Peek(); var n13 = _thirteenth.Queue.Peek(); var n14 = _fourteenth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted || n3.Kind == NotificationKind.OnCompleted || n4.Kind == NotificationKind.OnCompleted || n5.Kind == NotificationKind.OnCompleted || n6.Kind == NotificationKind.OnCompleted || n7.Kind == NotificationKind.OnCompleted || n8.Kind == NotificationKind.OnCompleted || n9.Kind == NotificationKind.OnCompleted || n10.Kind == NotificationKind.OnCompleted || n11.Kind == NotificationKind.OnCompleted || n12.Kind == NotificationKind.OnCompleted || n13.Kind == NotificationKind.OnCompleted || n14.Kind == NotificationKind.OnCompleted ) { _onCompleted(); } else { Dequeue(); _onNext(n1.Value, n2.Value, n3.Value, n4.Value, n5.Value, n6.Value, n7.Value, n8.Value, n9.Value, n10.Value, n11.Value, n12.Value, n13.Value, n14.Value ); } } } } internal sealed class ActivePlan : ActivePlan { private readonly Action _onNext; private readonly JoinObserver _first; private readonly JoinObserver _second; private readonly JoinObserver _third; private readonly JoinObserver _fourth; private readonly JoinObserver _fifth; private readonly JoinObserver _sixth; private readonly JoinObserver _seventh; private readonly JoinObserver _eighth; private readonly JoinObserver _ninth; private readonly JoinObserver _tenth; private readonly JoinObserver _eleventh; private readonly JoinObserver _twelfth; private readonly JoinObserver _thirteenth; private readonly JoinObserver _fourteenth; private readonly JoinObserver _fifteenth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, JoinObserver seventh, JoinObserver eighth, JoinObserver ninth, JoinObserver tenth, JoinObserver eleventh, JoinObserver twelfth, JoinObserver thirteenth, JoinObserver fourteenth, JoinObserver fifteenth, Action onNext, Action onCompleted) : base(onCompleted) { _onNext = onNext; _first = first; _second = second; _third = third; _fourth = fourth; _fifth = fifth; _sixth = sixth; _seventh = seventh; _eighth = eighth; _ninth = ninth; _tenth = tenth; _eleventh = eleventh; _twelfth = twelfth; _thirteenth = thirteenth; _fourteenth = fourteenth; _fifteenth = fifteenth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); AddJoinObserver(fourth); AddJoinObserver(fifth); AddJoinObserver(sixth); AddJoinObserver(seventh); AddJoinObserver(eighth); AddJoinObserver(ninth); AddJoinObserver(tenth); AddJoinObserver(eleventh); AddJoinObserver(twelfth); AddJoinObserver(thirteenth); AddJoinObserver(fourteenth); AddJoinObserver(fifteenth); } internal override void Match() { if (_first.Queue.Count > 0 && _second.Queue.Count > 0 && _third.Queue.Count > 0 && _fourth.Queue.Count > 0 && _fifth.Queue.Count > 0 && _sixth.Queue.Count > 0 && _seventh.Queue.Count > 0 && _eighth.Queue.Count > 0 && _ninth.Queue.Count > 0 && _tenth.Queue.Count > 0 && _eleventh.Queue.Count > 0 && _twelfth.Queue.Count > 0 && _thirteenth.Queue.Count > 0 && _fourteenth.Queue.Count > 0 && _fifteenth.Queue.Count > 0 ) { var n1 = _first.Queue.Peek(); var n2 = _second.Queue.Peek(); var n3 = _third.Queue.Peek(); var n4 = _fourth.Queue.Peek(); var n5 = _fifth.Queue.Peek(); var n6 = _sixth.Queue.Peek(); var n7 = _seventh.Queue.Peek(); var n8 = _eighth.Queue.Peek(); var n9 = _ninth.Queue.Peek(); var n10 = _tenth.Queue.Peek(); var n11 = _eleventh.Queue.Peek(); var n12 = _twelfth.Queue.Peek(); var n13 = _thirteenth.Queue.Peek(); var n14 = _fourteenth.Queue.Peek(); var n15 = _fifteenth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted || n3.Kind == NotificationKind.OnCompleted || n4.Kind == NotificationKind.OnCompleted || n5.Kind == NotificationKind.OnCompleted || n6.Kind == NotificationKind.OnCompleted || n7.Kind == NotificationKind.OnCompleted || n8.Kind == NotificationKind.OnCompleted || n9.Kind == NotificationKind.OnCompleted || n10.Kind == NotificationKind.OnCompleted || n11.Kind == NotificationKind.OnCompleted || n12.Kind == NotificationKind.OnCompleted || n13.Kind == NotificationKind.OnCompleted || n14.Kind == NotificationKind.OnCompleted || n15.Kind == NotificationKind.OnCompleted ) { _onCompleted(); } else { Dequeue(); _onNext(n1.Value, n2.Value, n3.Value, n4.Value, n5.Value, n6.Value, n7.Value, n8.Value, n9.Value, n10.Value, n11.Value, n12.Value, n13.Value, n14.Value, n15.Value ); } } } } internal sealed class ActivePlan : ActivePlan { private readonly Action _onNext; private readonly JoinObserver _first; private readonly JoinObserver _second; private readonly JoinObserver _third; private readonly JoinObserver _fourth; private readonly JoinObserver _fifth; private readonly JoinObserver _sixth; private readonly JoinObserver _seventh; private readonly JoinObserver _eighth; private readonly JoinObserver _ninth; private readonly JoinObserver _tenth; private readonly JoinObserver _eleventh; private readonly JoinObserver _twelfth; private readonly JoinObserver _thirteenth; private readonly JoinObserver _fourteenth; private readonly JoinObserver _fifteenth; private readonly JoinObserver _sixteenth; internal ActivePlan(JoinObserver first, JoinObserver second, JoinObserver third, JoinObserver fourth, JoinObserver fifth, JoinObserver sixth, JoinObserver seventh, JoinObserver eighth, JoinObserver ninth, JoinObserver tenth, JoinObserver eleventh, JoinObserver twelfth, JoinObserver thirteenth, JoinObserver fourteenth, JoinObserver fifteenth, JoinObserver sixteenth, Action onNext, Action onCompleted) : base(onCompleted) { _onNext = onNext; _first = first; _second = second; _third = third; _fourth = fourth; _fifth = fifth; _sixth = sixth; _seventh = seventh; _eighth = eighth; _ninth = ninth; _tenth = tenth; _eleventh = eleventh; _twelfth = twelfth; _thirteenth = thirteenth; _fourteenth = fourteenth; _fifteenth = fifteenth; _sixteenth = sixteenth; AddJoinObserver(first); AddJoinObserver(second); AddJoinObserver(third); AddJoinObserver(fourth); AddJoinObserver(fifth); AddJoinObserver(sixth); AddJoinObserver(seventh); AddJoinObserver(eighth); AddJoinObserver(ninth); AddJoinObserver(tenth); AddJoinObserver(eleventh); AddJoinObserver(twelfth); AddJoinObserver(thirteenth); AddJoinObserver(fourteenth); AddJoinObserver(fifteenth); AddJoinObserver(sixteenth); } internal override void Match() { if (_first.Queue.Count > 0 && _second.Queue.Count > 0 && _third.Queue.Count > 0 && _fourth.Queue.Count > 0 && _fifth.Queue.Count > 0 && _sixth.Queue.Count > 0 && _seventh.Queue.Count > 0 && _eighth.Queue.Count > 0 && _ninth.Queue.Count > 0 && _tenth.Queue.Count > 0 && _eleventh.Queue.Count > 0 && _twelfth.Queue.Count > 0 && _thirteenth.Queue.Count > 0 && _fourteenth.Queue.Count > 0 && _fifteenth.Queue.Count > 0 && _sixteenth.Queue.Count > 0 ) { var n1 = _first.Queue.Peek(); var n2 = _second.Queue.Peek(); var n3 = _third.Queue.Peek(); var n4 = _fourth.Queue.Peek(); var n5 = _fifth.Queue.Peek(); var n6 = _sixth.Queue.Peek(); var n7 = _seventh.Queue.Peek(); var n8 = _eighth.Queue.Peek(); var n9 = _ninth.Queue.Peek(); var n10 = _tenth.Queue.Peek(); var n11 = _eleventh.Queue.Peek(); var n12 = _twelfth.Queue.Peek(); var n13 = _thirteenth.Queue.Peek(); var n14 = _fourteenth.Queue.Peek(); var n15 = _fifteenth.Queue.Peek(); var n16 = _sixteenth.Queue.Peek(); if (n1.Kind == NotificationKind.OnCompleted || n2.Kind == NotificationKind.OnCompleted || n3.Kind == NotificationKind.OnCompleted || n4.Kind == NotificationKind.OnCompleted || n5.Kind == NotificationKind.OnCompleted || n6.Kind == NotificationKind.OnCompleted || n7.Kind == NotificationKind.OnCompleted || n8.Kind == NotificationKind.OnCompleted || n9.Kind == NotificationKind.OnCompleted || n10.Kind == NotificationKind.OnCompleted || n11.Kind == NotificationKind.OnCompleted || n12.Kind == NotificationKind.OnCompleted || n13.Kind == NotificationKind.OnCompleted || n14.Kind == NotificationKind.OnCompleted || n15.Kind == NotificationKind.OnCompleted || n16.Kind == NotificationKind.OnCompleted ) { _onCompleted(); } else { Dequeue(); _onNext(n1.Value, n2.Value, n3.Value, n4.Value, n5.Value, n6.Value, n7.Value, n8.Value, n9.Value, n10.Value, n11.Value, n12.Value, n13.Value, n14.Value, n15.Value, n16.Value ); } } } } }