OnSubscribeFromIterable$IterableProducer.smali

.class final Lrx/internal/operators/OnSubscribeFromIterable$IterableProducer;
.super Ljava/util/concurrent/atomic/AtomicLong;
.source "OnSubscribeFromIterable.java"

# interfaces
.implements Lrx/i;


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "<T:",
        "Ljava/lang/Object;",
        ">",
        "Ljava/util/concurrent/atomic/AtomicLong;",
        "Lrx/i;"
    }
.end annotation


# static fields
.field private static final serialVersionUID:J = -0x7928e15851eba4daL


# instance fields
.field private final it:Ljava/util/Iterator;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Iterator",
            "<+TT;>;"
        }
    .end annotation
.end field

.field private final o:Lrx/o;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Lrx/o",
            "<-TT;>;"
        }
    .end annotation
.end field


# direct methods
.method constructor <init>(Lrx/o;Ljava/util/Iterator;)V
    .registers 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lrx/o",
            "<-TT;>;",
            "Ljava/util/Iterator",
            "<+TT;>;)V"
        }
    .end annotation

    .prologue
    .line 74
    invoke-direct {p0}, Ljava/util/concurrent/atomic/AtomicLong;-><init>()V

    .line 75
    iput-object p1, p0, Lrx/internal/operators/OnSubscribeFromIterable$IterableProducer;->o:Lrx/o;

    .line 76
    iput-object p2, p0, Lrx/internal/operators/OnSubscribeFromIterable$IterableProducer;->it:Ljava/util/Iterator;

    .line 77
    return-void
.end method


# virtual methods
.method final fastPath()V
    .registers 4

    .prologue
    .line 156
    iget-object v0, p0, Lrx/internal/operators/OnSubscribeFromIterable$IterableProducer;->o:Lrx/o;

    .line 157
    iget-object v1, p0, Lrx/internal/operators/OnSubscribeFromIterable$IterableProducer;->it:Ljava/util/Iterator;

    .line 160
    :cond_4
    invoke-virtual {v0}, Lrx/o;->isUnsubscribed()Z

    move-result v2

    if-eqz v2, :cond_b

    .line 192
    :cond_a
    :goto_a
    return-void

    .line 167
    :cond_b
    :try_start_b
    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
    :try_end_e
    .catch Ljava/lang/Throwable; {:try_start_b .. :try_end_e} :catch_28

    move-result-object v2

    .line 173
    invoke-virtual {v0, v2}, Lrx/o;->onNext(Ljava/lang/Object;)V

    .line 175
    invoke-virtual {v0}, Lrx/o;->isUnsubscribed()Z

    move-result v2

    if-nez v2, :cond_a

    .line 182
    :try_start_18
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
    :try_end_1b
    .catch Ljava/lang/Throwable; {:try_start_18 .. :try_end_1b} :catch_2d

    move-result v2

    .line 188
    if-nez v2, :cond_4

    .line 189
    invoke-virtual {v0}, Lrx/o;->isUnsubscribed()Z

    move-result v1

    if-nez v1, :cond_a

    .line 190
    invoke-virtual {v0}, Lrx/o;->SG()V

    goto :goto_a

    .line 169
    :catch_28
    move-exception v1

    invoke-static {v1, v0}, Lrx/exceptions/d;->a(Ljava/lang/Throwable;Lrx/h;)V

    goto :goto_a

    .line 184
    :catch_2d
    move-exception v1

    invoke-static {v1, v0}, Lrx/exceptions/d;->a(Ljava/lang/Throwable;Lrx/h;)V

    goto :goto_a
.end method

