ObservableAmb.smali

.class public final Lio/reactivex/internal/operators/observable/ObservableAmb;
.super Lio/reactivex/k;
.source "ObservableAmb.java"


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "<T:",
        "Ljava/lang/Object;",
        ">",
        "Lio/reactivex/k",
        "<TT;>;"
    }
.end annotation


# instance fields
.field private bPi:[Lio/reactivex/p;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "[",
            "Lio/reactivex/p",
            "<+TT;>;"
        }
    .end annotation
.end field

.field private bPj:Ljava/lang/Iterable;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/Iterable",
            "<+",
            "Lio/reactivex/p",
            "<+TT;>;>;"
        }
    .end annotation
.end field


# direct methods
.method public constructor <init>([Lio/reactivex/p;Ljava/lang/Iterable;)V
    .registers 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "([",
            "Lio/reactivex/p",
            "<+TT;>;",
            "Ljava/lang/Iterable",
            "<+",
            "Lio/reactivex/p",
            "<+TT;>;>;)V"
        }
    .end annotation

    .prologue
    .line 28
    invoke-direct {p0}, Lio/reactivex/k;-><init>()V

    .line 29
    iput-object p1, p0, Lio/reactivex/internal/operators/observable/ObservableAmb;->bPi:[Lio/reactivex/p;

    .line 30
    iput-object p2, p0, Lio/reactivex/internal/operators/observable/ObservableAmb;->bPj:Ljava/lang/Iterable;

    .line 31
    return-void
.end method


# virtual methods
.method public final subscribeActual(Lio/reactivex/r;)V
    .registers 10
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lio/reactivex/r",
            "<-TT;>;)V"
        }
    .end annotation

    .prologue
    const/4 v3, 0x0

    .line 36
    iget-object v1, p0, Lio/reactivex/internal/operators/observable/ObservableAmb;->bPi:[Lio/reactivex/p;

    .line 38
    if-nez v1, :cond_4d

    .line 39
    const/16 v0, 0x8

    new-array v2, v0, [Lio/reactivex/k;

    .line 41
    :try_start_9
    iget-object v0, p0, Lio/reactivex/internal/operators/observable/ObservableAmb;->bPj:Ljava/lang/Iterable;

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

    move-result-object v5

    move v1, v3

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

    move-result v0

    if-eqz v0, :cond_3d

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

    move-result-object v0

    check-cast v0, Lio/reactivex/p;

    .line 42
    if-nez v0, :cond_29

    .line 43
    new-instance v0, Ljava/lang/NullPointerException;

    const-string v1, "One of the sources is null"

    invoke-direct {v0, v1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V

    invoke-static {v0, p1}, Lio/reactivex/internal/disposables/EmptyDisposable;->error(Ljava/lang/Throwable;Lio/reactivex/r;)V

    .line 73
    :goto_28
    return-void

    .line 46
    :cond_29
    array-length v4, v2

    if-ne v1, v4, :cond_61

    .line 47
    shr-int/lit8 v4, v1, 0x2

    add-int/2addr v4, v1

    new-array v4, v4, [Lio/reactivex/p;

    .line 48
    const/4 v6, 0x0

    const/4 v7, 0x0

    invoke-static {v2, v6, v4, v7, v1}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    .line 51
    :goto_36
    add-int/lit8 v2, v1, 0x1

    aput-object v0, v4, v1
    :try_end_3a
    .catch Ljava/lang/Throwable; {:try_start_9 .. :try_end_3a} :catch_45

    move v1, v2

    move-object v2, v4

    .line 52
    goto :goto_10

    :cond_3d
    move v0, v1

    move-object v1, v2

    .line 62
    :goto_3f
    if-nez v0, :cond_4f

    .line 63
    invoke-static {p1}, Lio/reactivex/internal/disposables/EmptyDisposable;->complete(Lio/reactivex/r;)V

    goto :goto_28

    .line 53
    :catch_45
    move-exception v0

    .line 54
    invoke-static {v0}, Lio/reactivex/exceptions/d;->throwIfFatal(Ljava/lang/Throwable;)V

    .line 55
    invoke-static {v0, p1}, Lio/reactivex/internal/disposables/EmptyDisposable;->error(Ljava/lang/Throwable;Lio/reactivex/r;)V

    goto :goto_28

    .line 59
    :cond_4d
    array-length v0, v1

    goto :goto_3f

    .line 66
    :cond_4f
    const/4 v2, 0x1

    if-ne v0, v2, :cond_58

    .line 67
    aget-object v0, v1, v3

    invoke-interface {v0, p1}, Lio/reactivex/p;->subscribe(Lio/reactivex/r;)V

    goto :goto_28

    .line 71
    :cond_58
    new-instance v2, Lio/reactivex/internal/operators/observable/n;

    invoke-direct {v2, p1, v0}, Lio/reactivex/internal/operators/observable/n;-><init>(Lio/reactivex/r;I)V

    .line 72
    invoke-virtual {v2, v1}, Lio/reactivex/internal/operators/observable/n;->subscribe([Lio/reactivex/p;)V

    goto :goto_28

    :cond_61
    move-object v4, v2

    goto :goto_36
.end method