196 lines
6.3 KiB
Java
196 lines
6.3 KiB
Java
package o;
|
|
|
|
import java.util.Arrays;
|
|
import java.util.Iterator;
|
|
import o.wDL;
|
|
|
|
/* renamed from: o.mrx, reason: case insensitive filesystem */
|
|
/* loaded from: classes.dex */
|
|
final class C16274mrx {
|
|
|
|
/* renamed from: o.mrx$Sts */
|
|
/* loaded from: classes.dex */
|
|
public static abstract class Sts<E, T_ARR, T_CONS> implements Iterable<E> {
|
|
int a;
|
|
public int b;
|
|
long[] c;
|
|
T_ARR[] e;
|
|
private int f = 4;
|
|
public T_ARR d = b(16);
|
|
|
|
protected abstract int a(T_ARR t_arr);
|
|
|
|
protected abstract T_ARR b(int i);
|
|
|
|
protected abstract T_ARR[] c();
|
|
|
|
Sts() {
|
|
}
|
|
|
|
public final long d() {
|
|
int i = this.a;
|
|
return i == 0 ? this.b : this.c[i] + this.b;
|
|
}
|
|
|
|
private long f() {
|
|
int i = this.a;
|
|
if (i == 0) {
|
|
return a((Sts<E, T_ARR, T_CONS>) this.d);
|
|
}
|
|
return a((Sts<E, T_ARR, T_CONS>) this.e[i]) + this.c[i];
|
|
}
|
|
|
|
private void e() {
|
|
if (this.e == null) {
|
|
T_ARR[] c = c();
|
|
this.e = c;
|
|
this.c = new long[8];
|
|
c[0] = this.d;
|
|
}
|
|
}
|
|
|
|
final int a(long j) {
|
|
if (this.a == 0) {
|
|
if (j < this.b) {
|
|
return 0;
|
|
}
|
|
throw new IndexOutOfBoundsException(Long.toString(j));
|
|
}
|
|
if (j >= d()) {
|
|
throw new IndexOutOfBoundsException(Long.toString(j));
|
|
}
|
|
for (int i = 0; i <= this.a; i++) {
|
|
if (j < this.c[i] + a((Sts<E, T_ARR, T_CONS>) this.e[i])) {
|
|
return i;
|
|
}
|
|
}
|
|
throw new IndexOutOfBoundsException(Long.toString(j));
|
|
}
|
|
|
|
public final T_ARR a() {
|
|
long d = d();
|
|
if (d < 2147483639) {
|
|
T_ARR b = b((int) d);
|
|
long d2 = d();
|
|
if (d2 > a((Sts<E, T_ARR, T_CONS>) b) || d2 < 0) {
|
|
throw new IndexOutOfBoundsException("does not fit");
|
|
}
|
|
if (this.a == 0) {
|
|
System.arraycopy(this.d, 0, b, 0, this.b);
|
|
} else {
|
|
int i = 0;
|
|
for (int i2 = 0; i2 < this.a; i2++) {
|
|
T_ARR t_arr = this.e[i2];
|
|
System.arraycopy(t_arr, 0, b, i, a((Sts<E, T_ARR, T_CONS>) t_arr));
|
|
i += a((Sts<E, T_ARR, T_CONS>) this.e[i2]);
|
|
}
|
|
int i3 = this.b;
|
|
if (i3 > 0) {
|
|
System.arraycopy(this.d, 0, b, i, i3);
|
|
}
|
|
}
|
|
return b;
|
|
}
|
|
throw new IllegalArgumentException("Stream size exceeds max array size");
|
|
}
|
|
|
|
public final void b() {
|
|
if (this.b == a((Sts<E, T_ARR, T_CONS>) this.d)) {
|
|
e();
|
|
int i = this.a;
|
|
T_ARR[] t_arrArr = this.e;
|
|
int i2 = i + 1;
|
|
if (i2 >= t_arrArr.length || t_arrArr[i2] == null) {
|
|
long f = f() + 1;
|
|
long f2 = f();
|
|
if (f > f2) {
|
|
e();
|
|
int i3 = this.a;
|
|
while (true) {
|
|
int i4 = i3 + 1;
|
|
if (f <= f2) {
|
|
break;
|
|
}
|
|
T_ARR[] t_arrArr2 = this.e;
|
|
if (i4 >= t_arrArr2.length) {
|
|
int length = t_arrArr2.length << 1;
|
|
this.e = (T_ARR[]) Arrays.copyOf(t_arrArr2, length);
|
|
this.c = Arrays.copyOf(this.c, length);
|
|
}
|
|
int min = 1 << ((i4 == 0 || i4 == 1) ? this.f : Math.min((this.f + i4) - 1, 30));
|
|
this.e[i4] = b(min);
|
|
long[] jArr = this.c;
|
|
jArr[i4] = jArr[i3] + a((Sts<E, T_ARR, T_CONS>) this.e[i3]);
|
|
f2 += min;
|
|
i3 = i4;
|
|
}
|
|
}
|
|
}
|
|
this.b = 0;
|
|
int i5 = this.a + 1;
|
|
this.a = i5;
|
|
this.d = this.e[i5];
|
|
}
|
|
}
|
|
}
|
|
|
|
/* renamed from: o.mrx$IeS */
|
|
/* loaded from: classes.dex */
|
|
public static class IeS extends Sts<Integer, int[], InterfaceC4998bkj> implements InterfaceC4998bkj {
|
|
@Override // o.C16274mrx.Sts
|
|
protected final /* bridge */ /* synthetic */ int a(int[] iArr) {
|
|
return iArr.length;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // o.InterfaceC4998bkj
|
|
public final void d(int i) {
|
|
b();
|
|
int[] iArr = (int[]) this.d;
|
|
int i2 = this.b;
|
|
this.b = i2 + 1;
|
|
iArr[i2] = i;
|
|
}
|
|
|
|
@Override // java.lang.Iterable
|
|
public final /* synthetic */ Iterator iterator() {
|
|
return new wDL.IeS(this) { // from class: o.mrx.IeS.1
|
|
private IeS a;
|
|
private long c = 0;
|
|
|
|
{
|
|
this.a = this;
|
|
}
|
|
|
|
@Override // java.util.Iterator
|
|
public final boolean hasNext() {
|
|
return this.c < this.a.d();
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // o.wDL.IeS
|
|
public final int e() {
|
|
IeS ieS = this.a;
|
|
long j = this.c;
|
|
this.c = 1 + j;
|
|
int a = ieS.a(j);
|
|
if (ieS.a == 0 && a == 0) {
|
|
return ((int[]) ieS.d)[(int) j];
|
|
}
|
|
return ((int[][]) ieS.e)[a][(int) (j - ieS.c[a])];
|
|
}
|
|
};
|
|
}
|
|
|
|
@Override // o.C16274mrx.Sts
|
|
public final /* bridge */ /* synthetic */ int[] b(int i) {
|
|
return new int[i];
|
|
}
|
|
|
|
@Override // o.C16274mrx.Sts
|
|
protected final /* bridge */ /* synthetic */ int[][] c() {
|
|
return new int[8];
|
|
}
|
|
}
|
|
}
|