package o; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import java.util.Arrays; import o.paA; /* renamed from: o.sEz, reason: case insensitive filesystem */ /* loaded from: classes.dex */ public final class C16896sEz implements paA.Sts { protected final ogI c; private final paA k; private int d = 0; private int e = 8; private EsB b = null; private int[] a = new int[8]; private int[] j = new int[8]; private float[] i = new float[8]; private int g = -1; private int f = -1; private boolean h = false; /* JADX INFO: Access modifiers changed from: package-private */ public C16896sEz(paA paa, ogI ogi) { this.k = paa; this.c = ogi; } @Override // o.paA.Sts public final void e(EsB esB, float f) { if (f == BitmapDescriptorFactory.HUE_RED) { c(esB, true); return; } int i = this.g; if (i == -1) { this.g = 0; this.i[0] = f; this.a[0] = esB.d; this.j[this.g] = -1; esB.l++; esB.e(this.k); this.d++; if (this.h) { return; } int i2 = this.f + 1; this.f = i2; int[] iArr = this.a; if (i2 >= iArr.length) { this.h = true; this.f = iArr.length - 1; return; } return; } int i3 = -1; for (int i4 = 0; i != -1 && i4 < this.d; i4++) { if (this.a[i] == esB.d) { this.i[i] = f; return; } if (this.a[i] < esB.d) { i3 = i; } i = this.j[i]; } int i5 = this.f; if (this.h) { int[] iArr2 = this.a; if (iArr2[i5] != -1) { i5 = iArr2.length; } } else { i5++; } int[] iArr3 = this.a; if (i5 >= iArr3.length && this.d < iArr3.length) { int i6 = 0; while (true) { int[] iArr4 = this.a; if (i6 >= iArr4.length) { break; } if (iArr4[i6] == -1) { i5 = i6; break; } i6++; } } int[] iArr5 = this.a; if (i5 >= iArr5.length) { i5 = iArr5.length; int i7 = this.e << 1; this.e = i7; this.h = false; this.f = i5 - 1; this.i = Arrays.copyOf(this.i, i7); this.a = Arrays.copyOf(this.a, this.e); this.j = Arrays.copyOf(this.j, this.e); } this.a[i5] = esB.d; this.i[i5] = f; if (i3 != -1) { int[] iArr6 = this.j; iArr6[i5] = iArr6[i3]; iArr6[i3] = i5; } else { this.j[i5] = this.g; this.g = i5; } esB.l++; esB.e(this.k); int i8 = this.d + 1; this.d = i8; if (!this.h) { this.f++; } int[] iArr7 = this.a; if (i8 >= iArr7.length) { this.h = true; } if (this.f >= iArr7.length) { this.h = true; this.f = iArr7.length - 1; } } @Override // o.paA.Sts public final void b(EsB esB, float f, boolean z) { if (f <= -0.001f || f >= 0.001f) { int i = this.g; if (i == -1) { this.g = 0; this.i[0] = f; this.a[0] = esB.d; this.j[this.g] = -1; esB.l++; esB.e(this.k); this.d++; if (this.h) { return; } int i2 = this.f + 1; this.f = i2; int[] iArr = this.a; if (i2 >= iArr.length) { this.h = true; this.f = iArr.length - 1; return; } return; } int i3 = -1; for (int i4 = 0; i != -1 && i4 < this.d; i4++) { if (this.a[i] == esB.d) { float[] fArr = this.i; float f2 = fArr[i] + f; if (f2 > -0.001f && f2 < 0.001f) { f2 = 0.0f; } fArr[i] = f2; if (f2 == BitmapDescriptorFactory.HUE_RED) { if (i == this.g) { this.g = this.j[i]; } else { int[] iArr2 = this.j; iArr2[i3] = iArr2[i]; } if (z) { esB.c(this.k); } if (this.h) { this.f = i; } esB.l--; this.d--; return; } return; } if (this.a[i] < esB.d) { i3 = i; } i = this.j[i]; } int i5 = this.f; if (this.h) { int[] iArr3 = this.a; if (iArr3[i5] != -1) { i5 = iArr3.length; } } else { i5++; } int[] iArr4 = this.a; if (i5 >= iArr4.length && this.d < iArr4.length) { int i6 = 0; while (true) { int[] iArr5 = this.a; if (i6 >= iArr5.length) { break; } if (iArr5[i6] == -1) { i5 = i6; break; } i6++; } } int[] iArr6 = this.a; if (i5 >= iArr6.length) { i5 = iArr6.length; int i7 = this.e << 1; this.e = i7; this.h = false; this.f = i5 - 1; this.i = Arrays.copyOf(this.i, i7); this.a = Arrays.copyOf(this.a, this.e); this.j = Arrays.copyOf(this.j, this.e); } this.a[i5] = esB.d; this.i[i5] = f; if (i3 != -1) { int[] iArr7 = this.j; iArr7[i5] = iArr7[i3]; iArr7[i3] = i5; } else { this.j[i5] = this.g; this.g = i5; } esB.l++; esB.e(this.k); this.d++; if (!this.h) { this.f++; } int i8 = this.f; int[] iArr8 = this.a; if (i8 >= iArr8.length) { this.h = true; this.f = iArr8.length - 1; } } } @Override // o.paA.Sts public final float e(paA paa, boolean z) { float e = e(paa.b); c(paa.b, z); paA.Sts sts = paa.e; int c = sts.c(); for (int i = 0; i < c; i++) { EsB d = sts.d(i); b(d, sts.e(d) * e, z); } return e; } @Override // o.paA.Sts public final float c(EsB esB, boolean z) { if (this.b == esB) { this.b = null; } int i = this.g; if (i == -1) { return BitmapDescriptorFactory.HUE_RED; } int i2 = 0; int i3 = -1; while (i != -1 && i2 < this.d) { if (this.a[i] == esB.d) { if (i == this.g) { this.g = this.j[i]; } else { int[] iArr = this.j; iArr[i3] = iArr[i]; } if (z) { esB.c(this.k); } esB.l--; this.d--; this.a[i] = -1; if (this.h) { this.f = i; } return this.i[i]; } i2++; i3 = i; i = this.j[i]; } return BitmapDescriptorFactory.HUE_RED; } @Override // o.paA.Sts public final void d() { int i = this.g; for (int i2 = 0; i != -1 && i2 < this.d; i2++) { EsB esB = this.c.b[this.a[i]]; if (esB != null) { esB.c(this.k); } i = this.j[i]; } this.g = -1; this.f = -1; this.h = false; this.d = 0; } @Override // o.paA.Sts public final boolean d(EsB esB) { int i = this.g; if (i == -1) { return false; } for (int i2 = 0; i != -1 && i2 < this.d; i2++) { if (this.a[i] == esB.d) { return true; } i = this.j[i]; } return false; } @Override // o.paA.Sts public final void a() { int i = this.g; for (int i2 = 0; i != -1 && i2 < this.d; i2++) { float[] fArr = this.i; fArr[i] = -fArr[i]; i = this.j[i]; } } @Override // o.paA.Sts public final void b(float f) { int i = this.g; for (int i2 = 0; i != -1 && i2 < this.d; i2++) { float[] fArr = this.i; fArr[i] = fArr[i] / f; i = this.j[i]; } } @Override // o.paA.Sts public final EsB d(int i) { int i2 = this.g; for (int i3 = 0; i2 != -1 && i3 < this.d; i3++) { if (i3 == i) { return this.c.b[this.a[i2]]; } i2 = this.j[i2]; } return null; } @Override // o.paA.Sts public final float e(int i) { int i2 = this.g; for (int i3 = 0; i2 != -1 && i3 < this.d; i3++) { if (i3 == i) { return this.i[i2]; } i2 = this.j[i2]; } return BitmapDescriptorFactory.HUE_RED; } @Override // o.paA.Sts public final float e(EsB esB) { int i = this.g; for (int i2 = 0; i != -1 && i2 < this.d; i2++) { if (this.a[i] == esB.d) { return this.i[i]; } i = this.j[i]; } return BitmapDescriptorFactory.HUE_RED; } public final String toString() { int i = this.g; String str = ""; for (int i2 = 0; i != -1 && i2 < this.d; i2++) { StringBuilder sb = new StringBuilder(); sb.append(str); sb.append(" -> "); String obj = sb.toString(); StringBuilder sb2 = new StringBuilder(); sb2.append(obj); sb2.append(this.i[i]); sb2.append(" : "); String obj2 = sb2.toString(); StringBuilder sb3 = new StringBuilder(); sb3.append(obj2); sb3.append(this.c.b[this.a[i]]); str = sb3.toString(); i = this.j[i]; } return str; } @Override // o.paA.Sts public final int c() { return this.d; } }