Plan<T1, T2, T3, T4, T5, TResult>
class Plan<
T1,
T2,
T3,
T4,
T5,
TResult> :
Plan<
TResult>
using System.
Collections.
Generic;
namespace System.
Reactive.
Joins
{
internal class Plan<
T1,
T2,
T3,
T4,
T5,
TResult> :
Plan<
TResult>
{
internal Pattern<
T1,
T2,
T3,
T4,
T5>
Expression { get; }
internal Func<
T1,
T2,
T3,
T4,
T5,
TResult>
Selector { get; }
internal Plan(
Pattern<
T1,
T2,
T3,
T4,
T5>
expression,
Func<
T1,
T2,
T3,
T4,
T5,
TResult>
selector)
{
Expression =
expression;
Selector =
selector;
}
internal override ActivePlan Activate(
Dictionary<
object,
IJoinObserver>
externalSubscriptions,
IObserver<
TResult>
observer,
Action<
ActivePlan>
deactivate)
{
IObserver<
TResult>
observer2 =
observer;
Action<
Exception>
onError =
observer2.
OnError;
JoinObserver<
T1>
firstJoinObserver =
Plan<
TResult>.
CreateObserver(
externalSubscriptions,
Expression.
First,
onError);
JoinObserver<
T2>
secondJoinObserver =
Plan<
TResult>.
CreateObserver(
externalSubscriptions,
Expression.
Second,
onError);
JoinObserver<
T3>
thirdJoinObserver =
Plan<
TResult>.
CreateObserver(
externalSubscriptions,
Expression.
Third,
onError);
JoinObserver<
T4>
fourthJoinObserver =
Plan<
TResult>.
CreateObserver(
externalSubscriptions,
Expression.
Fourth,
onError);
JoinObserver<
T5>
fifthJoinObserver =
Plan<
TResult>.
CreateObserver(
externalSubscriptions,
Expression.
Fifth,
onError);
ActivePlan<
T1,
T2,
T3,
T4,
T5>
activePlan =
null;
activePlan =
new ActivePlan<
T1,
T2,
T3,
T4,
T5>(
firstJoinObserver,
secondJoinObserver,
thirdJoinObserver,
fourthJoinObserver,
fifthJoinObserver,
delegate(
T1 first,
T2 second,
T3 third,
T4 fourth,
T5 fifth) {
TResult val =
default(
TResult);
try {
val =
Selector(
first,
second,
third,
fourth,
fifth);
}
catch (
Exception error) {
observer.
OnError(
error);
return;
}
observer.
OnNext(
val);
},
delegate {
firstJoinObserver.
RemoveActivePlan(
activePlan);
secondJoinObserver.
RemoveActivePlan(
activePlan);
thirdJoinObserver.
RemoveActivePlan(
activePlan);
fourthJoinObserver.
RemoveActivePlan(
activePlan);
fifthJoinObserver.
RemoveActivePlan(
activePlan);
deactivate(
activePlan);
});
firstJoinObserver.
AddActivePlan(
activePlan);
secondJoinObserver.
AddActivePlan(
activePlan);
thirdJoinObserver.
AddActivePlan(
activePlan);
fourthJoinObserver.
AddActivePlan(
activePlan);
fifthJoinObserver.
AddActivePlan(
activePlan);
return activePlan;
}
}
}