2021-06-27 20:44:35 +00:00
|
|
|
package j0.l.a;
|
|
|
|
|
|
|
|
import j0.g;
|
|
|
|
import j0.k.d;
|
|
|
|
import j0.l.e.h;
|
|
|
|
import j0.l.e.n.y;
|
|
|
|
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 */
|
|
|
|
public final class r2<R> implements Observable.b<R, Observable<?>[]> {
|
|
|
|
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 */
|
|
|
|
/* renamed from: j0.l.a.r2$a$a reason: collision with other inner class name */
|
|
|
|
public final class C0320a extends Subscriber {
|
|
|
|
public final h i;
|
|
|
|
|
|
|
|
public C0320a() {
|
|
|
|
int i = h.i;
|
|
|
|
this.i = y.b() ? new h(true, h.i) : new h();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // j0.g
|
|
|
|
public void onCompleted() {
|
|
|
|
h hVar = this.i;
|
|
|
|
if (hVar.k == null) {
|
|
|
|
hVar.k = e.a;
|
|
|
|
}
|
|
|
|
a.this.b();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // j0.g
|
|
|
|
public void onError(Throwable th) {
|
|
|
|
a.this.child.onError(th);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // j0.g
|
|
|
|
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++) {
|
|
|
|
C0320a aVar = new C0320a();
|
|
|
|
objArr[i2] = aVar;
|
|
|
|
this.childSubscription.a(aVar);
|
|
|
|
}
|
|
|
|
this.requested = atomicLong;
|
|
|
|
this.subscribers = objArr;
|
|
|
|
for (int i3 = 0; i3 < observableArr.length; i3++) {
|
2021-07-03 23:36:06 +00:00
|
|
|
observableArr[i3].i0((C0320a) 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++) {
|
|
|
|
Object b = ((C0320a) objArr[i2]).i.b();
|
|
|
|
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) {
|
|
|
|
h hVar = ((C0320a) obj).i;
|
|
|
|
hVar.c();
|
|
|
|
if (e.c(hVar.b())) {
|
|
|
|
gVar.onCompleted();
|
|
|
|
this.childSubscription.unsubscribe();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (this.emitted > i) {
|
|
|
|
for (Object obj2 : objArr) {
|
|
|
|
((C0320a) obj2).request((long) this.emitted);
|
|
|
|
}
|
|
|
|
this.emitted = 0;
|
|
|
|
}
|
|
|
|
} catch (Throwable th) {
|
2021-06-27 20:53:42 +00:00
|
|
|
c.q.a.k.a.b0(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-06-27 20:53:42 +00:00
|
|
|
c.q.a.k.a.p(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;
|
|
|
|
|
|
|
|
public c(r2 r2Var, Subscriber<? super R> subscriber, a<R> aVar, b<R> bVar) {
|
|
|
|
this.i = subscriber;
|
|
|
|
this.j = aVar;
|
|
|
|
this.k = bVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // j0.g
|
|
|
|
public void onCompleted() {
|
|
|
|
if (!this.l) {
|
|
|
|
this.i.onCompleted();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // j0.g
|
|
|
|
public void onError(Throwable th) {
|
|
|
|
this.i.onError(th);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // j0.g
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public r2(Func2 func2) {
|
|
|
|
this.i = new d(func2);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // j0.k.b
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|