FlowableTake$TakeSubscriber.smali
.class final Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;
.super Ljava/util/concurrent/atomic/AtomicBoolean;
.source "FlowableTake.java"
# interfaces
.implements Lio/reactivex/FlowableSubscriber;
.implements Lorg/reactivestreams/Subscription;
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lio/reactivex/internal/operators/flowable/FlowableTake;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x18
name = "TakeSubscriber"
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">",
"Ljava/util/concurrent/atomic/AtomicBoolean;",
"Lio/reactivex/FlowableSubscriber<",
"TT;>;",
"Lorg/reactivestreams/Subscription;"
}
.end annotation
# static fields
.field private static final serialVersionUID:J = -0x4e3906c454cf527fL
# instance fields
.field final actual:Lorg/reactivestreams/Subscriber;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lorg/reactivestreams/Subscriber<",
"-TT;>;"
}
.end annotation
.end field
.field done:Z
.field final limit:J
.field remaining:J
.field subscription:Lorg/reactivestreams/Subscription;
# direct methods
.method static constructor <clinit>()V
.registers 1
return-void
.end method
.method constructor <init>(Lorg/reactivestreams/Subscriber;J)V
.registers 4
.param p2, "limit" # J
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lorg/reactivestreams/Subscriber<",
"-TT;>;J)V"
}
.end annotation
.line 43
.local p0, "this":Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;, "Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber<TT;>;"
.local p1, "actual":Lorg/reactivestreams/Subscriber;, "Lorg/reactivestreams/Subscriber<-TT;>;"
invoke-direct {p0}, Ljava/util/concurrent/atomic/AtomicBoolean;-><init>()V
.line 44
iput-object p1, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->actual:Lorg/reactivestreams/Subscriber;
.line 45
iput-wide p2, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->limit:J
.line 46
iput-wide p2, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->remaining:J
.line 47
return-void
.end method
# virtual methods
.method public cancel()V
.registers 2
.line 102
.local p0, "this":Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;, "Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber<TT;>;"
iget-object v0, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->subscription:Lorg/reactivestreams/Subscription;
invoke-interface {v0}, Lorg/reactivestreams/Subscription;->cancel()V
.line 103
return-void
.end method
.method public onComplete()V
.registers 2
.line 82
.local p0, "this":Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;, "Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber<TT;>;"
iget-boolean v0, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->done:Z
if-nez v0, :cond_c
.line 83
const/4 v0, 0x1
iput-boolean v0, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->done:Z
.line 84
iget-object v0, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->actual:Lorg/reactivestreams/Subscriber;
invoke-interface {v0}, Lorg/reactivestreams/Subscriber;->onComplete()V
.line 86
:cond_c
return-void
.end method
.method public onError(Ljava/lang/Throwable;)V
.registers 3
.param p1, "t" # Ljava/lang/Throwable;
.line 74
.local p0, "this":Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;, "Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber<TT;>;"
iget-boolean v0, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->done:Z
if-nez v0, :cond_11
.line 75
const/4 v0, 0x1
iput-boolean v0, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->done:Z
.line 76
iget-object v0, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->subscription:Lorg/reactivestreams/Subscription;
invoke-interface {v0}, Lorg/reactivestreams/Subscription;->cancel()V
.line 77
iget-object v0, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->actual:Lorg/reactivestreams/Subscriber;
invoke-interface {v0, p1}, Lorg/reactivestreams/Subscriber;->onError(Ljava/lang/Throwable;)V
.line 79
:cond_11
return-void
.end method
.method public onNext(Ljava/lang/Object;)V
.registers 9
.annotation system Ldalvik/annotation/Signature;
value = {
"(TT;)V"
}
.end annotation
.line 63
.local p0, "this":Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;, "Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber<TT;>;"
.local p1, "t":Ljava/lang/Object;, "TT;"
iget-boolean v0, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->done:Z
if-nez v0, :cond_28
iget-wide v0, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->remaining:J
const-wide/16 v2, 0x1
sub-long v2, v0, v2
iput-wide v2, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->remaining:J
const-wide/16 v4, 0x0
cmp-long v6, v0, v4
if-lez v6, :cond_28
.line 64
cmp-long v0, v2, v4
if-nez v0, :cond_18
const/4 v0, 0x1
goto :goto_19
:cond_18
const/4 v0, 0x0
.line 65
.local v0, "stop":Z
:goto_19
iget-object v1, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->actual:Lorg/reactivestreams/Subscriber;
invoke-interface {v1, p1}, Lorg/reactivestreams/Subscriber;->onNext(Ljava/lang/Object;)V
.line 66
if-eqz v0, :cond_28
.line 67
iget-object v1, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->subscription:Lorg/reactivestreams/Subscription;
invoke-interface {v1}, Lorg/reactivestreams/Subscription;->cancel()V
.line 68
invoke-virtual {p0}, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->onComplete()V
.line 71
.end local v0 # "stop":Z
:cond_28
return-void
.end method
.method public onSubscribe(Lorg/reactivestreams/Subscription;)V
.registers 7
.param p1, "s" # Lorg/reactivestreams/Subscription;
.line 50
.local p0, "this":Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;, "Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber<TT;>;"
iget-object v0, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->subscription:Lorg/reactivestreams/Subscription;
invoke-static {v0, p1}, Lio/reactivex/internal/subscriptions/SubscriptionHelper;->validate(Lorg/reactivestreams/Subscription;Lorg/reactivestreams/Subscription;)Z
move-result v0
if-eqz v0, :cond_23
.line 51
iput-object p1, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->subscription:Lorg/reactivestreams/Subscription;
.line 52
iget-wide v0, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->limit:J
const-wide/16 v2, 0x0
cmp-long v4, v0, v2
if-nez v4, :cond_1e
.line 53
invoke-interface {p1}, Lorg/reactivestreams/Subscription;->cancel()V
.line 54
const/4 v0, 0x1
iput-boolean v0, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->done:Z
.line 55
iget-object v0, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->actual:Lorg/reactivestreams/Subscriber;
invoke-static {v0}, Lio/reactivex/internal/subscriptions/EmptySubscription;->complete(Lorg/reactivestreams/Subscriber;)V
goto :goto_23
.line 57
:cond_1e
iget-object v0, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->actual:Lorg/reactivestreams/Subscriber;
invoke-interface {v0, p0}, Lorg/reactivestreams/Subscriber;->onSubscribe(Lorg/reactivestreams/Subscription;)V
.line 60
:cond_23
:goto_23
return-void
.end method
.method public request(J)V
.registers 6
.param p1, "n" # J
.line 89
.local p0, "this":Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;, "Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber<TT;>;"
invoke-static {p1, p2}, Lio/reactivex/internal/subscriptions/SubscriptionHelper;->validate(J)Z
move-result v0
if-nez v0, :cond_7
.line 90
return-void
.line 92
:cond_7
invoke-virtual {p0}, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->get()Z
move-result v0
if-nez v0, :cond_26
const/4 v0, 0x0
const/4 v1, 0x1
invoke-virtual {p0, v0, v1}, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->compareAndSet(ZZ)Z
move-result v0
if-eqz v0, :cond_26
.line 93
iget-wide v0, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->limit:J
cmp-long v2, p1, v0
if-ltz v2, :cond_26
.line 94
iget-object v0, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->subscription:Lorg/reactivestreams/Subscription;
const-wide v1, 0x7fffffffffffffffL
invoke-interface {v0, v1, v2}, Lorg/reactivestreams/Subscription;->request(J)V
.line 95
return-void
.line 98
:cond_26
iget-object v0, p0, Lio/reactivex/internal/operators/flowable/FlowableTake$TakeSubscriber;->subscription:Lorg/reactivestreams/Subscription;
invoke-interface {v0, p1, p2}, Lorg/reactivestreams/Subscription;->request(J)V
.line 99
return-void
.end method