.method public final request(J)V
    .registers 10

    .prologue
    const-wide v4, 0x7fffffffffffffffL

    const-wide/16 v2, 0x0

    .line 81
    invoke-virtual {p0}, Lrx/internal/operators/OnSubscribeFromIterable$IterableProducer;->get()J

    move-result-wide v0

    cmp-long v0, v0, v4

    if-nez v0, :cond_10

    .line 92
    :cond_f
    :goto_f
    return-void

    .line 85
    :cond_10
    cmp-long v0, p1, v4

    if-nez v0, :cond_1e

    invoke-virtual {p0, v2, v3, v4, v5}, Lrx/internal/operators/OnSubscribeFromIterable$IterableProducer;->compareAndSet(JJ)Z

    move-result v0

    if-eqz v0, :cond_1e

    .line 86
    invoke-virtual {p0}, Lrx/internal/operators/OnSubscribeFromIterable$IterableProducer;->fastPath()V

    goto :goto_f

    .line 88
    :cond_1e
    cmp-long v0, p1, v2

    if-lez v0, :cond_f

    invoke-static {p0, p1, p2}, Lrx/internal/operators/a;->c(Ljava/util/concurrent/atomic/AtomicLong;J)J

    move-result-wide v0

    cmp-long v0, v0, v2

    if-nez v0, :cond_f

    .line 89
    invoke-virtual {p0, p1, p2}, Lrx/internal/operators/OnSubscribeFromIterable$IterableProducer;->slowPath(J)V

    goto :goto_f
.end method

.method final slowPath(J)V
    .registers 12

    .prologue
    const-wide/16 v2, 0x0

    .line 96
    iget-object v4, p0, Lrx/internal/operators/OnSubscribeFromIterable$IterableProducer;->o:Lrx/o;

    .line 97
    iget-object v5, p0, Lrx/internal/operators/OnSubscribeFromIterable$IterableProducer;->it:Ljava/util/Iterator;

    move-wide v0, v2

    .line 103
    :cond_7
    :goto_7
    cmp-long v6, v0, p1

    if-eqz v6, :cond_3d

    .line 104
    invoke-virtual {v4}, Lrx/o;->isUnsubscribed()Z

    move-result v6

    if-eqz v6, :cond_12

    .line 152
    :cond_11
    :goto_11
    return-void

    .line 111
    :cond_12
    :try_start_12
    invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object;
    :try_end_15
    .catch Ljava/lang/Throwable; {:try_start_12 .. :try_end_15} :catch_2f

    move-result-object v6

    .line 117
    invoke-virtual {v4, v6}, Lrx/o;->onNext(Ljava/lang/Object;)V

    .line 119
    invoke-virtual {v4}, Lrx/o;->isUnsubscribed()Z

    move-result v6

    if-nez v6, :cond_11

    .line 126
    :try_start_1f
    invoke-interface {v5}, Ljava/util/Iterator;->hasNext()Z
    :try_end_22
    .catch Ljava/lang/Throwable; {:try_start_1f .. :try_end_22} :catch_34

    move-result v6

    .line 132
    if-nez v6, :cond_39

    .line 133
    invoke-virtual {v4}, Lrx/o;->isUnsubscribed()Z

    move-result v0

    if-nez v0, :cond_11

    .line 134
    invoke-virtual {v4}, Lrx/o;->SG()V

    goto :goto_11

    .line 113
    :catch_2f
    move-exception v0

    invoke-static {v0, v4}, Lrx/exceptions/d;->a(Ljava/lang/Throwable;Lrx/h;)V

    goto :goto_11

    .line 128
    :catch_34
    move-exception v0

    invoke-static {v0, v4}, Lrx/exceptions/d;->a(Ljava/lang/Throwable;Lrx/h;)V

    goto :goto_11

    .line 139
    :cond_39
    const-wide/16 v6, 0x1

    add-long/2addr v0, v6

    .line 140
    goto :goto_7

    .line 142
    :cond_3d
    invoke-virtual {p0}, Lrx/internal/operators/OnSubscribeFromIterable$IterableProducer;->get()J

    move-result-wide p1

    .line 143
    cmp-long v6, v0, p1

    if-nez v6, :cond_7

    .line 144
    invoke-static {p0, v0, v1}, Lrx/internal/operators/a;->b(Ljava/util/concurrent/atomic/AtomicLong;J)J

    move-result-wide p1

    .line 145
    cmp-long v0, p1, v2

    if-eqz v0, :cond_11

    move-wide v0, v2

    .line 148
    goto :goto_7
.end method