package o; import java.lang.reflect.Array; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; /* loaded from: classes.dex */ public abstract class MqA { public String c; private HBt f; private ktU j; public int e = 0; public String b = null; public int d = 0; public ArrayList a = new ArrayList<>(); protected void d(Object obj) { } /* loaded from: classes.dex */ public static class RVV { float a; float b; int c; float d; float e; public RVV(int i, float f, float f2, float f3, float f4) { this.c = i; this.e = f4; this.d = f2; this.a = f; this.b = f3; } } public String toString() { String str = this.c; DecimalFormat decimalFormat = new DecimalFormat("##.##"); Iterator it = this.a.iterator(); while (it.hasNext()) { RVV next = it.next(); StringBuilder sb = new StringBuilder(); sb.append(str); sb.append("["); sb.append(next.c); sb.append(" , "); sb.append(decimalFormat.format(next.e)); sb.append("] "); str = sb.toString(); } return str; } public final float d(float f) { double signum; double d; double abs; HBt hBt = this.f; ktU ktu = hBt.d; if (ktu != null) { ktu.a(f, hBt.i); } else { double[] dArr = hBt.i; dArr[0] = hBt.a[0]; dArr[1] = hBt.g[0]; dArr[2] = hBt.j[0]; } double[] dArr2 = hBt.i; double d2 = dArr2[0]; double d3 = dArr2[1]; hUG hug = hBt.c; double d4 = f; double d5 = 0.0d; if (d4 < 0.0d) { d4 = 0.0d; } else if (d4 > 1.0d) { d4 = 1.0d; } int binarySearch = Arrays.binarySearch(hug.f, d4); if (binarySearch > 0) { d5 = 1.0d; } else if (binarySearch != 0) { int i = -binarySearch; int i2 = i - 1; float[] fArr = hug.g; float f2 = fArr[i2]; int i3 = i - 2; float f3 = fArr[i3]; double d6 = f2 - f3; double[] dArr3 = hug.f; double d7 = dArr3[i2]; double d8 = dArr3[i3]; double d9 = d6 / (d7 - d8); d5 = hug.d[i3] + ((f3 - (d9 * d8)) * (d4 - d8)) + ((d9 * ((d4 * d4) - (d8 * d8))) / 2.0d); } double d10 = d5 + d3; switch (hug.j) { case 1: signum = Math.signum(0.5d - (d10 % 1.0d)); break; case 2: d = 1.0d; abs = Math.abs((((d10 * 4.0d) + 1.0d) % 4.0d) - 2.0d); signum = d - abs; break; case 3: signum = (((d10 * 2.0d) + 1.0d) % 2.0d) - 1.0d; break; case 4: d = 1.0d; abs = ((d10 * 2.0d) + 1.0d) % 2.0d; signum = d - abs; break; case 5: signum = Math.cos(hug.b * (d3 + d10)); break; case 6: d = 1.0d; double abs2 = 1.0d - Math.abs(((d10 * 4.0d) % 4.0d) - 2.0d); abs = abs2 * abs2; signum = d - abs; break; case 7: signum = hug.a.e(d10 % 1.0d); break; default: signum = Math.sin(hug.b * d10); break; } return (float) (d2 + (signum * hBt.i[2])); } public final void d(int i, int i2, String str, int i3, float f, float f2, float f3, float f4, Object obj) { this.a.add(new RVV(i, f, f2, f3, f4)); if (i3 != -1) { this.d = i3; } this.e = i2; d(obj); this.b = str; } public final void c(float f) { int size = this.a.size(); if (size == 0) { return; } Collections.sort(this.a, new Comparator(this) { // from class: o.MqA.1 final MqA b; { this.b = this; } @Override // java.util.Comparator public final /* bridge */ /* synthetic */ int compare(RVV rvv, RVV rvv2) { return Integer.compare(rvv.c, rvv2.c); } }); double[] dArr = new double[size]; double[][] dArr2 = (double[][]) Array.newInstance((Class) Double.TYPE, size, 3); this.f = new HBt(this.e, this.b, this.d, size); Iterator it = this.a.iterator(); int i = 0; while (it.hasNext()) { RVV next = it.next(); dArr[i] = next.a * 0.01d; dArr2[i][0] = next.e; dArr2[i][1] = next.d; dArr2[i][2] = next.b; HBt hBt = this.f; int i2 = next.c; float f2 = next.a; float f3 = next.d; float f4 = next.b; float f5 = next.e; hBt.h[i] = i2 / 100.0d; hBt.b[i] = f2; hBt.a[i] = f3; hBt.g[i] = f4; hBt.j[i] = f5; i++; dArr2 = dArr2; } double[][] dArr3 = dArr2; HBt hBt2 = this.f; hBt2.e = f; double[][] dArr4 = (double[][]) Array.newInstance((Class) Double.TYPE, hBt2.h.length, 3); float[] fArr = hBt2.j; hBt2.i = new double[fArr.length + 2]; hBt2.f = new double[fArr.length + 2]; if (hBt2.h[0] > 0.0d) { hBt2.c.d(0.0d, hBt2.b[0]); } double[] dArr5 = hBt2.h; int length = dArr5.length - 1; if (dArr5[length] < 1.0d) { hBt2.c.d(1.0d, hBt2.b[length]); } for (int i3 = 0; i3 < dArr4.length; i3++) { double[] dArr6 = dArr4[i3]; dArr6[0] = hBt2.a[i3]; dArr6[1] = hBt2.g[i3]; dArr6[2] = hBt2.j[i3]; hBt2.c.d(hBt2.h[i3], hBt2.b[i3]); } hUG hug = hBt2.c; int i4 = 0; double d = 0.0d; while (true) { if (i4 >= hug.g.length) { break; } d += r12[i4]; i4++; } int i5 = 1; double d2 = 0.0d; while (true) { float[] fArr2 = hug.g; if (i5 >= fArr2.length) { break; } int i6 = i5 - 1; float f6 = (fArr2[i6] + fArr2[i5]) / 2.0f; double[] dArr7 = hug.f; d2 += (dArr7[i5] - dArr7[i6]) * f6; i5++; } int i7 = 0; while (true) { float[] fArr3 = hug.g; if (i7 >= fArr3.length) { break; } fArr3[i7] = (float) (fArr3[i7] * (d / d2)); i7++; } hug.d[0] = 0.0d; int i8 = 1; while (true) { float[] fArr4 = hug.g; if (i8 >= fArr4.length) { break; } int i9 = i8 - 1; float f7 = (fArr4[i9] + fArr4[i8]) / 2.0f; double[] dArr8 = hug.f; double d3 = dArr8[i8]; double d4 = dArr8[i9]; double[] dArr9 = hug.d; dArr9[i8] = dArr9[i9] + ((d3 - d4) * f7); i8++; } hug.e = true; double[] dArr10 = hBt2.h; hBt2.d = dArr10.length > 1 ? ktU.b(0, dArr10, dArr4) : null; this.j = ktU.b(0, dArr, dArr3); } /* loaded from: classes.dex */ static class HBt { float[] a; float[] b; hUG c; ktU d; float e; double[] f; float[] g; double[] h; double[] i; float[] j; private final int k; private final int l; private final int m; private final int n; /* renamed from: o, reason: collision with root package name */ private float[] f8277o; private int t; HBt(int i, String str, int i2, int i3) { long j; hUG hug = new hUG(); this.c = hug; this.n = 0; this.m = 1; this.l = 2; this.t = i; this.k = i2; hug.j = i; hug.c = str; if (str != null) { double[] dArr = new double[str.length() / 2]; int indexOf = str.indexOf(40) + 1; int indexOf2 = str.indexOf(44, indexOf); int i4 = 0; while (indexOf2 != -1) { dArr[i4] = Double.parseDouble(str.substring(indexOf, indexOf2).trim()); indexOf = indexOf2 + 1; indexOf2 = str.indexOf(44, indexOf); i4++; } dArr[i4] = Double.parseDouble(str.substring(indexOf, str.indexOf(41, indexOf)).trim()); double[] copyOf = Arrays.copyOf(dArr, i4 + 1); int length = (copyOf.length * 3) - 2; int length2 = copyOf.length - 1; double d = 1.0d / length2; double[][] dArr2 = (double[][]) Array.newInstance((Class) Double.TYPE, length, 1); double[] dArr3 = new double[length]; for (int i5 = 0; i5 < copyOf.length; i5++) { double d2 = copyOf[i5]; int i6 = i5 + length2; dArr2[i6][0] = d2; double d3 = i5 * d; dArr3[i6] = d3; if (i5 > 0) { int i7 = (length2 << 1) + i5; j = 4607182418800017408L; dArr2[i7][0] = d2 + 1.0d; dArr3[i7] = d3 + 1.0d; int i8 = i5 - 1; dArr2[i8][0] = (d2 - 1.0d) - d; dArr3[i8] = (d3 - 1.0d) - d; } else { j = 4607182418800017408L; } } hug.a = new DBy(dArr3, dArr2); } this.j = new float[i3]; this.h = new double[i3]; this.b = new float[i3]; this.a = new float[i3]; this.g = new float[i3]; this.f8277o = new float[i3]; } } }