2021-11-08 18:25:28 +00:00
|
|
|
package j0.l.a;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
2021-08-09 22:50:01 +00:00
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
2022-01-27 00:50:41 +00:00
|
|
|
import b.i.a.f.e.o.f;
|
2021-06-27 20:44:35 +00:00
|
|
|
import java.util.concurrent.atomic.AtomicLong;
|
|
|
|
import rx.Observable;
|
|
|
|
import rx.Producer;
|
|
|
|
import rx.Subscriber;
|
2022-03-02 20:59:20 +00:00
|
|
|
/* compiled from: OnSubscribeFromArray.java */
|
|
|
|
/* loaded from: classes3.dex */
|
2021-06-27 20:44:35 +00:00
|
|
|
public final class o<T> implements Observable.a<T> {
|
2021-12-17 22:03:14 +00:00
|
|
|
public final T[] j;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
2022-03-02 20:59:20 +00:00
|
|
|
/* compiled from: OnSubscribeFromArray.java */
|
|
|
|
/* loaded from: classes3.dex */
|
2021-06-27 20:44:35 +00:00
|
|
|
public static final class a<T> extends AtomicLong implements Producer {
|
|
|
|
private static final long serialVersionUID = 3534218984725836979L;
|
|
|
|
public final T[] array;
|
|
|
|
public final Subscriber<? super T> child;
|
|
|
|
public int index;
|
|
|
|
|
|
|
|
public a(Subscriber<? super T> subscriber, T[] tArr) {
|
|
|
|
this.child = subscriber;
|
|
|
|
this.array = tArr;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // rx.Producer
|
|
|
|
public void j(long j) {
|
2022-03-02 20:59:20 +00:00
|
|
|
int i = (j > 0L ? 1 : (j == 0L ? 0 : -1));
|
2021-06-27 20:44:35 +00:00
|
|
|
if (i < 0) {
|
2021-12-21 23:37:30 +00:00
|
|
|
throw new IllegalArgumentException(b.d.b.a.a.s("n >= 0 required but it was ", j));
|
2021-08-09 22:50:01 +00:00
|
|
|
} else if (j == RecyclerView.FOREVER_NS) {
|
2022-01-27 00:50:41 +00:00
|
|
|
if (f.c0(this, j) == 0) {
|
2021-06-27 20:44:35 +00:00
|
|
|
Subscriber<? super T> subscriber = this.child;
|
2022-03-02 20:59:20 +00:00
|
|
|
for (T t : this.array) {
|
|
|
|
Object obj = (Object) t;
|
2021-06-27 20:44:35 +00:00
|
|
|
if (!subscriber.isUnsubscribed()) {
|
2022-03-02 20:59:20 +00:00
|
|
|
subscriber.onNext(obj);
|
2021-06-27 20:44:35 +00:00
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!subscriber.isUnsubscribed()) {
|
|
|
|
subscriber.onCompleted();
|
|
|
|
}
|
|
|
|
}
|
2022-01-27 00:50:41 +00:00
|
|
|
} else if (i != 0 && f.c0(this, j) == 0) {
|
2021-06-27 20:44:35 +00:00
|
|
|
Subscriber<? super T> subscriber2 = this.child;
|
2022-03-02 20:59:20 +00:00
|
|
|
T[] tArr = this.array;
|
|
|
|
int length = tArr.length;
|
2021-06-27 20:44:35 +00:00
|
|
|
int i2 = this.index;
|
|
|
|
do {
|
|
|
|
long j2 = 0;
|
|
|
|
while (true) {
|
|
|
|
if (j == 0 || i2 == length) {
|
|
|
|
j = get() + j2;
|
|
|
|
if (j == 0) {
|
|
|
|
this.index = i2;
|
|
|
|
j = addAndGet(j2);
|
|
|
|
}
|
|
|
|
} else if (!subscriber2.isUnsubscribed()) {
|
2022-03-02 20:59:20 +00:00
|
|
|
subscriber2.onNext((Object) tArr[i2]);
|
2021-06-27 20:44:35 +00:00
|
|
|
i2++;
|
|
|
|
if (i2 != length) {
|
|
|
|
j--;
|
|
|
|
j2--;
|
|
|
|
} else if (!subscriber2.isUnsubscribed()) {
|
|
|
|
subscriber2.onCompleted();
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} while (j != 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public o(T[] tArr) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.j = tArr;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // rx.functions.Action1
|
|
|
|
public void call(Object obj) {
|
|
|
|
Subscriber subscriber = (Subscriber) obj;
|
2021-12-17 22:03:14 +00:00
|
|
|
subscriber.setProducer(new a(subscriber, this.j));
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|