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

100 lines
2.6 KiB
Java

package o;
import java.util.NoSuchElementException;
/* loaded from: classes6.dex */
public final class fVM<T> extends AbstractC13175fSw<T> implements InterfaceC13204fTr<T> {
private InterfaceC13169fSq<T> b;
private T d;
private long e;
public fVM(InterfaceC13169fSq<T> interfaceC13169fSq, long j, T t) {
this.b = interfaceC13169fSq;
this.e = j;
this.d = t;
}
@Override // o.AbstractC13175fSw
public final void e(InterfaceC13176fSx<? super T> interfaceC13176fSx) {
this.b.subscribe(new IeS(interfaceC13176fSx, this.e, this.d));
}
@Override // o.InterfaceC13204fTr
public final AbstractC13163fSk<T> b() {
return new fVL(this.b, this.e, this.d, true);
}
/* loaded from: classes6.dex */
static final class IeS<T> implements InterfaceC13174fSv<T>, fSJ {
private long a;
private T b;
private InterfaceC13176fSx<? super T> c;
private long d;
private boolean e;
private fSJ h;
IeS(InterfaceC13176fSx<? super T> interfaceC13176fSx, long j, T t) {
this.c = interfaceC13176fSx;
this.d = j;
this.b = t;
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
if (EnumC13192fTf.d(this.h, fsj)) {
this.h = fsj;
this.c.onSubscribe(this);
}
}
@Override // o.fSJ
public final void dispose() {
this.h.dispose();
}
@Override // o.fSJ
public final boolean isDisposed() {
return this.h.isDisposed();
}
@Override // o.InterfaceC13174fSv
public final void onNext(T t) {
if (this.e) {
return;
}
long j = this.a;
if (j != this.d) {
this.a = j + 1;
return;
}
this.e = true;
this.h.dispose();
this.c.e(t);
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
if (this.e) {
C13418fZu.c(th);
} else {
this.e = true;
this.c.onError(th);
}
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
if (this.e) {
return;
}
this.e = true;
T t = this.b;
if (t != null) {
this.c.e(t);
} else {
this.c.onError(new NoSuchElementException());
}
}
}
}