Subscriber.smali
.class public abstract Lrx/Subscriber;
.super Ljava/lang/Object;
.source "Subscriber.java"
# interfaces
.implements Lrx/Observer;
.implements Lrx/Subscription;
# annotations
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">",
"Ljava/lang/Object;",
"Lrx/Observer<",
"TT;>;",
"Lrx/Subscription;"
}
.end annotation
# static fields
.field private static final NOT_SET:J = -0x8000000000000000L
# instance fields
.field private producer:Lrx/Producer;
.field private requested:J
.field private final subscriber:Lrx/Subscriber;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lrx/Subscriber<",
"*>;"
}
.end annotation
.end field
.field private final subscriptions:Lrx/internal/util/SubscriptionList;
# direct methods
.method protected constructor <init>()V
.registers 3
const/4 v0, 0x0
const/4 v1, 0x0
.line 1
invoke-direct {p0, v0, v1}, Lrx/Subscriber;-><init>(Lrx/Subscriber;Z)V
return-void
.end method
.method protected constructor <init>(Lrx/Subscriber;)V
.registers 3
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lrx/Subscriber<",
"*>;)V"
}
.end annotation
const/4 v0, 0x1
.line 2
invoke-direct {p0, p1, v0}, Lrx/Subscriber;-><init>(Lrx/Subscriber;Z)V
return-void
.end method
.method protected constructor <init>(Lrx/Subscriber;Z)V
.registers 5
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lrx/Subscriber<",
"*>;Z)V"
}
.end annotation
.line 3
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
const-wide/high16 v0, -0x8000000000000000L
.line 4
iput-wide v0, p0, Lrx/Subscriber;->requested:J
.line 5
iput-object p1, p0, Lrx/Subscriber;->subscriber:Lrx/Subscriber;
if-eqz p2, :cond_10
if-eqz p1, :cond_10
.line 6
iget-object p1, p1, Lrx/Subscriber;->subscriptions:Lrx/internal/util/SubscriptionList;
goto :goto_15
:cond_10
new-instance p1, Lrx/internal/util/SubscriptionList;
invoke-direct {p1}, Lrx/internal/util/SubscriptionList;-><init>()V
:goto_15
iput-object p1, p0, Lrx/Subscriber;->subscriptions:Lrx/internal/util/SubscriptionList;
return-void
.end method
.method private addToRequested(J)V
.registers 8
.line 1
iget-wide v0, p0, Lrx/Subscriber;->requested:J
const-wide/high16 v2, -0x8000000000000000L
cmp-long v4, v0, v2
if-nez v4, :cond_b
.line 2
iput-wide p1, p0, Lrx/Subscriber;->requested:J
goto :goto_1c
:cond_b
add-long/2addr v0, p1
const-wide/16 p1, 0x0
cmp-long v2, v0, p1
if-gez v2, :cond_1a
const-wide p1, 0x7fffffffffffffffL
.line 3
iput-wide p1, p0, Lrx/Subscriber;->requested:J
goto :goto_1c
.line 4
:cond_1a
iput-wide v0, p0, Lrx/Subscriber;->requested:J
:goto_1c
return-void
.end method
# virtual methods
.method public final add(Lrx/Subscription;)V
.registers 3
.line 1
iget-object v0, p0, Lrx/Subscriber;->subscriptions:Lrx/internal/util/SubscriptionList;
invoke-virtual {v0, p1}, Lrx/internal/util/SubscriptionList;->add(Lrx/Subscription;)V
return-void
.end method
.method public final isUnsubscribed()Z
.registers 2
.line 1
iget-object v0, p0, Lrx/Subscriber;->subscriptions:Lrx/internal/util/SubscriptionList;
invoke-virtual {v0}, Lrx/internal/util/SubscriptionList;->isUnsubscribed()Z
move-result v0
return v0
.end method
.method public onStart()V
.registers 1
return-void
.end method
.method protected final request(J)V
.registers 6
const-wide/16 v0, 0x0
cmp-long v2, p1, v0
if-ltz v2, :cond_1a
.line 1
monitor-enter p0
.line 2
:try_start_7
iget-object v0, p0, Lrx/Subscriber;->producer:Lrx/Producer;
if-eqz v0, :cond_12
.line 3
iget-object v0, p0, Lrx/Subscriber;->producer:Lrx/Producer;
.line 4
monitor-exit p0
:try_end_e
.catchall {:try_start_7 .. :try_end_e} :catchall_17
.line 5
invoke-interface {v0, p1, p2}, Lrx/Producer;->request(J)V
return-void
.line 6
:cond_12
:try_start_12
invoke-direct {p0, p1, p2}, Lrx/Subscriber;->addToRequested(J)V
.line 7
monitor-exit p0
return-void
:catchall_17
move-exception p1
.line 8
monitor-exit p0
:try_end_19
.catchall {:try_start_12 .. :try_end_19} :catchall_17
throw p1
.line 9
:cond_1a
new-instance v0, Ljava/lang/IllegalArgumentException;
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "number requested cannot be negative: "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v1, p1, p2}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
invoke-direct {v0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
.end method
.method public setProducer(Lrx/Producer;)V
.registers 6
.line 1
monitor-enter p0
.line 2
:try_start_1
iget-wide v0, p0, Lrx/Subscriber;->requested:J
.line 3
iput-object p1, p0, Lrx/Subscriber;->producer:Lrx/Producer;
.line 4
iget-object p1, p0, Lrx/Subscriber;->subscriber:Lrx/Subscriber;
const-wide/high16 v2, -0x8000000000000000L
if-eqz p1, :cond_11
cmp-long p1, v0, v2
if-nez p1, :cond_11
const/4 p1, 0x1
goto :goto_12
:cond_11
const/4 p1, 0x0
.line 5
:goto_12
monitor-exit p0
:try_end_13
.catchall {:try_start_1 .. :try_end_13} :catchall_32
if-eqz p1, :cond_1d
.line 6
iget-object p1, p0, Lrx/Subscriber;->subscriber:Lrx/Subscriber;
iget-object v0, p0, Lrx/Subscriber;->producer:Lrx/Producer;
invoke-virtual {p1, v0}, Lrx/Subscriber;->setProducer(Lrx/Producer;)V
goto :goto_31
:cond_1d
cmp-long p1, v0, v2
if-nez p1, :cond_2c
.line 7
iget-object p1, p0, Lrx/Subscriber;->producer:Lrx/Producer;
const-wide v0, 0x7fffffffffffffffL
invoke-interface {p1, v0, v1}, Lrx/Producer;->request(J)V
goto :goto_31
.line 8
:cond_2c
iget-object p1, p0, Lrx/Subscriber;->producer:Lrx/Producer;
invoke-interface {p1, v0, v1}, Lrx/Producer;->request(J)V
:goto_31
return-void
:catchall_32
move-exception p1
.line 9
:try_start_33
monitor-exit p0
:try_end_34
.catchall {:try_start_33 .. :try_end_34} :catchall_32
throw p1
.end method
.method public final unsubscribe()V
.registers 2
.line 1
iget-object v0, p0, Lrx/Subscriber;->subscriptions:Lrx/internal/util/SubscriptionList;
invoke-virtual {v0}, Lrx/internal/util/SubscriptionList;->unsubscribe()V
return-void
.end method