discord-jadx/app/src/main/java/d0/f0/j.java

138 lines
4.0 KiB
Java
Raw Normal View History

2021-11-02 06:38:17 +00:00
package d0.f0;
2021-08-03 07:33:18 +00:00
2021-11-02 06:38:17 +00:00
import d0.k;
import d0.l;
import d0.w.f;
import d0.w.h.c;
import d0.w.i.a.g;
import d0.z.d.g0.a;
import d0.z.d.m;
2021-08-03 07:33:18 +00:00
import java.util.Iterator;
import java.util.NoSuchElementException;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
/* compiled from: SequenceBuilder.kt */
2022-03-07 09:34:54 +00:00
/* loaded from: classes3.dex */
2021-08-03 07:33:18 +00:00
public final class j<T> extends k<T> implements Iterator<T>, Continuation<Unit>, a {
2021-12-02 18:53:44 +00:00
public int j;
public T k;
public Iterator<? extends T> l;
public Continuation<? super Unit> m;
2021-08-03 07:33:18 +00:00
2021-12-02 18:53:44 +00:00
public final Throwable b() {
int i = this.j;
2021-08-03 07:33:18 +00:00
if (i == 4) {
return new NoSuchElementException();
}
if (i == 5) {
return new IllegalStateException("Iterator has failed.");
}
2022-03-21 18:52:30 +00:00
StringBuilder R = b.d.b.a.a.R("Unexpected state of the iterator: ");
R.append(this.j);
return new IllegalStateException(R.toString());
2021-08-03 07:33:18 +00:00
}
@Override // kotlin.coroutines.Continuation
public CoroutineContext getContext() {
2021-12-02 18:53:44 +00:00
return f.j;
2021-08-03 07:33:18 +00:00
}
@Override // java.util.Iterator
public boolean hasNext() {
while (true) {
2021-12-02 18:53:44 +00:00
int i = this.j;
2021-08-03 07:33:18 +00:00
if (i != 0) {
if (i == 1) {
2021-12-02 18:53:44 +00:00
Iterator<? extends T> it = this.l;
2021-08-03 07:33:18 +00:00
m.checkNotNull(it);
if (it.hasNext()) {
2021-12-02 18:53:44 +00:00
this.j = 2;
2021-08-03 07:33:18 +00:00
return true;
}
2021-12-02 18:53:44 +00:00
this.l = null;
2021-08-03 07:33:18 +00:00
} else if (i == 2 || i == 3) {
return true;
} else {
if (i == 4) {
return false;
}
2021-12-02 18:53:44 +00:00
throw b();
2021-08-03 07:33:18 +00:00
}
}
2021-12-02 18:53:44 +00:00
this.j = 5;
Continuation<? super Unit> continuation = this.m;
2021-08-03 07:33:18 +00:00
m.checkNotNull(continuation);
2021-12-02 18:53:44 +00:00
this.m = null;
2021-08-03 07:33:18 +00:00
Unit unit = Unit.a;
2021-12-02 18:53:44 +00:00
k.a aVar = k.j;
2021-11-02 06:38:17 +00:00
continuation.resumeWith(k.m72constructorimpl(unit));
2021-08-03 07:33:18 +00:00
}
}
@Override // java.util.Iterator
public T next() {
2021-12-02 18:53:44 +00:00
int i = this.j;
2021-08-03 07:33:18 +00:00
if (i == 0 || i == 1) {
if (hasNext()) {
return next();
}
throw new NoSuchElementException();
} else if (i == 2) {
2021-12-02 18:53:44 +00:00
this.j = 1;
Iterator<? extends T> it = this.l;
2021-08-03 07:33:18 +00:00
m.checkNotNull(it);
return (T) it.next();
} else if (i == 3) {
2021-12-02 18:53:44 +00:00
this.j = 0;
T t = this.k;
this.k = null;
2021-08-03 07:33:18 +00:00
return t;
} else {
2021-12-02 18:53:44 +00:00
throw b();
2021-08-03 07:33:18 +00:00
}
}
@Override // java.util.Iterator
public void remove() {
throw new UnsupportedOperationException("Operation is not supported for read-only collection");
}
@Override // kotlin.coroutines.Continuation
public void resumeWith(Object obj) {
l.throwOnFailure(obj);
2021-12-02 18:53:44 +00:00
this.j = 4;
2021-08-03 07:33:18 +00:00
}
public final void setNextStep(Continuation<? super Unit> continuation) {
2021-12-02 18:53:44 +00:00
this.m = continuation;
2021-08-03 07:33:18 +00:00
}
2021-11-02 06:38:17 +00:00
@Override // d0.f0.k
2021-08-03 07:33:18 +00:00
public Object yield(T t, Continuation<? super Unit> continuation) {
2021-12-02 18:53:44 +00:00
this.k = t;
this.j = 3;
this.m = continuation;
2021-08-03 07:33:18 +00:00
Object coroutine_suspended = c.getCOROUTINE_SUSPENDED();
if (coroutine_suspended == c.getCOROUTINE_SUSPENDED()) {
g.probeCoroutineSuspended(continuation);
}
return coroutine_suspended == c.getCOROUTINE_SUSPENDED() ? coroutine_suspended : Unit.a;
}
2021-11-02 06:38:17 +00:00
@Override // d0.f0.k
2021-08-03 07:33:18 +00:00
public Object yieldAll(Iterator<? extends T> it, Continuation<? super Unit> continuation) {
if (!it.hasNext()) {
return Unit.a;
}
2021-12-02 18:53:44 +00:00
this.l = it;
this.j = 2;
this.m = continuation;
2021-08-03 07:33:18 +00:00
Object coroutine_suspended = c.getCOROUTINE_SUSPENDED();
if (coroutine_suspended == c.getCOROUTINE_SUSPENDED()) {
g.probeCoroutineSuspended(continuation);
}
return coroutine_suspended == c.getCOROUTINE_SUSPENDED() ? coroutine_suspended : Unit.a;
}
}