what-the-bank/sources/o/C13375fYn.java

160 lines
4.8 KiB
Java

package o;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import o.C13372fYk;
/* renamed from: o.fYn, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
public final class C13375fYn<T, R> extends AbstractC13175fSw<R> {
private fSD<? extends T>[] a;
final fSS<? super Object[], ? extends R> b;
public C13375fYn(fSD<? extends T>[] fsdArr, fSS<? super Object[], ? extends R> fss) {
this.a = fsdArr;
this.b = fss;
}
@Override // o.AbstractC13175fSw
public final void e(InterfaceC13176fSx<? super R> interfaceC13176fSx) {
fSD<? extends T>[] fsdArr = this.a;
int length = fsdArr.length;
if (length == 1) {
fsdArr[0].c(new C13372fYk.RVV(interfaceC13176fSx, new HBt(this)));
return;
}
RVV rvv = new RVV(interfaceC13176fSx, length, this.b);
interfaceC13176fSx.onSubscribe(rvv);
for (int i = 0; i < length && !rvv.isDisposed(); i++) {
fSD<? extends T> fsd = fsdArr[i];
if (fsd == null) {
rvv.b(new NullPointerException("One of the sources is null"), i);
return;
}
fsd.c(rvv.e[i]);
}
}
/* renamed from: o.fYn$RVV */
/* loaded from: classes6.dex */
static final class RVV<T, R> extends AtomicInteger implements fSJ {
Object[] a;
final fSS<? super Object[], ? extends R> c;
final InterfaceC13176fSx<? super R> d;
final Sts<T>[] e;
RVV(InterfaceC13176fSx<? super R> interfaceC13176fSx, int i, fSS<? super Object[], ? extends R> fss) {
super(i);
this.d = interfaceC13176fSx;
this.c = fss;
Sts<T>[] stsArr = new Sts[i];
for (int i2 = 0; i2 < i; i2++) {
stsArr[i2] = new Sts<>(this, i2);
}
this.e = stsArr;
this.a = new Object[i];
}
@Override // o.fSJ
public final boolean isDisposed() {
return get() <= 0;
}
@Override // o.fSJ
public final void dispose() {
if (getAndSet(0) > 0) {
for (Sts<T> sts : this.e) {
EnumC13192fTf.e(sts);
}
this.a = null;
}
}
private void e(int i) {
Sts<T>[] stsArr = this.e;
int length = stsArr.length;
for (int i2 = 0; i2 < i; i2++) {
EnumC13192fTf.e(stsArr[i2]);
}
while (true) {
i++;
if (i >= length) {
return;
} else {
EnumC13192fTf.e(stsArr[i]);
}
}
}
final void b(Throwable th, int i) {
if (getAndSet(0) > 0) {
e(i);
this.a = null;
this.d.onError(th);
return;
}
C13418fZu.c(th);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: o.fYn$Sts */
/* loaded from: classes6.dex */
public static final class Sts<T> extends AtomicReference<fSJ> implements InterfaceC13176fSx<T> {
private RVV<T, ?> a;
private int d;
Sts(RVV<T, ?> rvv, int i) {
this.a = rvv;
this.d = i;
}
@Override // o.InterfaceC13176fSx
public final void onSubscribe(fSJ fsj) {
EnumC13192fTf.a(this, fsj);
}
@Override // o.InterfaceC13176fSx
public final void e(T t) {
RVV<T, ?> rvv = this.a;
int i = this.d;
Object[] objArr = rvv.a;
if (objArr != null) {
objArr[i] = t;
}
if (rvv.decrementAndGet() == 0) {
try {
Object requireNonNull = Objects.requireNonNull(rvv.c.a(objArr), "The zipper returned a null value");
rvv.a = null;
rvv.d.e(requireNonNull);
} catch (Throwable th) {
C13147fSI.c(th);
rvv.a = null;
rvv.d.onError(th);
}
}
}
@Override // o.InterfaceC13176fSx
public final void onError(Throwable th) {
this.a.b(th, this.d);
}
}
/* renamed from: o.fYn$HBt */
/* loaded from: classes6.dex */
final class HBt implements fSS<T, R> {
private C13375fYn c;
HBt(C13375fYn c13375fYn) {
this.c = c13375fYn;
}
@Override // o.fSS
public final R a(T t) throws Throwable {
return (R) Objects.requireNonNull(this.c.b.a(new Object[]{t}), "The zipper returned a null value");
}
}
}