ActivePlan.cs 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the Apache 2.0 License.
  3. // See the LICENSE file in the project root for more information.
  4. using System.Collections.Generic;
  5. namespace System.Reactive.Joins
  6. {
  7. internal abstract class ActivePlan
  8. {
  9. Dictionary<IJoinObserver, IJoinObserver> joinObservers = new Dictionary<IJoinObserver, IJoinObserver>();
  10. internal abstract void Match();
  11. protected void AddJoinObserver(IJoinObserver joinObserver)
  12. {
  13. joinObservers.Add(joinObserver, joinObserver);
  14. }
  15. protected void Dequeue()
  16. {
  17. foreach (var joinObserver in joinObservers.Values)
  18. joinObserver.Dequeue();
  19. }
  20. }
  21. internal class ActivePlan<T1> : ActivePlan
  22. {
  23. private readonly Action<T1> onNext;
  24. private readonly Action onCompleted;
  25. private readonly JoinObserver<T1> first;
  26. internal ActivePlan(JoinObserver<T1> first, Action<T1> onNext, Action onCompleted)
  27. {
  28. this.onNext = onNext;
  29. this.onCompleted = onCompleted;
  30. this.first = first;
  31. AddJoinObserver(first);
  32. }
  33. internal override void Match()
  34. {
  35. if (first.Queue.Count > 0)
  36. {
  37. var n1 = first.Queue.Peek();
  38. if (n1.Kind == NotificationKind.OnCompleted)
  39. onCompleted();
  40. else
  41. {
  42. Dequeue();
  43. onNext(n1.Value
  44. );
  45. }
  46. }
  47. }
  48. }
  49. internal class ActivePlan<T1, T2> : ActivePlan
  50. {
  51. private readonly Action<T1, T2> onNext;
  52. private readonly Action onCompleted;
  53. private readonly JoinObserver<T1> first;
  54. private readonly JoinObserver<T2> second;
  55. internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, Action<T1, T2> onNext, Action onCompleted)
  56. {
  57. this.onNext = onNext;
  58. this.onCompleted = onCompleted;
  59. this.first = first;
  60. this.second = second;
  61. AddJoinObserver(first);
  62. AddJoinObserver(second);
  63. }
  64. internal override void Match()
  65. {
  66. if (first.Queue.Count > 0
  67. && second.Queue.Count > 0)
  68. {
  69. var n1 = first.Queue.Peek();
  70. var n2 = second.Queue.Peek();
  71. if ( n1.Kind == NotificationKind.OnCompleted
  72. || n2.Kind == NotificationKind.OnCompleted)
  73. onCompleted();
  74. else
  75. {
  76. Dequeue();
  77. onNext(n1.Value,
  78. n2.Value
  79. );
  80. }
  81. }
  82. }
  83. }
  84. internal class ActivePlan<T1, T2, T3> : ActivePlan
  85. {
  86. private readonly Action<T1, T2, T3> onNext;
  87. private readonly Action onCompleted;
  88. private readonly JoinObserver<T1> first;
  89. private readonly JoinObserver<T2> second;
  90. private readonly JoinObserver<T3> third;
  91. internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third, Action<T1, T2, T3> onNext, Action onCompleted)
  92. {
  93. this.onNext = onNext;
  94. this.onCompleted = onCompleted;
  95. this.first = first;
  96. this.second = second;
  97. this.third = third;
  98. AddJoinObserver(first);
  99. AddJoinObserver(second);
  100. AddJoinObserver(third);
  101. }
  102. internal override void Match()
  103. {
  104. if (first.Queue.Count > 0
  105. && second.Queue.Count > 0
  106. && third.Queue.Count > 0)
  107. {
  108. var n1 = first.Queue.Peek();
  109. var n2 = second.Queue.Peek();
  110. var n3 = third.Queue.Peek();
  111. if ( n1.Kind == NotificationKind.OnCompleted
  112. || n2.Kind == NotificationKind.OnCompleted
  113. || n3.Kind == NotificationKind.OnCompleted)
  114. onCompleted();
  115. else
  116. {
  117. Dequeue();
  118. onNext(n1.Value,
  119. n2.Value,
  120. n3.Value
  121. );
  122. }
  123. }
  124. }
  125. }
  126. internal class ActivePlan<T1, T2, T3, T4> : ActivePlan
  127. {
  128. private readonly Action<T1, T2, T3, T4> onNext;
  129. private readonly Action onCompleted;
  130. private readonly JoinObserver<T1> first;
  131. private readonly JoinObserver<T2> second;
  132. private readonly JoinObserver<T3> third;
  133. private readonly JoinObserver<T4> fourth;
  134. internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third, JoinObserver<T4> fourth, Action<T1, T2, T3, T4> onNext, Action onCompleted)
  135. {
  136. this.onNext = onNext;
  137. this.onCompleted = onCompleted;
  138. this.first = first;
  139. this.second = second;
  140. this.third = third;
  141. this.fourth = fourth;
  142. AddJoinObserver(first);
  143. AddJoinObserver(second);
  144. AddJoinObserver(third);
  145. AddJoinObserver(fourth);
  146. }
  147. internal override void Match()
  148. {
  149. if (first.Queue.Count > 0
  150. && second.Queue.Count > 0
  151. && third.Queue.Count > 0
  152. && fourth.Queue.Count > 0)
  153. {
  154. var n1 = first.Queue.Peek();
  155. var n2 = second.Queue.Peek();
  156. var n3 = third.Queue.Peek();
  157. var n4 = fourth.Queue.Peek();
  158. if ( n1.Kind == NotificationKind.OnCompleted
  159. || n2.Kind == NotificationKind.OnCompleted
  160. || n3.Kind == NotificationKind.OnCompleted
  161. || n4.Kind == NotificationKind.OnCompleted)
  162. onCompleted();
  163. else
  164. {
  165. Dequeue();
  166. onNext(n1.Value,
  167. n2.Value,
  168. n3.Value,
  169. n4.Value
  170. );
  171. }
  172. }
  173. }
  174. }
  175. #if !NO_LARGEARITY
  176. internal class ActivePlan<T1, T2, T3, T4, T5> : ActivePlan
  177. {
  178. private readonly Action<T1, T2, T3, T4, T5> onNext;
  179. private readonly Action onCompleted;
  180. private readonly JoinObserver<T1> first;
  181. private readonly JoinObserver<T2> second;
  182. private readonly JoinObserver<T3> third;
  183. private readonly JoinObserver<T4> fourth;
  184. private readonly JoinObserver<T5> fifth;
  185. internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
  186. JoinObserver<T4> fourth, JoinObserver<T5> fifth, Action<T1, T2, T3, T4, T5> onNext, Action onCompleted)
  187. {
  188. this.onNext = onNext;
  189. this.onCompleted = onCompleted;
  190. this.first = first;
  191. this.second = second;
  192. this.third = third;
  193. this.fourth = fourth;
  194. this.fifth = fifth;
  195. AddJoinObserver(first);
  196. AddJoinObserver(second);
  197. AddJoinObserver(third);
  198. AddJoinObserver(fourth);
  199. AddJoinObserver(fifth);
  200. }
  201. internal override void Match()
  202. {
  203. if (first.Queue.Count > 0
  204. && second.Queue.Count > 0
  205. && third.Queue.Count > 0
  206. && fourth.Queue.Count > 0
  207. && fifth.Queue.Count > 0)
  208. {
  209. var n1 = first.Queue.Peek();
  210. var n2 = second.Queue.Peek();
  211. var n3 = third.Queue.Peek();
  212. var n4 = fourth.Queue.Peek();
  213. var n5 = fifth.Queue.Peek();
  214. if ( n1.Kind == NotificationKind.OnCompleted
  215. || n2.Kind == NotificationKind.OnCompleted
  216. || n3.Kind == NotificationKind.OnCompleted
  217. || n4.Kind == NotificationKind.OnCompleted
  218. || n5.Kind == NotificationKind.OnCompleted)
  219. onCompleted();
  220. else
  221. {
  222. Dequeue();
  223. onNext(n1.Value,
  224. n2.Value,
  225. n3.Value,
  226. n4.Value,
  227. n5.Value
  228. );
  229. }
  230. }
  231. }
  232. }
  233. internal class ActivePlan<T1, T2, T3, T4, T5, T6> : ActivePlan
  234. {
  235. private readonly Action<T1, T2, T3, T4, T5, T6> onNext;
  236. private readonly Action onCompleted;
  237. private readonly JoinObserver<T1> first;
  238. private readonly JoinObserver<T2> second;
  239. private readonly JoinObserver<T3> third;
  240. private readonly JoinObserver<T4> fourth;
  241. private readonly JoinObserver<T5> fifth;
  242. private readonly JoinObserver<T6> sixth;
  243. internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
  244. JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth,
  245. Action<T1, T2, T3, T4, T5, T6> onNext, Action onCompleted)
  246. {
  247. this.onNext = onNext;
  248. this.onCompleted = onCompleted;
  249. this.first = first;
  250. this.second = second;
  251. this.third = third;
  252. this.fourth = fourth;
  253. this.fifth = fifth;
  254. this.sixth = sixth;
  255. AddJoinObserver(first);
  256. AddJoinObserver(second);
  257. AddJoinObserver(third);
  258. AddJoinObserver(fourth);
  259. AddJoinObserver(fifth);
  260. AddJoinObserver(sixth);
  261. }
  262. internal override void Match()
  263. {
  264. if (first.Queue.Count > 0
  265. && second.Queue.Count > 0
  266. && third.Queue.Count > 0
  267. && fourth.Queue.Count > 0
  268. && fifth.Queue.Count > 0
  269. && sixth.Queue.Count > 0)
  270. {
  271. var n1 = first.Queue.Peek();
  272. var n2 = second.Queue.Peek();
  273. var n3 = third.Queue.Peek();
  274. var n4 = fourth.Queue.Peek();
  275. var n5 = fifth.Queue.Peek();
  276. var n6 = sixth.Queue.Peek();
  277. if ( n1.Kind == NotificationKind.OnCompleted
  278. || n2.Kind == NotificationKind.OnCompleted
  279. || n3.Kind == NotificationKind.OnCompleted
  280. || n4.Kind == NotificationKind.OnCompleted
  281. || n5.Kind == NotificationKind.OnCompleted
  282. || n6.Kind == NotificationKind.OnCompleted)
  283. onCompleted();
  284. else
  285. {
  286. Dequeue();
  287. onNext(n1.Value,
  288. n2.Value,
  289. n3.Value,
  290. n4.Value,
  291. n5.Value,
  292. n6.Value
  293. );
  294. }
  295. }
  296. }
  297. }
  298. internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7> : ActivePlan
  299. {
  300. private readonly Action<T1, T2, T3, T4, T5, T6, T7> onNext;
  301. private readonly Action onCompleted;
  302. private readonly JoinObserver<T1> first;
  303. private readonly JoinObserver<T2> second;
  304. private readonly JoinObserver<T3> third;
  305. private readonly JoinObserver<T4> fourth;
  306. private readonly JoinObserver<T5> fifth;
  307. private readonly JoinObserver<T6> sixth;
  308. private readonly JoinObserver<T7> seventh;
  309. internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
  310. JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh,
  311. Action<T1, T2, T3, T4, T5, T6, T7> onNext, Action onCompleted)
  312. {
  313. this.onNext = onNext;
  314. this.onCompleted = onCompleted;
  315. this.first = first;
  316. this.second = second;
  317. this.third = third;
  318. this.fourth = fourth;
  319. this.fifth = fifth;
  320. this.sixth = sixth;
  321. this.seventh = seventh;
  322. AddJoinObserver(first);
  323. AddJoinObserver(second);
  324. AddJoinObserver(third);
  325. AddJoinObserver(fourth);
  326. AddJoinObserver(fifth);
  327. AddJoinObserver(sixth);
  328. AddJoinObserver(seventh);
  329. }
  330. internal override void Match()
  331. {
  332. if (first.Queue.Count > 0
  333. && second.Queue.Count > 0
  334. && third.Queue.Count > 0
  335. && fourth.Queue.Count > 0
  336. && fifth.Queue.Count > 0
  337. && sixth.Queue.Count > 0
  338. && seventh.Queue.Count > 0)
  339. {
  340. var n1 = first.Queue.Peek();
  341. var n2 = second.Queue.Peek();
  342. var n3 = third.Queue.Peek();
  343. var n4 = fourth.Queue.Peek();
  344. var n5 = fifth.Queue.Peek();
  345. var n6 = sixth.Queue.Peek();
  346. var n7 = seventh.Queue.Peek();
  347. if ( n1.Kind == NotificationKind.OnCompleted
  348. || n2.Kind == NotificationKind.OnCompleted
  349. || n3.Kind == NotificationKind.OnCompleted
  350. || n4.Kind == NotificationKind.OnCompleted
  351. || n5.Kind == NotificationKind.OnCompleted
  352. || n6.Kind == NotificationKind.OnCompleted
  353. || n7.Kind == NotificationKind.OnCompleted)
  354. onCompleted();
  355. else
  356. {
  357. Dequeue();
  358. onNext(n1.Value,
  359. n2.Value,
  360. n3.Value,
  361. n4.Value,
  362. n5.Value,
  363. n6.Value,
  364. n7.Value
  365. );
  366. }
  367. }
  368. }
  369. }
  370. internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8> : ActivePlan
  371. {
  372. private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8> onNext;
  373. private readonly Action onCompleted;
  374. private readonly JoinObserver<T1> first;
  375. private readonly JoinObserver<T2> second;
  376. private readonly JoinObserver<T3> third;
  377. private readonly JoinObserver<T4> fourth;
  378. private readonly JoinObserver<T5> fifth;
  379. private readonly JoinObserver<T6> sixth;
  380. private readonly JoinObserver<T7> seventh;
  381. private readonly JoinObserver<T8> eighth;
  382. internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
  383. JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh,
  384. JoinObserver<T8> eighth,
  385. Action<T1, T2, T3, T4, T5, T6, T7, T8> onNext, Action onCompleted)
  386. {
  387. this.onNext = onNext;
  388. this.onCompleted = onCompleted;
  389. this.first = first;
  390. this.second = second;
  391. this.third = third;
  392. this.fourth = fourth;
  393. this.fifth = fifth;
  394. this.sixth = sixth;
  395. this.seventh = seventh;
  396. this.eighth = eighth;
  397. AddJoinObserver(first);
  398. AddJoinObserver(second);
  399. AddJoinObserver(third);
  400. AddJoinObserver(fourth);
  401. AddJoinObserver(fifth);
  402. AddJoinObserver(sixth);
  403. AddJoinObserver(seventh);
  404. AddJoinObserver(eighth);
  405. }
  406. internal override void Match()
  407. {
  408. if (first.Queue.Count > 0
  409. && second.Queue.Count > 0
  410. && third.Queue.Count > 0
  411. && fourth.Queue.Count > 0
  412. && fifth.Queue.Count > 0
  413. && sixth.Queue.Count > 0
  414. && seventh.Queue.Count > 0
  415. && eighth.Queue.Count > 0)
  416. {
  417. var n1 = first.Queue.Peek();
  418. var n2 = second.Queue.Peek();
  419. var n3 = third.Queue.Peek();
  420. var n4 = fourth.Queue.Peek();
  421. var n5 = fifth.Queue.Peek();
  422. var n6 = sixth.Queue.Peek();
  423. var n7 = seventh.Queue.Peek();
  424. var n8 = eighth.Queue.Peek();
  425. if ( n1.Kind == NotificationKind.OnCompleted
  426. || n2.Kind == NotificationKind.OnCompleted
  427. || n3.Kind == NotificationKind.OnCompleted
  428. || n4.Kind == NotificationKind.OnCompleted
  429. || n5.Kind == NotificationKind.OnCompleted
  430. || n6.Kind == NotificationKind.OnCompleted
  431. || n7.Kind == NotificationKind.OnCompleted
  432. || n8.Kind == NotificationKind.OnCompleted
  433. )
  434. onCompleted();
  435. else
  436. {
  437. Dequeue();
  438. onNext(n1.Value,
  439. n2.Value,
  440. n3.Value,
  441. n4.Value,
  442. n5.Value,
  443. n6.Value,
  444. n7.Value,
  445. n8.Value
  446. );
  447. }
  448. }
  449. }
  450. }
  451. internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9> : ActivePlan
  452. {
  453. private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9> onNext;
  454. private readonly Action onCompleted;
  455. private readonly JoinObserver<T1> first;
  456. private readonly JoinObserver<T2> second;
  457. private readonly JoinObserver<T3> third;
  458. private readonly JoinObserver<T4> fourth;
  459. private readonly JoinObserver<T5> fifth;
  460. private readonly JoinObserver<T6> sixth;
  461. private readonly JoinObserver<T7> seventh;
  462. private readonly JoinObserver<T8> eighth;
  463. private readonly JoinObserver<T9> ninth;
  464. internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
  465. JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh,
  466. JoinObserver<T8> eighth, JoinObserver<T9> ninth,
  467. Action<T1, T2, T3, T4, T5, T6, T7, T8, T9> onNext, Action onCompleted)
  468. {
  469. this.onNext = onNext;
  470. this.onCompleted = onCompleted;
  471. this.first = first;
  472. this.second = second;
  473. this.third = third;
  474. this.fourth = fourth;
  475. this.fifth = fifth;
  476. this.sixth = sixth;
  477. this.seventh = seventh;
  478. this.eighth = eighth;
  479. this.ninth = ninth;
  480. AddJoinObserver(first);
  481. AddJoinObserver(second);
  482. AddJoinObserver(third);
  483. AddJoinObserver(fourth);
  484. AddJoinObserver(fifth);
  485. AddJoinObserver(sixth);
  486. AddJoinObserver(seventh);
  487. AddJoinObserver(eighth);
  488. AddJoinObserver(ninth);
  489. }
  490. internal override void Match()
  491. {
  492. if (first.Queue.Count > 0
  493. && second.Queue.Count > 0
  494. && third.Queue.Count > 0
  495. && fourth.Queue.Count > 0
  496. && fifth.Queue.Count > 0
  497. && sixth.Queue.Count > 0
  498. && seventh.Queue.Count > 0
  499. && eighth.Queue.Count > 0
  500. && ninth.Queue.Count > 0
  501. )
  502. {
  503. var n1 = first.Queue.Peek();
  504. var n2 = second.Queue.Peek();
  505. var n3 = third.Queue.Peek();
  506. var n4 = fourth.Queue.Peek();
  507. var n5 = fifth.Queue.Peek();
  508. var n6 = sixth.Queue.Peek();
  509. var n7 = seventh.Queue.Peek();
  510. var n8 = eighth.Queue.Peek();
  511. var n9 = ninth.Queue.Peek();
  512. if ( n1.Kind == NotificationKind.OnCompleted
  513. || n2.Kind == NotificationKind.OnCompleted
  514. || n3.Kind == NotificationKind.OnCompleted
  515. || n4.Kind == NotificationKind.OnCompleted
  516. || n5.Kind == NotificationKind.OnCompleted
  517. || n6.Kind == NotificationKind.OnCompleted
  518. || n7.Kind == NotificationKind.OnCompleted
  519. || n8.Kind == NotificationKind.OnCompleted
  520. || n9.Kind == NotificationKind.OnCompleted
  521. )
  522. onCompleted();
  523. else
  524. {
  525. Dequeue();
  526. onNext(n1.Value,
  527. n2.Value,
  528. n3.Value,
  529. n4.Value,
  530. n5.Value,
  531. n6.Value,
  532. n7.Value,
  533. n8.Value,
  534. n9.Value
  535. );
  536. }
  537. }
  538. }
  539. }
  540. internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> : ActivePlan
  541. {
  542. private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> onNext;
  543. private readonly Action onCompleted;
  544. private readonly JoinObserver<T1> first;
  545. private readonly JoinObserver<T2> second;
  546. private readonly JoinObserver<T3> third;
  547. private readonly JoinObserver<T4> fourth;
  548. private readonly JoinObserver<T5> fifth;
  549. private readonly JoinObserver<T6> sixth;
  550. private readonly JoinObserver<T7> seventh;
  551. private readonly JoinObserver<T8> eighth;
  552. private readonly JoinObserver<T9> ninth;
  553. private readonly JoinObserver<T10> tenth;
  554. internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
  555. JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh,
  556. JoinObserver<T8> eighth, JoinObserver<T9> ninth, JoinObserver<T10> tenth,
  557. Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> onNext, Action onCompleted)
  558. {
  559. this.onNext = onNext;
  560. this.onCompleted = onCompleted;
  561. this.first = first;
  562. this.second = second;
  563. this.third = third;
  564. this.fourth = fourth;
  565. this.fifth = fifth;
  566. this.sixth = sixth;
  567. this.seventh = seventh;
  568. this.eighth = eighth;
  569. this.ninth = ninth;
  570. this.tenth = tenth;
  571. AddJoinObserver(first);
  572. AddJoinObserver(second);
  573. AddJoinObserver(third);
  574. AddJoinObserver(fourth);
  575. AddJoinObserver(fifth);
  576. AddJoinObserver(sixth);
  577. AddJoinObserver(seventh);
  578. AddJoinObserver(eighth);
  579. AddJoinObserver(ninth);
  580. AddJoinObserver(tenth);
  581. }
  582. internal override void Match()
  583. {
  584. if (first.Queue.Count > 0
  585. && second.Queue.Count > 0
  586. && third.Queue.Count > 0
  587. && fourth.Queue.Count > 0
  588. && fifth.Queue.Count > 0
  589. && sixth.Queue.Count > 0
  590. && seventh.Queue.Count > 0
  591. && eighth.Queue.Count > 0
  592. && ninth.Queue.Count > 0
  593. && tenth.Queue.Count > 0
  594. )
  595. {
  596. var n1 = first.Queue.Peek();
  597. var n2 = second.Queue.Peek();
  598. var n3 = third.Queue.Peek();
  599. var n4 = fourth.Queue.Peek();
  600. var n5 = fifth.Queue.Peek();
  601. var n6 = sixth.Queue.Peek();
  602. var n7 = seventh.Queue.Peek();
  603. var n8 = eighth.Queue.Peek();
  604. var n9 = ninth.Queue.Peek();
  605. var n10 = tenth.Queue.Peek();
  606. if ( n1.Kind == NotificationKind.OnCompleted
  607. || n2.Kind == NotificationKind.OnCompleted
  608. || n3.Kind == NotificationKind.OnCompleted
  609. || n4.Kind == NotificationKind.OnCompleted
  610. || n5.Kind == NotificationKind.OnCompleted
  611. || n6.Kind == NotificationKind.OnCompleted
  612. || n7.Kind == NotificationKind.OnCompleted
  613. || n8.Kind == NotificationKind.OnCompleted
  614. || n9.Kind == NotificationKind.OnCompleted
  615. || n10.Kind == NotificationKind.OnCompleted
  616. )
  617. onCompleted();
  618. else
  619. {
  620. Dequeue();
  621. onNext(n1.Value,
  622. n2.Value,
  623. n3.Value,
  624. n4.Value,
  625. n5.Value,
  626. n6.Value,
  627. n7.Value,
  628. n8.Value,
  629. n9.Value,
  630. n10.Value
  631. );
  632. }
  633. }
  634. }
  635. }
  636. internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> : ActivePlan
  637. {
  638. private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> onNext;
  639. private readonly Action onCompleted;
  640. private readonly JoinObserver<T1> first;
  641. private readonly JoinObserver<T2> second;
  642. private readonly JoinObserver<T3> third;
  643. private readonly JoinObserver<T4> fourth;
  644. private readonly JoinObserver<T5> fifth;
  645. private readonly JoinObserver<T6> sixth;
  646. private readonly JoinObserver<T7> seventh;
  647. private readonly JoinObserver<T8> eighth;
  648. private readonly JoinObserver<T9> ninth;
  649. private readonly JoinObserver<T10> tenth;
  650. private readonly JoinObserver<T11> eleventh;
  651. internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
  652. JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh,
  653. JoinObserver<T8> eighth, JoinObserver<T9> ninth, JoinObserver<T10> tenth, JoinObserver<T11> eleventh,
  654. Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> onNext, Action onCompleted)
  655. {
  656. this.onNext = onNext;
  657. this.onCompleted = onCompleted;
  658. this.first = first;
  659. this.second = second;
  660. this.third = third;
  661. this.fourth = fourth;
  662. this.fifth = fifth;
  663. this.sixth = sixth;
  664. this.seventh = seventh;
  665. this.eighth = eighth;
  666. this.ninth = ninth;
  667. this.tenth = tenth;
  668. this.eleventh = eleventh;
  669. AddJoinObserver(first);
  670. AddJoinObserver(second);
  671. AddJoinObserver(third);
  672. AddJoinObserver(fourth);
  673. AddJoinObserver(fifth);
  674. AddJoinObserver(sixth);
  675. AddJoinObserver(seventh);
  676. AddJoinObserver(eighth);
  677. AddJoinObserver(ninth);
  678. AddJoinObserver(tenth);
  679. AddJoinObserver(eleventh);
  680. }
  681. internal override void Match()
  682. {
  683. if (first.Queue.Count > 0
  684. && second.Queue.Count > 0
  685. && third.Queue.Count > 0
  686. && fourth.Queue.Count > 0
  687. && fifth.Queue.Count > 0
  688. && sixth.Queue.Count > 0
  689. && seventh.Queue.Count > 0
  690. && eighth.Queue.Count > 0
  691. && ninth.Queue.Count > 0
  692. && tenth.Queue.Count > 0
  693. && eleventh.Queue.Count > 0
  694. )
  695. {
  696. var n1 = first.Queue.Peek();
  697. var n2 = second.Queue.Peek();
  698. var n3 = third.Queue.Peek();
  699. var n4 = fourth.Queue.Peek();
  700. var n5 = fifth.Queue.Peek();
  701. var n6 = sixth.Queue.Peek();
  702. var n7 = seventh.Queue.Peek();
  703. var n8 = eighth.Queue.Peek();
  704. var n9 = ninth.Queue.Peek();
  705. var n10 = tenth.Queue.Peek();
  706. var n11 = eleventh.Queue.Peek();
  707. if ( n1.Kind == NotificationKind.OnCompleted
  708. || n2.Kind == NotificationKind.OnCompleted
  709. || n3.Kind == NotificationKind.OnCompleted
  710. || n4.Kind == NotificationKind.OnCompleted
  711. || n5.Kind == NotificationKind.OnCompleted
  712. || n6.Kind == NotificationKind.OnCompleted
  713. || n7.Kind == NotificationKind.OnCompleted
  714. || n8.Kind == NotificationKind.OnCompleted
  715. || n9.Kind == NotificationKind.OnCompleted
  716. || n10.Kind == NotificationKind.OnCompleted
  717. || n11.Kind == NotificationKind.OnCompleted
  718. )
  719. onCompleted();
  720. else
  721. {
  722. Dequeue();
  723. onNext(n1.Value,
  724. n2.Value,
  725. n3.Value,
  726. n4.Value,
  727. n5.Value,
  728. n6.Value,
  729. n7.Value,
  730. n8.Value,
  731. n9.Value,
  732. n10.Value,
  733. n11.Value
  734. );
  735. }
  736. }
  737. }
  738. }
  739. internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> : ActivePlan
  740. {
  741. private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> onNext;
  742. private readonly Action onCompleted;
  743. private readonly JoinObserver<T1> first;
  744. private readonly JoinObserver<T2> second;
  745. private readonly JoinObserver<T3> third;
  746. private readonly JoinObserver<T4> fourth;
  747. private readonly JoinObserver<T5> fifth;
  748. private readonly JoinObserver<T6> sixth;
  749. private readonly JoinObserver<T7> seventh;
  750. private readonly JoinObserver<T8> eighth;
  751. private readonly JoinObserver<T9> ninth;
  752. private readonly JoinObserver<T10> tenth;
  753. private readonly JoinObserver<T11> eleventh;
  754. private readonly JoinObserver<T12> twelfth;
  755. internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
  756. JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh,
  757. JoinObserver<T8> eighth, JoinObserver<T9> ninth, JoinObserver<T10> tenth, JoinObserver<T11> eleventh,
  758. JoinObserver<T12> twelfth,
  759. Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> onNext, Action onCompleted)
  760. {
  761. this.onNext = onNext;
  762. this.onCompleted = onCompleted;
  763. this.first = first;
  764. this.second = second;
  765. this.third = third;
  766. this.fourth = fourth;
  767. this.fifth = fifth;
  768. this.sixth = sixth;
  769. this.seventh = seventh;
  770. this.eighth = eighth;
  771. this.ninth = ninth;
  772. this.tenth = tenth;
  773. this.eleventh = eleventh;
  774. this.twelfth = twelfth;
  775. AddJoinObserver(first);
  776. AddJoinObserver(second);
  777. AddJoinObserver(third);
  778. AddJoinObserver(fourth);
  779. AddJoinObserver(fifth);
  780. AddJoinObserver(sixth);
  781. AddJoinObserver(seventh);
  782. AddJoinObserver(eighth);
  783. AddJoinObserver(ninth);
  784. AddJoinObserver(tenth);
  785. AddJoinObserver(eleventh);
  786. AddJoinObserver(twelfth);
  787. }
  788. internal override void Match()
  789. {
  790. if (first.Queue.Count > 0
  791. && second.Queue.Count > 0
  792. && third.Queue.Count > 0
  793. && fourth.Queue.Count > 0
  794. && fifth.Queue.Count > 0
  795. && sixth.Queue.Count > 0
  796. && seventh.Queue.Count > 0
  797. && eighth.Queue.Count > 0
  798. && ninth.Queue.Count > 0
  799. && tenth.Queue.Count > 0
  800. && eleventh.Queue.Count > 0
  801. && twelfth.Queue.Count > 0
  802. )
  803. {
  804. var n1 = first.Queue.Peek();
  805. var n2 = second.Queue.Peek();
  806. var n3 = third.Queue.Peek();
  807. var n4 = fourth.Queue.Peek();
  808. var n5 = fifth.Queue.Peek();
  809. var n6 = sixth.Queue.Peek();
  810. var n7 = seventh.Queue.Peek();
  811. var n8 = eighth.Queue.Peek();
  812. var n9 = ninth.Queue.Peek();
  813. var n10 = tenth.Queue.Peek();
  814. var n11 = eleventh.Queue.Peek();
  815. var n12 = twelfth.Queue.Peek();
  816. if ( n1.Kind == NotificationKind.OnCompleted
  817. || n2.Kind == NotificationKind.OnCompleted
  818. || n3.Kind == NotificationKind.OnCompleted
  819. || n4.Kind == NotificationKind.OnCompleted
  820. || n5.Kind == NotificationKind.OnCompleted
  821. || n6.Kind == NotificationKind.OnCompleted
  822. || n7.Kind == NotificationKind.OnCompleted
  823. || n8.Kind == NotificationKind.OnCompleted
  824. || n9.Kind == NotificationKind.OnCompleted
  825. || n10.Kind == NotificationKind.OnCompleted
  826. || n11.Kind == NotificationKind.OnCompleted
  827. || n12.Kind == NotificationKind.OnCompleted
  828. )
  829. onCompleted();
  830. else
  831. {
  832. Dequeue();
  833. onNext(n1.Value,
  834. n2.Value,
  835. n3.Value,
  836. n4.Value,
  837. n5.Value,
  838. n6.Value,
  839. n7.Value,
  840. n8.Value,
  841. n9.Value,
  842. n10.Value,
  843. n11.Value,
  844. n12.Value
  845. );
  846. }
  847. }
  848. }
  849. }
  850. internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> : ActivePlan
  851. {
  852. private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> onNext;
  853. private readonly Action onCompleted;
  854. private readonly JoinObserver<T1> first;
  855. private readonly JoinObserver<T2> second;
  856. private readonly JoinObserver<T3> third;
  857. private readonly JoinObserver<T4> fourth;
  858. private readonly JoinObserver<T5> fifth;
  859. private readonly JoinObserver<T6> sixth;
  860. private readonly JoinObserver<T7> seventh;
  861. private readonly JoinObserver<T8> eighth;
  862. private readonly JoinObserver<T9> ninth;
  863. private readonly JoinObserver<T10> tenth;
  864. private readonly JoinObserver<T11> eleventh;
  865. private readonly JoinObserver<T12> twelfth;
  866. private readonly JoinObserver<T13> thirteenth;
  867. internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
  868. JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh,
  869. JoinObserver<T8> eighth, JoinObserver<T9> ninth, JoinObserver<T10> tenth, JoinObserver<T11> eleventh,
  870. JoinObserver<T12> twelfth, JoinObserver<T13> thirteenth,
  871. Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> onNext, Action onCompleted)
  872. {
  873. this.onNext = onNext;
  874. this.onCompleted = onCompleted;
  875. this.first = first;
  876. this.second = second;
  877. this.third = third;
  878. this.fourth = fourth;
  879. this.fifth = fifth;
  880. this.sixth = sixth;
  881. this.seventh = seventh;
  882. this.eighth = eighth;
  883. this.ninth = ninth;
  884. this.tenth = tenth;
  885. this.eleventh = eleventh;
  886. this.twelfth = twelfth;
  887. this.thirteenth = thirteenth;
  888. AddJoinObserver(first);
  889. AddJoinObserver(second);
  890. AddJoinObserver(third);
  891. AddJoinObserver(fourth);
  892. AddJoinObserver(fifth);
  893. AddJoinObserver(sixth);
  894. AddJoinObserver(seventh);
  895. AddJoinObserver(eighth);
  896. AddJoinObserver(ninth);
  897. AddJoinObserver(tenth);
  898. AddJoinObserver(eleventh);
  899. AddJoinObserver(twelfth);
  900. AddJoinObserver(thirteenth);
  901. }
  902. internal override void Match()
  903. {
  904. if (first.Queue.Count > 0
  905. && second.Queue.Count > 0
  906. && third.Queue.Count > 0
  907. && fourth.Queue.Count > 0
  908. && fifth.Queue.Count > 0
  909. && sixth.Queue.Count > 0
  910. && seventh.Queue.Count > 0
  911. && eighth.Queue.Count > 0
  912. && ninth.Queue.Count > 0
  913. && tenth.Queue.Count > 0
  914. && eleventh.Queue.Count > 0
  915. && twelfth.Queue.Count > 0
  916. && thirteenth.Queue.Count > 0
  917. )
  918. {
  919. var n1 = first.Queue.Peek();
  920. var n2 = second.Queue.Peek();
  921. var n3 = third.Queue.Peek();
  922. var n4 = fourth.Queue.Peek();
  923. var n5 = fifth.Queue.Peek();
  924. var n6 = sixth.Queue.Peek();
  925. var n7 = seventh.Queue.Peek();
  926. var n8 = eighth.Queue.Peek();
  927. var n9 = ninth.Queue.Peek();
  928. var n10 = tenth.Queue.Peek();
  929. var n11 = eleventh.Queue.Peek();
  930. var n12 = twelfth.Queue.Peek();
  931. var n13 = thirteenth.Queue.Peek();
  932. if ( n1.Kind == NotificationKind.OnCompleted
  933. || n2.Kind == NotificationKind.OnCompleted
  934. || n3.Kind == NotificationKind.OnCompleted
  935. || n4.Kind == NotificationKind.OnCompleted
  936. || n5.Kind == NotificationKind.OnCompleted
  937. || n6.Kind == NotificationKind.OnCompleted
  938. || n7.Kind == NotificationKind.OnCompleted
  939. || n8.Kind == NotificationKind.OnCompleted
  940. || n9.Kind == NotificationKind.OnCompleted
  941. || n10.Kind == NotificationKind.OnCompleted
  942. || n11.Kind == NotificationKind.OnCompleted
  943. || n12.Kind == NotificationKind.OnCompleted
  944. || n13.Kind == NotificationKind.OnCompleted
  945. )
  946. onCompleted();
  947. else
  948. {
  949. Dequeue();
  950. onNext(n1.Value,
  951. n2.Value,
  952. n3.Value,
  953. n4.Value,
  954. n5.Value,
  955. n6.Value,
  956. n7.Value,
  957. n8.Value,
  958. n9.Value,
  959. n10.Value,
  960. n11.Value,
  961. n12.Value,
  962. n13.Value
  963. );
  964. }
  965. }
  966. }
  967. }
  968. internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> : ActivePlan
  969. {
  970. private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> onNext;
  971. private readonly Action onCompleted;
  972. private readonly JoinObserver<T1> first;
  973. private readonly JoinObserver<T2> second;
  974. private readonly JoinObserver<T3> third;
  975. private readonly JoinObserver<T4> fourth;
  976. private readonly JoinObserver<T5> fifth;
  977. private readonly JoinObserver<T6> sixth;
  978. private readonly JoinObserver<T7> seventh;
  979. private readonly JoinObserver<T8> eighth;
  980. private readonly JoinObserver<T9> ninth;
  981. private readonly JoinObserver<T10> tenth;
  982. private readonly JoinObserver<T11> eleventh;
  983. private readonly JoinObserver<T12> twelfth;
  984. private readonly JoinObserver<T13> thirteenth;
  985. private readonly JoinObserver<T14> fourteenth;
  986. internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
  987. JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh,
  988. JoinObserver<T8> eighth, JoinObserver<T9> ninth, JoinObserver<T10> tenth, JoinObserver<T11> eleventh,
  989. JoinObserver<T12> twelfth, JoinObserver<T13> thirteenth, JoinObserver<T14> fourteenth,
  990. Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> onNext, Action onCompleted)
  991. {
  992. this.onNext = onNext;
  993. this.onCompleted = onCompleted;
  994. this.first = first;
  995. this.second = second;
  996. this.third = third;
  997. this.fourth = fourth;
  998. this.fifth = fifth;
  999. this.sixth = sixth;
  1000. this.seventh = seventh;
  1001. this.eighth = eighth;
  1002. this.ninth = ninth;
  1003. this.tenth = tenth;
  1004. this.eleventh = eleventh;
  1005. this.twelfth = twelfth;
  1006. this.thirteenth = thirteenth;
  1007. this.fourteenth = fourteenth;
  1008. AddJoinObserver(first);
  1009. AddJoinObserver(second);
  1010. AddJoinObserver(third);
  1011. AddJoinObserver(fourth);
  1012. AddJoinObserver(fifth);
  1013. AddJoinObserver(sixth);
  1014. AddJoinObserver(seventh);
  1015. AddJoinObserver(eighth);
  1016. AddJoinObserver(ninth);
  1017. AddJoinObserver(tenth);
  1018. AddJoinObserver(eleventh);
  1019. AddJoinObserver(twelfth);
  1020. AddJoinObserver(thirteenth);
  1021. AddJoinObserver(fourteenth);
  1022. }
  1023. internal override void Match()
  1024. {
  1025. if (first.Queue.Count > 0
  1026. && second.Queue.Count > 0
  1027. && third.Queue.Count > 0
  1028. && fourth.Queue.Count > 0
  1029. && fifth.Queue.Count > 0
  1030. && sixth.Queue.Count > 0
  1031. && seventh.Queue.Count > 0
  1032. && eighth.Queue.Count > 0
  1033. && ninth.Queue.Count > 0
  1034. && tenth.Queue.Count > 0
  1035. && eleventh.Queue.Count > 0
  1036. && twelfth.Queue.Count > 0
  1037. && thirteenth.Queue.Count > 0
  1038. && fourteenth.Queue.Count > 0
  1039. )
  1040. {
  1041. var n1 = first.Queue.Peek();
  1042. var n2 = second.Queue.Peek();
  1043. var n3 = third.Queue.Peek();
  1044. var n4 = fourth.Queue.Peek();
  1045. var n5 = fifth.Queue.Peek();
  1046. var n6 = sixth.Queue.Peek();
  1047. var n7 = seventh.Queue.Peek();
  1048. var n8 = eighth.Queue.Peek();
  1049. var n9 = ninth.Queue.Peek();
  1050. var n10 = tenth.Queue.Peek();
  1051. var n11 = eleventh.Queue.Peek();
  1052. var n12 = twelfth.Queue.Peek();
  1053. var n13 = thirteenth.Queue.Peek();
  1054. var n14 = fourteenth.Queue.Peek();
  1055. if ( n1.Kind == NotificationKind.OnCompleted
  1056. || n2.Kind == NotificationKind.OnCompleted
  1057. || n3.Kind == NotificationKind.OnCompleted
  1058. || n4.Kind == NotificationKind.OnCompleted
  1059. || n5.Kind == NotificationKind.OnCompleted
  1060. || n6.Kind == NotificationKind.OnCompleted
  1061. || n7.Kind == NotificationKind.OnCompleted
  1062. || n8.Kind == NotificationKind.OnCompleted
  1063. || n9.Kind == NotificationKind.OnCompleted
  1064. || n10.Kind == NotificationKind.OnCompleted
  1065. || n11.Kind == NotificationKind.OnCompleted
  1066. || n12.Kind == NotificationKind.OnCompleted
  1067. || n13.Kind == NotificationKind.OnCompleted
  1068. || n14.Kind == NotificationKind.OnCompleted
  1069. )
  1070. onCompleted();
  1071. else
  1072. {
  1073. Dequeue();
  1074. onNext(n1.Value,
  1075. n2.Value,
  1076. n3.Value,
  1077. n4.Value,
  1078. n5.Value,
  1079. n6.Value,
  1080. n7.Value,
  1081. n8.Value,
  1082. n9.Value,
  1083. n10.Value,
  1084. n11.Value,
  1085. n12.Value,
  1086. n13.Value,
  1087. n14.Value
  1088. );
  1089. }
  1090. }
  1091. }
  1092. }
  1093. internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> : ActivePlan
  1094. {
  1095. private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> onNext;
  1096. private readonly Action onCompleted;
  1097. private readonly JoinObserver<T1> first;
  1098. private readonly JoinObserver<T2> second;
  1099. private readonly JoinObserver<T3> third;
  1100. private readonly JoinObserver<T4> fourth;
  1101. private readonly JoinObserver<T5> fifth;
  1102. private readonly JoinObserver<T6> sixth;
  1103. private readonly JoinObserver<T7> seventh;
  1104. private readonly JoinObserver<T8> eighth;
  1105. private readonly JoinObserver<T9> ninth;
  1106. private readonly JoinObserver<T10> tenth;
  1107. private readonly JoinObserver<T11> eleventh;
  1108. private readonly JoinObserver<T12> twelfth;
  1109. private readonly JoinObserver<T13> thirteenth;
  1110. private readonly JoinObserver<T14> fourteenth;
  1111. private readonly JoinObserver<T15> fifteenth;
  1112. internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
  1113. JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh,
  1114. JoinObserver<T8> eighth, JoinObserver<T9> ninth, JoinObserver<T10> tenth, JoinObserver<T11> eleventh,
  1115. JoinObserver<T12> twelfth, JoinObserver<T13> thirteenth, JoinObserver<T14> fourteenth,
  1116. JoinObserver<T15> fifteenth,
  1117. Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> onNext, Action onCompleted)
  1118. {
  1119. this.onNext = onNext;
  1120. this.onCompleted = onCompleted;
  1121. this.first = first;
  1122. this.second = second;
  1123. this.third = third;
  1124. this.fourth = fourth;
  1125. this.fifth = fifth;
  1126. this.sixth = sixth;
  1127. this.seventh = seventh;
  1128. this.eighth = eighth;
  1129. this.ninth = ninth;
  1130. this.tenth = tenth;
  1131. this.eleventh = eleventh;
  1132. this.twelfth = twelfth;
  1133. this.thirteenth = thirteenth;
  1134. this.fourteenth = fourteenth;
  1135. this.fifteenth = fifteenth;
  1136. AddJoinObserver(first);
  1137. AddJoinObserver(second);
  1138. AddJoinObserver(third);
  1139. AddJoinObserver(fourth);
  1140. AddJoinObserver(fifth);
  1141. AddJoinObserver(sixth);
  1142. AddJoinObserver(seventh);
  1143. AddJoinObserver(eighth);
  1144. AddJoinObserver(ninth);
  1145. AddJoinObserver(tenth);
  1146. AddJoinObserver(eleventh);
  1147. AddJoinObserver(twelfth);
  1148. AddJoinObserver(thirteenth);
  1149. AddJoinObserver(fourteenth);
  1150. AddJoinObserver(fifteenth);
  1151. }
  1152. internal override void Match()
  1153. {
  1154. if (first.Queue.Count > 0
  1155. && second.Queue.Count > 0
  1156. && third.Queue.Count > 0
  1157. && fourth.Queue.Count > 0
  1158. && fifth.Queue.Count > 0
  1159. && sixth.Queue.Count > 0
  1160. && seventh.Queue.Count > 0
  1161. && eighth.Queue.Count > 0
  1162. && ninth.Queue.Count > 0
  1163. && tenth.Queue.Count > 0
  1164. && eleventh.Queue.Count > 0
  1165. && twelfth.Queue.Count > 0
  1166. && thirteenth.Queue.Count > 0
  1167. && fourteenth.Queue.Count > 0
  1168. && fifteenth.Queue.Count > 0
  1169. )
  1170. {
  1171. var n1 = first.Queue.Peek();
  1172. var n2 = second.Queue.Peek();
  1173. var n3 = third.Queue.Peek();
  1174. var n4 = fourth.Queue.Peek();
  1175. var n5 = fifth.Queue.Peek();
  1176. var n6 = sixth.Queue.Peek();
  1177. var n7 = seventh.Queue.Peek();
  1178. var n8 = eighth.Queue.Peek();
  1179. var n9 = ninth.Queue.Peek();
  1180. var n10 = tenth.Queue.Peek();
  1181. var n11 = eleventh.Queue.Peek();
  1182. var n12 = twelfth.Queue.Peek();
  1183. var n13 = thirteenth.Queue.Peek();
  1184. var n14 = fourteenth.Queue.Peek();
  1185. var n15 = fifteenth.Queue.Peek();
  1186. if ( n1.Kind == NotificationKind.OnCompleted
  1187. || n2.Kind == NotificationKind.OnCompleted
  1188. || n3.Kind == NotificationKind.OnCompleted
  1189. || n4.Kind == NotificationKind.OnCompleted
  1190. || n5.Kind == NotificationKind.OnCompleted
  1191. || n6.Kind == NotificationKind.OnCompleted
  1192. || n7.Kind == NotificationKind.OnCompleted
  1193. || n8.Kind == NotificationKind.OnCompleted
  1194. || n9.Kind == NotificationKind.OnCompleted
  1195. || n10.Kind == NotificationKind.OnCompleted
  1196. || n11.Kind == NotificationKind.OnCompleted
  1197. || n12.Kind == NotificationKind.OnCompleted
  1198. || n13.Kind == NotificationKind.OnCompleted
  1199. || n14.Kind == NotificationKind.OnCompleted
  1200. || n15.Kind == NotificationKind.OnCompleted
  1201. )
  1202. onCompleted();
  1203. else
  1204. {
  1205. Dequeue();
  1206. onNext(n1.Value,
  1207. n2.Value,
  1208. n3.Value,
  1209. n4.Value,
  1210. n5.Value,
  1211. n6.Value,
  1212. n7.Value,
  1213. n8.Value,
  1214. n9.Value,
  1215. n10.Value,
  1216. n11.Value,
  1217. n12.Value,
  1218. n13.Value,
  1219. n14.Value,
  1220. n15.Value
  1221. );
  1222. }
  1223. }
  1224. }
  1225. }
  1226. internal class ActivePlan<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> : ActivePlan
  1227. {
  1228. private readonly Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> onNext;
  1229. private readonly Action onCompleted;
  1230. private readonly JoinObserver<T1> first;
  1231. private readonly JoinObserver<T2> second;
  1232. private readonly JoinObserver<T3> third;
  1233. private readonly JoinObserver<T4> fourth;
  1234. private readonly JoinObserver<T5> fifth;
  1235. private readonly JoinObserver<T6> sixth;
  1236. private readonly JoinObserver<T7> seventh;
  1237. private readonly JoinObserver<T8> eighth;
  1238. private readonly JoinObserver<T9> ninth;
  1239. private readonly JoinObserver<T10> tenth;
  1240. private readonly JoinObserver<T11> eleventh;
  1241. private readonly JoinObserver<T12> twelfth;
  1242. private readonly JoinObserver<T13> thirteenth;
  1243. private readonly JoinObserver<T14> fourteenth;
  1244. private readonly JoinObserver<T15> fifteenth;
  1245. private readonly JoinObserver<T16> sixteenth;
  1246. internal ActivePlan(JoinObserver<T1> first, JoinObserver<T2> second, JoinObserver<T3> third,
  1247. JoinObserver<T4> fourth, JoinObserver<T5> fifth, JoinObserver<T6> sixth, JoinObserver<T7> seventh,
  1248. JoinObserver<T8> eighth, JoinObserver<T9> ninth, JoinObserver<T10> tenth, JoinObserver<T11> eleventh,
  1249. JoinObserver<T12> twelfth, JoinObserver<T13> thirteenth, JoinObserver<T14> fourteenth,
  1250. JoinObserver<T15> fifteenth, JoinObserver<T16> sixteenth,
  1251. Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> onNext, Action onCompleted)
  1252. {
  1253. this.onNext = onNext;
  1254. this.onCompleted = onCompleted;
  1255. this.first = first;
  1256. this.second = second;
  1257. this.third = third;
  1258. this.fourth = fourth;
  1259. this.fifth = fifth;
  1260. this.sixth = sixth;
  1261. this.seventh = seventh;
  1262. this.eighth = eighth;
  1263. this.ninth = ninth;
  1264. this.tenth = tenth;
  1265. this.eleventh = eleventh;
  1266. this.twelfth = twelfth;
  1267. this.thirteenth = thirteenth;
  1268. this.fourteenth = fourteenth;
  1269. this.fifteenth = fifteenth;
  1270. this.sixteenth = sixteenth;
  1271. AddJoinObserver(first);
  1272. AddJoinObserver(second);
  1273. AddJoinObserver(third);
  1274. AddJoinObserver(fourth);
  1275. AddJoinObserver(fifth);
  1276. AddJoinObserver(sixth);
  1277. AddJoinObserver(seventh);
  1278. AddJoinObserver(eighth);
  1279. AddJoinObserver(ninth);
  1280. AddJoinObserver(tenth);
  1281. AddJoinObserver(eleventh);
  1282. AddJoinObserver(twelfth);
  1283. AddJoinObserver(thirteenth);
  1284. AddJoinObserver(fourteenth);
  1285. AddJoinObserver(fifteenth);
  1286. AddJoinObserver(sixteenth);
  1287. }
  1288. internal override void Match()
  1289. {
  1290. if (first.Queue.Count > 0
  1291. && second.Queue.Count > 0
  1292. && third.Queue.Count > 0
  1293. && fourth.Queue.Count > 0
  1294. && fifth.Queue.Count > 0
  1295. && sixth.Queue.Count > 0
  1296. && seventh.Queue.Count > 0
  1297. && eighth.Queue.Count > 0
  1298. && ninth.Queue.Count > 0
  1299. && tenth.Queue.Count > 0
  1300. && eleventh.Queue.Count > 0
  1301. && twelfth.Queue.Count > 0
  1302. && thirteenth.Queue.Count > 0
  1303. && fourteenth.Queue.Count > 0
  1304. && fifteenth.Queue.Count > 0
  1305. && sixteenth.Queue.Count > 0
  1306. )
  1307. {
  1308. var n1 = first.Queue.Peek();
  1309. var n2 = second.Queue.Peek();
  1310. var n3 = third.Queue.Peek();
  1311. var n4 = fourth.Queue.Peek();
  1312. var n5 = fifth.Queue.Peek();
  1313. var n6 = sixth.Queue.Peek();
  1314. var n7 = seventh.Queue.Peek();
  1315. var n8 = eighth.Queue.Peek();
  1316. var n9 = ninth.Queue.Peek();
  1317. var n10 = tenth.Queue.Peek();
  1318. var n11 = eleventh.Queue.Peek();
  1319. var n12 = twelfth.Queue.Peek();
  1320. var n13 = thirteenth.Queue.Peek();
  1321. var n14 = fourteenth.Queue.Peek();
  1322. var n15 = fifteenth.Queue.Peek();
  1323. var n16 = sixteenth.Queue.Peek();
  1324. if ( n1.Kind == NotificationKind.OnCompleted
  1325. || n2.Kind == NotificationKind.OnCompleted
  1326. || n3.Kind == NotificationKind.OnCompleted
  1327. || n4.Kind == NotificationKind.OnCompleted
  1328. || n5.Kind == NotificationKind.OnCompleted
  1329. || n6.Kind == NotificationKind.OnCompleted
  1330. || n7.Kind == NotificationKind.OnCompleted
  1331. || n8.Kind == NotificationKind.OnCompleted
  1332. || n9.Kind == NotificationKind.OnCompleted
  1333. || n10.Kind == NotificationKind.OnCompleted
  1334. || n11.Kind == NotificationKind.OnCompleted
  1335. || n12.Kind == NotificationKind.OnCompleted
  1336. || n13.Kind == NotificationKind.OnCompleted
  1337. || n14.Kind == NotificationKind.OnCompleted
  1338. || n15.Kind == NotificationKind.OnCompleted
  1339. || n16.Kind == NotificationKind.OnCompleted
  1340. )
  1341. onCompleted();
  1342. else
  1343. {
  1344. Dequeue();
  1345. onNext(n1.Value,
  1346. n2.Value,
  1347. n3.Value,
  1348. n4.Value,
  1349. n5.Value,
  1350. n6.Value,
  1351. n7.Value,
  1352. n8.Value,
  1353. n9.Value,
  1354. n10.Value,
  1355. n11.Value,
  1356. n12.Value,
  1357. n13.Value,
  1358. n14.Value,
  1359. n15.Value,
  1360. n16.Value
  1361. );
  1362. }
  1363. }
  1364. }
  1365. }
  1366. #endif
  1367. }