OperatorWithLatestFromMany.smali

.class public final Lrx/internal/operators/OperatorWithLatestFromMany;
.super Ljava/lang/Object;
.source "OperatorWithLatestFromMany.java"

# interfaces
.implements Lrx/Observable$OnSubscribe;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lrx/internal/operators/OperatorWithLatestFromMany$WithLatestOtherSubscriber;,
        Lrx/internal/operators/OperatorWithLatestFromMany$WithLatestMainSubscriber;
    }
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "<T:",
        "Ljava/lang/Object;",
        "R:",
        "Ljava/lang/Object;",
        ">",
        "Ljava/lang/Object;",
        "Lrx/Observable$OnSubscribe<",
        "TR;>;"
    }
.end annotation


# instance fields
.field final combiner:Lrx/functions/FuncN;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Lrx/functions/FuncN<",
            "TR;>;"
        }
    .end annotation
.end field

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

.field final others:[Lrx/Observable;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "[",
            "Lrx/Observable<",
            "*>;"
        }
    .end annotation
.end field

.field final othersIterable:Ljava/lang/Iterable;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/Iterable<",
            "Lrx/Observable<",
            "*>;>;"
        }
    .end annotation
.end field


# direct methods
.method public constructor <init>(Lrx/Observable;[Lrx/Observable;Ljava/lang/Iterable;Lrx/functions/FuncN;)V
    .registers 5
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lrx/Observable<",
            "TT;>;[",
            "Lrx/Observable<",
            "*>;",
            "Ljava/lang/Iterable<",
            "Lrx/Observable<",
            "*>;>;",
            "Lrx/functions/FuncN<",
            "TR;>;)V"
        }
    .end annotation

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 2
    iput-object p1, p0, Lrx/internal/operators/OperatorWithLatestFromMany;->main:Lrx/Observable;

    .line 3
    iput-object p2, p0, Lrx/internal/operators/OperatorWithLatestFromMany;->others:[Lrx/Observable;

    .line 4
    iput-object p3, p0, Lrx/internal/operators/OperatorWithLatestFromMany;->othersIterable:Ljava/lang/Iterable;

    .line 5
    iput-object p4, p0, Lrx/internal/operators/OperatorWithLatestFromMany;->combiner:Lrx/functions/FuncN;

    return-void
.end method


# virtual methods
.method public bridge synthetic call(Ljava/lang/Object;)V
    .registers 2

    .line 1
    check-cast p1, Lrx/Subscriber;

    invoke-virtual {p0, p1}, Lrx/internal/operators/OperatorWithLatestFromMany;->call(Lrx/Subscriber;)V

    return-void
.end method

.method public call(Lrx/Subscriber;)V
    .registers 9
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lrx/Subscriber<",
            "-TR;>;)V"
        }
    .end annotation

    .line 2
    new-instance v0, Lrx/observers/SerializedSubscriber;

    invoke-direct {v0, p1}, Lrx/observers/SerializedSubscriber;-><init>(Lrx/Subscriber;)V

    .line 3
    iget-object v1, p0, Lrx/internal/operators/OperatorWithLatestFromMany;->others:[Lrx/Observable;

    const/4 v2, 0x0

    if-eqz v1, :cond_e

    .line 4
    array-length v3, v1

    move-object v4, v1

    move v1, v3

    goto :goto_38

    :cond_e
    const/16 v1, 0x8

    .line 5
    new-array v1, v1, [Lrx/Observable;

    .line 6
    iget-object v3, p0, Lrx/internal/operators/OperatorWithLatestFromMany;->othersIterable:Ljava/lang/Iterable;

    invoke-interface {v3}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;

    move-result-object v3

    move-object v4, v1

    const/4 v1, 0x0

    :goto_1a
    invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z

    move-result v5

    if-eqz v5, :cond_38

    invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Lrx/Observable;

    .line 7
    array-length v6, v4

    if-ne v1, v6, :cond_32

    shr-int/lit8 v6, v1, 0x2

    add-int/2addr v6, v1

    .line 8
    invoke-static {v4, v6}, Ljava/util/Arrays;->copyOf([Ljava/lang/Object;I)[Ljava/lang/Object;

    move-result-object v4

    check-cast v4, [Lrx/Observable;

    :cond_32
    add-int/lit8 v6, v1, 0x1

    .line 9
    aput-object v5, v4, v1

    move v1, v6

    goto :goto_1a

    .line 10
    :cond_38
    :goto_38
    new-instance v3, Lrx/internal/operators/OperatorWithLatestFromMany$WithLatestMainSubscriber;

    iget-object v5, p0, Lrx/internal/operators/OperatorWithLatestFromMany;->combiner:Lrx/functions/FuncN;

    invoke-direct {v3, p1, v5, v1}, Lrx/internal/operators/OperatorWithLatestFromMany$WithLatestMainSubscriber;-><init>(Lrx/Subscriber;Lrx/functions/FuncN;I)V

    .line 11
    invoke-virtual {v0, v3}, Lrx/Subscriber;->add(Lrx/Subscription;)V

    :goto_42
    if-ge v2, v1, :cond_5c

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

    move-result p1

    if-eqz p1, :cond_4b

    return-void

    .line 13
    :cond_4b
    new-instance p1, Lrx/internal/operators/OperatorWithLatestFromMany$WithLatestOtherSubscriber;

    add-int/lit8 v5, v2, 0x1

    invoke-direct {p1, v3, v5}, Lrx/internal/operators/OperatorWithLatestFromMany$WithLatestOtherSubscriber;-><init>(Lrx/internal/operators/OperatorWithLatestFromMany$WithLatestMainSubscriber;I)V

    .line 14
    invoke-virtual {v3, p1}, Lrx/Subscriber;->add(Lrx/Subscription;)V

    .line 15
    aget-object v2, v4, v2

    .line 16
    invoke-virtual {v2, p1}, Lrx/Observable;->unsafeSubscribe(Lrx/Subscriber;)Lrx/Subscription;

    move v2, v5

    goto :goto_42

    .line 17
    :cond_5c
    iget-object p1, p0, Lrx/internal/operators/OperatorWithLatestFromMany;->main:Lrx/Observable;

    invoke-virtual {p1, v3}, Lrx/Observable;->unsafeSubscribe(Lrx/Subscriber;)Lrx/Subscription;

    return-void
.end method