2021-11-08 18:25:28 +00:00
|
|
|
package j0.l.a;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
import j0.g;
|
|
|
|
import j0.k.d;
|
|
|
|
import j0.l.e.h;
|
|
|
|
import j0.l.e.n.y;
|
2021-06-27 20:44:35 +00:00
|
|
|
import java.util.concurrent.atomic.AtomicLong;
|
|
|
|
import rx.Observable;
|
|
|
|
import rx.Producer;
|
|
|
|
import rx.Subscriber;
|
|
|
|
import rx.exceptions.MissingBackpressureException;
|
|
|
|
import rx.functions.Func2;
|
|
|
|
import rx.functions.FuncN;
|
|
|
|
import rx.subscriptions.CompositeSubscription;
|
|
|
|
/* compiled from: OperatorZip */
|
2021-10-19 23:48:27 +00:00
|
|
|
public final class q2<R> implements Observable.b<R, Observable<?>[]> {
|
2021-06-27 20:44:35 +00:00
|
|
|
public final FuncN<? extends R> i;
|
|
|
|
|
|
|
|
/* compiled from: OperatorZip */
|
|
|
|
public static final class a<R> extends AtomicLong {
|
|
|
|
public static final int i = ((int) (((double) h.i) * 0.7d));
|
|
|
|
private static final long serialVersionUID = 5995274816189928317L;
|
|
|
|
public final g<? super R> child;
|
|
|
|
private final CompositeSubscription childSubscription;
|
|
|
|
public int emitted;
|
|
|
|
private AtomicLong requested;
|
|
|
|
private volatile Object[] subscribers;
|
|
|
|
private final FuncN<? extends R> zipFunction;
|
|
|
|
|
|
|
|
/* compiled from: OperatorZip */
|
2021-11-08 18:25:28 +00:00
|
|
|
/* renamed from: j0.l.a.q2$a$a reason: collision with other inner class name */
|
2021-11-03 22:42:40 +00:00
|
|
|
public final class C0326a extends Subscriber {
|
2021-06-27 20:44:35 +00:00
|
|
|
public final h i;
|
|
|
|
|
2021-11-03 22:42:40 +00:00
|
|
|
public C0326a() {
|
2021-06-27 20:44:35 +00:00
|
|
|
int i = h.i;
|
|
|
|
this.i = y.b() ? new h(true, h.i) : new h();
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
2021-06-27 20:44:35 +00:00
|
|
|
public void onCompleted() {
|
|
|
|
h hVar = this.i;
|
|
|
|
if (hVar.k == null) {
|
|
|
|
hVar.k = e.a;
|
|
|
|
}
|
|
|
|
a.this.b();
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
2021-06-27 20:44:35 +00:00
|
|
|
public void onError(Throwable th) {
|
|
|
|
a.this.child.onError(th);
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
2021-06-27 20:44:35 +00:00
|
|
|
public void onNext(Object obj) {
|
|
|
|
try {
|
|
|
|
this.i.a(obj);
|
|
|
|
} catch (MissingBackpressureException e) {
|
|
|
|
a.this.child.onError(e);
|
|
|
|
}
|
|
|
|
a.this.b();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // rx.Subscriber
|
|
|
|
public void onStart() {
|
|
|
|
request((long) h.i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public a(Subscriber<? super R> subscriber, FuncN<? extends R> funcN) {
|
|
|
|
CompositeSubscription compositeSubscription = new CompositeSubscription();
|
|
|
|
this.childSubscription = compositeSubscription;
|
|
|
|
this.child = subscriber;
|
|
|
|
this.zipFunction = funcN;
|
|
|
|
subscriber.add(compositeSubscription);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void a(Observable[] observableArr, AtomicLong atomicLong) {
|
|
|
|
Object[] objArr = new Object[observableArr.length];
|
|
|
|
for (int i2 = 0; i2 < observableArr.length; i2++) {
|
2021-11-03 22:42:40 +00:00
|
|
|
C0326a aVar = new C0326a();
|
2021-06-27 20:44:35 +00:00
|
|
|
objArr[i2] = aVar;
|
|
|
|
this.childSubscription.a(aVar);
|
|
|
|
}
|
|
|
|
this.requested = atomicLong;
|
|
|
|
this.subscribers = objArr;
|
|
|
|
for (int i3 = 0; i3 < observableArr.length; i3++) {
|
2021-11-03 22:42:40 +00:00
|
|
|
observableArr[i3].i0((C0326a) objArr[i3]);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void b() {
|
|
|
|
Object[] objArr = this.subscribers;
|
|
|
|
if (objArr != null && getAndIncrement() == 0) {
|
|
|
|
int length = objArr.length;
|
|
|
|
g<? super R> gVar = this.child;
|
|
|
|
AtomicLong atomicLong = this.requested;
|
|
|
|
while (true) {
|
|
|
|
Object[] objArr2 = new Object[length];
|
|
|
|
boolean z2 = true;
|
|
|
|
for (int i2 = 0; i2 < length; i2++) {
|
2021-11-03 22:42:40 +00:00
|
|
|
Object b = ((C0326a) objArr[i2]).i.b();
|
2021-06-27 20:44:35 +00:00
|
|
|
if (b == null) {
|
|
|
|
z2 = false;
|
|
|
|
} else if (e.c(b)) {
|
|
|
|
gVar.onCompleted();
|
|
|
|
this.childSubscription.unsubscribe();
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
objArr2[i2] = e.b(b);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (z2 && atomicLong.get() > 0) {
|
|
|
|
try {
|
|
|
|
gVar.onNext((Object) this.zipFunction.call(objArr2));
|
|
|
|
atomicLong.decrementAndGet();
|
|
|
|
this.emitted++;
|
|
|
|
for (Object obj : objArr) {
|
2021-11-03 22:42:40 +00:00
|
|
|
h hVar = ((C0326a) obj).i;
|
2021-06-27 20:44:35 +00:00
|
|
|
hVar.c();
|
|
|
|
if (e.c(hVar.b())) {
|
|
|
|
gVar.onCompleted();
|
|
|
|
this.childSubscription.unsubscribe();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (this.emitted > i) {
|
|
|
|
for (Object obj2 : objArr) {
|
2021-11-03 22:42:40 +00:00
|
|
|
((C0326a) obj2).request((long) this.emitted);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
this.emitted = 0;
|
|
|
|
}
|
|
|
|
} catch (Throwable th) {
|
2021-11-08 18:25:28 +00:00
|
|
|
h0.b.a.f.a.j(th, gVar, objArr2);
|
2021-06-27 20:44:35 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else if (decrementAndGet() <= 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: OperatorZip */
|
|
|
|
public static final class b<R> extends AtomicLong implements Producer {
|
|
|
|
private static final long serialVersionUID = -1216676403723546796L;
|
|
|
|
public final a<R> zipper;
|
|
|
|
|
|
|
|
public b(a<R> aVar) {
|
|
|
|
this.zipper = aVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // rx.Producer
|
|
|
|
public void j(long j) {
|
2021-11-08 18:25:28 +00:00
|
|
|
h0.b.a.f.a.b(this, j);
|
2021-06-27 20:44:35 +00:00
|
|
|
this.zipper.b();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: OperatorZip */
|
|
|
|
public final class c extends Subscriber<Observable[]> {
|
|
|
|
public final Subscriber<? super R> i;
|
|
|
|
public final a<R> j;
|
|
|
|
public final b<R> k;
|
|
|
|
public boolean l;
|
|
|
|
|
2021-10-19 23:48:27 +00:00
|
|
|
public c(q2 q2Var, Subscriber<? super R> subscriber, a<R> aVar, b<R> bVar) {
|
2021-06-27 20:44:35 +00:00
|
|
|
this.i = subscriber;
|
|
|
|
this.j = aVar;
|
|
|
|
this.k = bVar;
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
2021-06-27 20:44:35 +00:00
|
|
|
public void onCompleted() {
|
|
|
|
if (!this.l) {
|
|
|
|
this.i.onCompleted();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
2021-06-27 20:44:35 +00:00
|
|
|
public void onError(Throwable th) {
|
|
|
|
this.i.onError(th);
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
2021-06-27 20:44:35 +00:00
|
|
|
public void onNext(Object obj) {
|
|
|
|
Observable[] observableArr = (Observable[]) obj;
|
|
|
|
if (observableArr == null || observableArr.length == 0) {
|
|
|
|
this.i.onCompleted();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.l = true;
|
|
|
|
this.j.a(observableArr, this.k);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-19 23:48:27 +00:00
|
|
|
public q2(Func2 func2) {
|
2021-06-27 20:44:35 +00:00
|
|
|
this.i = new d(func2);
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.k.b
|
2021-06-27 20:44:35 +00:00
|
|
|
public Object call(Object obj) {
|
|
|
|
Subscriber subscriber = (Subscriber) obj;
|
|
|
|
a aVar = new a(subscriber, this.i);
|
|
|
|
b bVar = new b(aVar);
|
|
|
|
c cVar = new c(this, subscriber, aVar, bVar);
|
|
|
|
subscriber.add(cVar);
|
|
|
|
subscriber.setProducer(bVar);
|
|
|
|
return cVar;
|
|
|
|
}
|
|
|
|
}
|