package o; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import java.util.Arrays; import java.util.Comparator; import o.paA; /* renamed from: o.pTo, reason: case insensitive filesystem */ /* loaded from: classes.dex */ public final class C16577pTo extends paA { private EsB[] f; private Sts g; private int h; private int i; private ogI j; private EsB[] n; /* renamed from: o.pTo$Sts */ /* loaded from: classes.dex */ class Sts { EsB c; final C16577pTo d; private C16577pTo e; public Sts(C16577pTo c16577pTo, C16577pTo c16577pTo2) { this.d = c16577pTo; this.e = c16577pTo2; } public final String toString() { String str = "[ "; if (this.c != null) { for (int i = 0; i < 9; i++) { StringBuilder sb = new StringBuilder(); sb.append(str); sb.append(this.c.e[i]); sb.append(" "); str = sb.toString(); } } StringBuilder sb2 = new StringBuilder(); sb2.append(str); sb2.append("] "); sb2.append(this.c); return sb2.toString(); } } @Override // o.paA, o.Npn.LWm public final void d() { this.i = 0; this.d = BitmapDescriptorFactory.HUE_RED; } public C16577pTo(ogI ogi) { super(ogi); this.h = 128; this.f = new EsB[128]; this.n = new EsB[128]; this.i = 0; this.g = new Sts(this, this); this.j = ogi; } @Override // o.paA, o.Npn.LWm public final EsB e(boolean[] zArr) { int i = -1; for (int i2 = 0; i2 < this.i; i2++) { EsB esB = this.f[i2]; if (!zArr[esB.d]) { this.g.c = esB; int i3 = 8; if (i == -1) { Sts sts = this.g; while (i3 >= 0) { float f = sts.c.e[i3]; if (f > BitmapDescriptorFactory.HUE_RED) { break; } if (f < BitmapDescriptorFactory.HUE_RED) { i = i2; break; } i3--; } } else { Sts sts2 = this.g; EsB esB2 = this.f[i]; while (true) { if (i3 >= 0) { float f2 = esB2.e[i3]; float f3 = sts2.c.e[i3]; if (f3 == f2) { i3--; } else if (f3 >= f2) { } } } } } } if (i == -1) { return null; } return this.f[i]; } private final void a(EsB esB) { int i; int i2 = this.i; EsB[] esBArr = this.f; if (i2 + 1 > esBArr.length) { EsB[] esBArr2 = (EsB[]) Arrays.copyOf(esBArr, esBArr.length << 1); this.f = esBArr2; this.n = (EsB[]) Arrays.copyOf(esBArr2, esBArr2.length << 1); } EsB[] esBArr3 = this.f; int i3 = this.i; esBArr3[i3] = esB; int i4 = i3 + 1; this.i = i4; if (i4 > 1 && esB.d > esB.d) { int i5 = 0; while (true) { i = this.i; if (i5 >= i) { break; } this.n[i5] = this.f[i5]; i5++; } Arrays.sort(this.n, 0, i, new Comparator(this) { // from class: o.pTo.2 final C16577pTo a; { this.a = this; } @Override // java.util.Comparator public final /* bridge */ /* synthetic */ int compare(EsB esB2, EsB esB3) { return esB2.d - esB3.d; } }); for (int i6 = 0; i6 < this.i; i6++) { this.f[i6] = this.n[i6]; } } esB.j = true; esB.e(this); } private final void h(EsB esB) { int i = 0; while (i < this.i) { if (this.f[i] == esB) { while (true) { int i2 = this.i - 1; if (i < i2) { EsB[] esBArr = this.f; int i3 = i + 1; esBArr[i] = esBArr[i3]; i = i3; } else { this.i = i2; esB.j = false; return; } } } else { i++; } } } @Override // o.paA public final void a(Npn npn, paA paa, boolean z) { EsB esB = paa.b; if (esB == null) { return; } paA.Sts sts = paa.e; int c = sts.c(); for (int i = 0; i < c; i++) { EsB d = sts.d(i); float e = sts.e(i); this.g.c = d; Sts sts2 = this.g; if (sts2.c.j) { boolean z2 = true; for (int i2 = 0; i2 < 9; i2++) { float[] fArr = sts2.c.e; fArr[i2] = fArr[i2] + (esB.e[i2] * e); if (Math.abs(sts2.c.e[i2]) < 1.0E-4f) { sts2.c.e[i2] = 0.0f; } else { z2 = false; } } if (z2) { sts2.d.h(sts2.c); } } else { for (int i3 = 0; i3 < 9; i3++) { float f = esB.e[i3]; if (f != BitmapDescriptorFactory.HUE_RED) { float f2 = f * e; if (Math.abs(f2) < 1.0E-4f) { f2 = 0.0f; } sts2.c.e[i3] = f2; } else { sts2.c.e[i3] = 0.0f; } } a(d); } this.d += paa.d * e; } h(esB); } @Override // o.paA public final String toString() { StringBuilder sb = new StringBuilder(" goal -> ("); sb.append(this.d); sb.append(") : "); String obj = sb.toString(); for (int i = 0; i < this.i; i++) { this.g.c = this.f[i]; StringBuilder sb2 = new StringBuilder(); sb2.append(obj); sb2.append(this.g); sb2.append(" "); obj = sb2.toString(); } return obj; } @Override // o.paA, o.Npn.LWm public final void c(EsB esB) { this.g.c = esB; Arrays.fill(this.g.c.e, BitmapDescriptorFactory.HUE_RED); esB.e[esB.h] = 1.0f; a(esB); } @Override // o.paA, o.Npn.LWm public final boolean f() { return this.i == 0; } }