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

80 lines
2.4 KiB
Java

package o;
import java.util.concurrent.atomic.AtomicInteger;
/* renamed from: o.fWR, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
public final class C13289fWR<T> extends fUX<T, T> {
private long d;
public C13289fWR(AbstractC13163fSk<T> abstractC13163fSk, long j) {
super(abstractC13163fSk);
this.d = j;
}
@Override // o.AbstractC13163fSk
public final void subscribeActual(InterfaceC13174fSv<? super T> interfaceC13174fSv) {
C13197fTk c13197fTk = new C13197fTk();
interfaceC13174fSv.onSubscribe(c13197fTk);
long j = this.d;
new RVV(interfaceC13174fSv, j != Long.MAX_VALUE ? j - 1 : Long.MAX_VALUE, c13197fTk, this.c).d();
}
/* renamed from: o.fWR$RVV */
/* loaded from: classes6.dex */
static final class RVV<T> extends AtomicInteger implements InterfaceC13174fSv<T> {
private InterfaceC13169fSq<? extends T> a;
private long b;
private InterfaceC13174fSv<? super T> c;
private C13197fTk d;
RVV(InterfaceC13174fSv<? super T> interfaceC13174fSv, long j, C13197fTk c13197fTk, InterfaceC13169fSq<? extends T> interfaceC13169fSq) {
this.c = interfaceC13174fSv;
this.d = c13197fTk;
this.a = interfaceC13169fSq;
this.b = j;
}
@Override // o.InterfaceC13174fSv
public final void onNext(T t) {
this.c.onNext(t);
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
this.c.onError(th);
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
long j = this.b;
if (j != Long.MAX_VALUE) {
this.b = j - 1;
}
if (j != 0) {
d();
} else {
this.c.onComplete();
}
}
final void d() {
if (getAndIncrement() == 0) {
int i = 1;
while (!this.d.isDisposed()) {
this.a.subscribe(this);
i = addAndGet(-i);
if (i == 0) {
return;
}
}
}
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
EnumC13192fTf.c(this.d, fsj);
}
}
}