package o; import java.io.PrintStream; import java.lang.reflect.Array; import java.text.DecimalFormat; /* loaded from: classes.dex */ public abstract class YNF { public ktU a; public long e; private int h; public String j; public int g = 0; private int[] f = new int[10]; private float[][] i = (float[][]) Array.newInstance((Class) Float.TYPE, 10, 3); public float[] d = new float[3]; public boolean c = false; public float b = Float.NaN; public String toString() { String str = this.j; DecimalFormat decimalFormat = new DecimalFormat("##.##"); for (int i = 0; i < this.h; i++) { StringBuilder sb = new StringBuilder(); sb.append(str); sb.append("["); sb.append(this.f[i]); sb.append(" , "); sb.append(decimalFormat.format(this.i[i])); sb.append("] "); str = sb.toString(); } return str; } /* JADX INFO: Access modifiers changed from: protected */ public final float b(float f) { float abs; switch (this.g) { case 1: return Math.signum(f * 6.2831855f); case 2: abs = Math.abs(f); break; case 3: return (((f * 2.0f) + 1.0f) % 2.0f) - 1.0f; case 4: abs = ((f * 2.0f) + 1.0f) % 2.0f; break; case 5: return (float) Math.cos(f * 6.2831855f); case 6: float abs2 = 1.0f - Math.abs(((f * 4.0f) % 4.0f) - 2.0f); abs = abs2 * abs2; break; default: return (float) Math.sin(f * 6.2831855f); } return 1.0f - abs; } public void b(int i, float f, float f2, int i2, float f3) { int[] iArr = this.f; int i3 = this.h; iArr[i3] = i; float[] fArr = this.i[i3]; fArr[0] = f; fArr[1] = f2; fArr[2] = f3; this.g = Math.max(this.g, i2); this.h++; } public void b(int i) { int i2; int i3 = this.h; if (i3 == 0) { PrintStream printStream = System.err; StringBuilder sb = new StringBuilder("Error no points added to "); sb.append(this.j); printStream.println(sb.toString()); return; } int[] iArr = this.f; float[][] fArr = this.i; int[] iArr2 = new int[iArr.length + 10]; iArr2[0] = i3 - 1; iArr2[1] = 0; int i4 = 2; while (i4 > 0) { int i5 = i4 - 1; int i6 = iArr2[i5]; int i7 = i4 - 2; int i8 = iArr2[i7]; if (i6 < i8) { int i9 = iArr[i8]; int i10 = i6; int i11 = i10; while (i10 < i8) { int i12 = iArr[i10]; if (i12 <= i9) { int i13 = iArr[i11]; iArr[i11] = i12; iArr[i10] = i13; float[] fArr2 = fArr[i11]; fArr[i11] = fArr[i10]; fArr[i10] = fArr2; i11++; } i10++; } int i14 = iArr[i11]; iArr[i11] = iArr[i8]; iArr[i8] = i14; float[] fArr3 = fArr[i11]; fArr[i11] = fArr[i8]; fArr[i8] = fArr3; iArr2[i7] = i11 - 1; iArr2[i5] = i6; iArr2[i4] = i8; i7 = i4 + 2; iArr2[i4 + 1] = i11 + 1; } i4 = i7; } int i15 = 1; int i16 = 0; while (true) { int[] iArr3 = this.f; if (i15 >= iArr3.length) { break; } if (iArr3[i15] != iArr3[i15 - 1]) { i16++; } i15++; } if (i16 == 0) { i16 = 1; } double[] dArr = new double[i16]; double[][] dArr2 = (double[][]) Array.newInstance((Class) Double.TYPE, i16, 3); int i17 = 0; for (0; i2 < this.h; i2 + 1) { if (i2 > 0) { int[] iArr4 = this.f; i2 = iArr4[i2] == iArr4[i2 - 1] ? i2 + 1 : 0; } dArr[i17] = this.f[i2] * 0.01d; double[] dArr3 = dArr2[i17]; float[] fArr4 = this.i[i2]; dArr3[0] = fArr4[0]; dArr3[1] = fArr4[1]; dArr3[2] = fArr4[2]; i17++; } this.a = ktU.b(i, dArr, dArr2); } }