ActivePlan.cs 56 KB

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