ReplaySubject$UnboundedReplayBuffer.smali 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  1. .class final Lio/reactivex/subjects/ReplaySubject$UnboundedReplayBuffer;
  2. .super Ljava/util/concurrent/atomic/AtomicReference;
  3. .source "ReplaySubject.java"
  4. # interfaces
  5. .implements Lio/reactivex/subjects/ReplaySubject$ReplayBuffer;
  6. # annotations
  7. .annotation system Ldalvik/annotation/EnclosingClass;
  8. value = Lio/reactivex/subjects/ReplaySubject;
  9. .end annotation
  10. .annotation system Ldalvik/annotation/InnerClass;
  11. accessFlags = 0x18
  12. name = "UnboundedReplayBuffer"
  13. .end annotation
  14. .annotation system Ldalvik/annotation/Signature;
  15. value = {
  16. "<T:",
  17. "Ljava/lang/Object;",
  18. ">",
  19. "Ljava/util/concurrent/atomic/AtomicReference<",
  20. "Ljava/lang/Object;",
  21. ">;",
  22. "Lio/reactivex/subjects/ReplaySubject$ReplayBuffer<",
  23. "TT;>;"
  24. }
  25. .end annotation
  26. # static fields
  27. .field private static final serialVersionUID:J = -0xa2f4068c73be4b3L
  28. # instance fields
  29. .field final buffer:Ljava/util/List;
  30. .annotation system Ldalvik/annotation/Signature;
  31. value = {
  32. "Ljava/util/List<",
  33. "Ljava/lang/Object;",
  34. ">;"
  35. }
  36. .end annotation
  37. .end field
  38. .field volatile done:Z
  39. .field volatile size:I
  40. # direct methods
  41. .method constructor <init>(I)V
  42. .locals 2
  43. .line 529
  44. invoke-direct {p0}, Ljava/util/concurrent/atomic/AtomicReference;-><init>()V
  45. .line 530
  46. new-instance v0, Ljava/util/ArrayList;
  47. const-string v1, "capacityHint"
  48. invoke-static {p1, v1}, Lio/reactivex/internal/functions/ObjectHelper;->verifyPositive(ILjava/lang/String;)I
  49. move-result p1
  50. invoke-direct {v0, p1}, Ljava/util/ArrayList;-><init>(I)V
  51. iput-object v0, p0, Lio/reactivex/subjects/ReplaySubject$UnboundedReplayBuffer;->buffer:Ljava/util/List;
  52. return-void
  53. .end method
  54. # virtual methods
  55. .method public add(Ljava/lang/Object;)V
  56. .locals 1
  57. .annotation system Ldalvik/annotation/Signature;
  58. value = {
  59. "(TT;)V"
  60. }
  61. .end annotation
  62. .line 535
  63. iget-object v0, p0, Lio/reactivex/subjects/ReplaySubject$UnboundedReplayBuffer;->buffer:Ljava/util/List;
  64. invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  65. .line 536
  66. iget p1, p0, Lio/reactivex/subjects/ReplaySubject$UnboundedReplayBuffer;->size:I
  67. add-int/lit8 p1, p1, 0x1
  68. iput p1, p0, Lio/reactivex/subjects/ReplaySubject$UnboundedReplayBuffer;->size:I
  69. return-void
  70. .end method
  71. .method public addFinal(Ljava/lang/Object;)V
  72. .locals 1
  73. .line 541
  74. iget-object v0, p0, Lio/reactivex/subjects/ReplaySubject$UnboundedReplayBuffer;->buffer:Ljava/util/List;
  75. invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  76. .line 542
  77. iget p1, p0, Lio/reactivex/subjects/ReplaySubject$UnboundedReplayBuffer;->size:I
  78. const/4 v0, 0x1
  79. add-int/2addr p1, v0
  80. iput p1, p0, Lio/reactivex/subjects/ReplaySubject$UnboundedReplayBuffer;->size:I
  81. .line 543
  82. iput-boolean v0, p0, Lio/reactivex/subjects/ReplaySubject$UnboundedReplayBuffer;->done:Z
  83. return-void
  84. .end method
  85. .method public getValue()Ljava/lang/Object;
  86. .locals 5
  87. .annotation system Ldalvik/annotation/Signature;
  88. value = {
  89. "()TT;"
  90. }
  91. .end annotation
  92. .line 549
  93. iget v0, p0, Lio/reactivex/subjects/ReplaySubject$UnboundedReplayBuffer;->size:I
  94. const/4 v1, 0x0
  95. if-eqz v0, :cond_3
  96. .line 551
  97. iget-object v2, p0, Lio/reactivex/subjects/ReplaySubject$UnboundedReplayBuffer;->buffer:Ljava/util/List;
  98. add-int/lit8 v3, v0, -0x1
  99. .line 552
  100. invoke-interface {v2, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;
  101. move-result-object v3
  102. .line 553
  103. invoke-static {v3}, Lio/reactivex/internal/util/NotificationLite;->isComplete(Ljava/lang/Object;)Z
  104. move-result v4
  105. if-nez v4, :cond_1
  106. invoke-static {v3}, Lio/reactivex/internal/util/NotificationLite;->isError(Ljava/lang/Object;)Z
  107. move-result v4
  108. if-eqz v4, :cond_0
  109. goto :goto_0
  110. :cond_0
  111. return-object v3
  112. :cond_1
  113. :goto_0
  114. const/4 v3, 0x1
  115. if-ne v0, v3, :cond_2
  116. return-object v1
  117. :cond_2
  118. add-int/lit8 v0, v0, -0x2
  119. .line 557
  120. invoke-interface {v2, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;
  121. move-result-object v0
  122. return-object v0
  123. :cond_3
  124. return-object v1
  125. .end method
  126. .method public getValues([Ljava/lang/Object;)[Ljava/lang/Object;
  127. .locals 6
  128. .annotation system Ldalvik/annotation/Signature;
  129. value = {
  130. "([TT;)[TT;"
  131. }
  132. .end annotation
  133. .line 567
  134. iget v0, p0, Lio/reactivex/subjects/ReplaySubject$UnboundedReplayBuffer;->size:I
  135. const/4 v1, 0x0
  136. const/4 v2, 0x0
  137. if-nez v0, :cond_1
  138. .line 569
  139. array-length v0, p1
  140. if-eqz v0, :cond_0
  141. .line 570
  142. aput-object v1, p1, v2
  143. :cond_0
  144. return-object p1
  145. .line 574
  146. :cond_1
  147. iget-object v3, p0, Lio/reactivex/subjects/ReplaySubject$UnboundedReplayBuffer;->buffer:Ljava/util/List;
  148. add-int/lit8 v4, v0, -0x1
  149. .line 575
  150. invoke-interface {v3, v4}, Ljava/util/List;->get(I)Ljava/lang/Object;
  151. move-result-object v4
  152. .line 577
  153. invoke-static {v4}, Lio/reactivex/internal/util/NotificationLite;->isComplete(Ljava/lang/Object;)Z
  154. move-result v5
  155. if-nez v5, :cond_2
  156. invoke-static {v4}, Lio/reactivex/internal/util/NotificationLite;->isError(Ljava/lang/Object;)Z
  157. move-result v4
  158. if-eqz v4, :cond_4
  159. :cond_2
  160. add-int/lit8 v0, v0, -0x1
  161. if-nez v0, :cond_4
  162. .line 580
  163. array-length v0, p1
  164. if-eqz v0, :cond_3
  165. .line 581
  166. aput-object v1, p1, v2
  167. :cond_3
  168. return-object p1
  169. .line 588
  170. :cond_4
  171. array-length v4, p1
  172. if-ge v4, v0, :cond_5
  173. .line 589
  174. invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
  175. move-result-object p1
  176. invoke-virtual {p1}, Ljava/lang/Class;->getComponentType()Ljava/lang/Class;
  177. move-result-object p1
  178. invoke-static {p1, v0}, Ljava/lang/reflect/Array;->newInstance(Ljava/lang/Class;I)Ljava/lang/Object;
  179. move-result-object p1
  180. check-cast p1, [Ljava/lang/Object;
  181. check-cast p1, [Ljava/lang/Object;
  182. :cond_5
  183. :goto_0
  184. if-ge v2, v0, :cond_6
  185. .line 592
  186. invoke-interface {v3, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
  187. move-result-object v4
  188. aput-object v4, p1, v2
  189. add-int/lit8 v2, v2, 0x1
  190. goto :goto_0
  191. .line 594
  192. :cond_6
  193. array-length v2, p1
  194. if-le v2, v0, :cond_7
  195. .line 595
  196. aput-object v1, p1, v0
  197. :cond_7
  198. return-object p1
  199. .end method
  200. .method public replay(Lio/reactivex/subjects/ReplaySubject$ReplayDisposable;)V
  201. .locals 9
  202. .annotation system Ldalvik/annotation/Signature;
  203. value = {
  204. "(",
  205. "Lio/reactivex/subjects/ReplaySubject$ReplayDisposable<",
  206. "TT;>;)V"
  207. }
  208. .end annotation
  209. .line 604
  210. invoke-virtual {p1}, Lio/reactivex/subjects/ReplaySubject$ReplayDisposable;->getAndIncrement()I
  211. move-result v0
  212. if-eqz v0, :cond_0
  213. return-void
  214. .line 609
  215. :cond_0
  216. iget-object v0, p0, Lio/reactivex/subjects/ReplaySubject$UnboundedReplayBuffer;->buffer:Ljava/util/List;
  217. .line 610
  218. iget-object v1, p1, Lio/reactivex/subjects/ReplaySubject$ReplayDisposable;->actual:Lio/reactivex/Observer;
  219. .line 612
  220. iget-object v2, p1, Lio/reactivex/subjects/ReplaySubject$ReplayDisposable;->index:Ljava/lang/Object;
  221. check-cast v2, Ljava/lang/Integer;
  222. const/4 v3, 0x0
  223. const/4 v4, 0x1
  224. if-eqz v2, :cond_1
  225. .line 615
  226. invoke-virtual {v2}, Ljava/lang/Integer;->intValue()I
  227. move-result v3
  228. goto :goto_0
  229. .line 618
  230. :cond_1
  231. invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  232. move-result-object v2
  233. iput-object v2, p1, Lio/reactivex/subjects/ReplaySubject$ReplayDisposable;->index:Ljava/lang/Object;
  234. :goto_0
  235. const/4 v2, 0x1
  236. .line 623
  237. :cond_2
  238. :goto_1
  239. iget-boolean v5, p1, Lio/reactivex/subjects/ReplaySubject$ReplayDisposable;->cancelled:Z
  240. const/4 v6, 0x0
  241. if-eqz v5, :cond_3
  242. .line 624
  243. iput-object v6, p1, Lio/reactivex/subjects/ReplaySubject$ReplayDisposable;->index:Ljava/lang/Object;
  244. return-void
  245. .line 628
  246. :cond_3
  247. iget v5, p0, Lio/reactivex/subjects/ReplaySubject$UnboundedReplayBuffer;->size:I
  248. :goto_2
  249. if-eq v5, v3, :cond_7
  250. .line 632
  251. iget-boolean v7, p1, Lio/reactivex/subjects/ReplaySubject$ReplayDisposable;->cancelled:Z
  252. if-eqz v7, :cond_4
  253. .line 633
  254. iput-object v6, p1, Lio/reactivex/subjects/ReplaySubject$ReplayDisposable;->index:Ljava/lang/Object;
  255. return-void
  256. .line 637
  257. :cond_4
  258. invoke-interface {v0, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;
  259. move-result-object v7
  260. .line 639
  261. iget-boolean v8, p0, Lio/reactivex/subjects/ReplaySubject$UnboundedReplayBuffer;->done:Z
  262. if-eqz v8, :cond_6
  263. add-int/lit8 v8, v3, 0x1
  264. if-ne v8, v5, :cond_6
  265. .line 641
  266. iget v5, p0, Lio/reactivex/subjects/ReplaySubject$UnboundedReplayBuffer;->size:I
  267. if-ne v8, v5, :cond_6
  268. .line 643
  269. invoke-static {v7}, Lio/reactivex/internal/util/NotificationLite;->isComplete(Ljava/lang/Object;)Z
  270. move-result v0
  271. if-eqz v0, :cond_5
  272. .line 644
  273. invoke-interface {v1}, Lio/reactivex/Observer;->onComplete()V
  274. goto :goto_3
  275. .line 646
  276. :cond_5
  277. invoke-static {v7}, Lio/reactivex/internal/util/NotificationLite;->getError(Ljava/lang/Object;)Ljava/lang/Throwable;
  278. move-result-object v0
  279. invoke-interface {v1, v0}, Lio/reactivex/Observer;->onError(Ljava/lang/Throwable;)V
  280. .line 648
  281. :goto_3
  282. iput-object v6, p1, Lio/reactivex/subjects/ReplaySubject$ReplayDisposable;->index:Ljava/lang/Object;
  283. .line 649
  284. iput-boolean v4, p1, Lio/reactivex/subjects/ReplaySubject$ReplayDisposable;->cancelled:Z
  285. return-void
  286. .line 655
  287. :cond_6
  288. invoke-interface {v1, v7}, Lio/reactivex/Observer;->onNext(Ljava/lang/Object;)V
  289. add-int/lit8 v3, v3, 0x1
  290. goto :goto_2
  291. .line 659
  292. :cond_7
  293. iget v5, p0, Lio/reactivex/subjects/ReplaySubject$UnboundedReplayBuffer;->size:I
  294. if-eq v3, v5, :cond_8
  295. goto :goto_1
  296. .line 663
  297. :cond_8
  298. invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  299. move-result-object v5
  300. iput-object v5, p1, Lio/reactivex/subjects/ReplaySubject$ReplayDisposable;->index:Ljava/lang/Object;
  301. neg-int v2, v2
  302. .line 665
  303. invoke-virtual {p1, v2}, Lio/reactivex/subjects/ReplaySubject$ReplayDisposable;->addAndGet(I)I
  304. move-result v2
  305. if-nez v2, :cond_2
  306. return-void
  307. .end method
  308. .method public size()I
  309. .locals 4
  310. .line 674
  311. iget v0, p0, Lio/reactivex/subjects/ReplaySubject$UnboundedReplayBuffer;->size:I
  312. if-eqz v0, :cond_2
  313. .line 676
  314. iget-object v1, p0, Lio/reactivex/subjects/ReplaySubject$UnboundedReplayBuffer;->buffer:Ljava/util/List;
  315. add-int/lit8 v2, v0, -0x1
  316. invoke-interface {v1, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
  317. move-result-object v1
  318. .line 677
  319. invoke-static {v1}, Lio/reactivex/internal/util/NotificationLite;->isComplete(Ljava/lang/Object;)Z
  320. move-result v3
  321. if-nez v3, :cond_1
  322. invoke-static {v1}, Lio/reactivex/internal/util/NotificationLite;->isError(Ljava/lang/Object;)Z
  323. move-result v1
  324. if-eqz v1, :cond_0
  325. goto :goto_0
  326. :cond_0
  327. return v0
  328. :cond_1
  329. :goto_0
  330. return v2
  331. :cond_2
  332. const/4 v0, 0x0
  333. return v0
  334. .end method