575 lines
17 KiB
Java
575 lines
17 KiB
Java
package androidx.constraintlayout.solver;
|
|
|
|
import androidx.constraintlayout.solver.SolverVariable;
|
|
import java.util.Arrays;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class ArrayLinkedVariables {
|
|
private final ArrayRow b;
|
|
private final Cache c;
|
|
private int[] f;
|
|
private int[] g;
|
|
private float[] h;
|
|
private int i;
|
|
private int j;
|
|
private boolean k;
|
|
int a = 0;
|
|
private int d = 8;
|
|
private SolverVariable e = null;
|
|
|
|
ArrayLinkedVariables(ArrayRow arrayRow, Cache cache) {
|
|
int i = this.d;
|
|
this.f = new int[i];
|
|
this.g = new int[i];
|
|
this.h = new float[i];
|
|
this.i = -1;
|
|
this.j = -1;
|
|
this.k = false;
|
|
this.b = arrayRow;
|
|
this.c = cache;
|
|
}
|
|
|
|
public final void a(SolverVariable solverVariable, float f) {
|
|
if (f == 0.0f) {
|
|
a(solverVariable, true);
|
|
return;
|
|
}
|
|
int i = this.i;
|
|
if (i == -1) {
|
|
this.i = 0;
|
|
float[] fArr = this.h;
|
|
int i2 = this.i;
|
|
fArr[i2] = f;
|
|
this.f[i2] = solverVariable.b;
|
|
this.g[i2] = -1;
|
|
solverVariable.j++;
|
|
solverVariable.a(this.b);
|
|
this.a++;
|
|
if (this.k) {
|
|
return;
|
|
}
|
|
this.j++;
|
|
int i3 = this.j;
|
|
int[] iArr = this.f;
|
|
if (i3 >= iArr.length) {
|
|
this.k = true;
|
|
this.j = iArr.length - 1;
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
int i4 = -1;
|
|
for (int i5 = 0; i != -1 && i5 < this.a; i5++) {
|
|
int[] iArr2 = this.f;
|
|
int i6 = iArr2[i];
|
|
int i7 = solverVariable.b;
|
|
if (i6 == i7) {
|
|
this.h[i] = f;
|
|
return;
|
|
}
|
|
if (iArr2[i] < i7) {
|
|
i4 = i;
|
|
}
|
|
i = this.g[i];
|
|
}
|
|
int i8 = this.j;
|
|
int i9 = i8 + 1;
|
|
if (this.k) {
|
|
int[] iArr3 = this.f;
|
|
if (iArr3[i8] != -1) {
|
|
i8 = iArr3.length;
|
|
}
|
|
} else {
|
|
i8 = i9;
|
|
}
|
|
int[] iArr4 = this.f;
|
|
if (i8 >= iArr4.length && this.a < iArr4.length) {
|
|
int i10 = 0;
|
|
while (true) {
|
|
int[] iArr5 = this.f;
|
|
if (i10 >= iArr5.length) {
|
|
break;
|
|
}
|
|
if (iArr5[i10] == -1) {
|
|
i8 = i10;
|
|
break;
|
|
}
|
|
i10++;
|
|
}
|
|
}
|
|
int[] iArr6 = this.f;
|
|
if (i8 >= iArr6.length) {
|
|
i8 = iArr6.length;
|
|
this.d *= 2;
|
|
this.k = false;
|
|
this.j = i8 - 1;
|
|
this.h = Arrays.copyOf(this.h, this.d);
|
|
this.f = Arrays.copyOf(this.f, this.d);
|
|
this.g = Arrays.copyOf(this.g, this.d);
|
|
}
|
|
this.f[i8] = solverVariable.b;
|
|
this.h[i8] = f;
|
|
if (i4 != -1) {
|
|
int[] iArr7 = this.g;
|
|
iArr7[i8] = iArr7[i4];
|
|
iArr7[i4] = i8;
|
|
} else {
|
|
this.g[i8] = this.i;
|
|
this.i = i8;
|
|
}
|
|
solverVariable.j++;
|
|
solverVariable.a(this.b);
|
|
this.a++;
|
|
if (!this.k) {
|
|
this.j++;
|
|
}
|
|
if (this.a >= this.f.length) {
|
|
this.k = true;
|
|
}
|
|
int i11 = this.j;
|
|
int[] iArr8 = this.f;
|
|
if (i11 >= iArr8.length) {
|
|
this.k = true;
|
|
this.j = iArr8.length - 1;
|
|
}
|
|
}
|
|
|
|
void b() {
|
|
int i = this.i;
|
|
for (int i2 = 0; i != -1 && i2 < this.a; i2++) {
|
|
float[] fArr = this.h;
|
|
fArr[i] = fArr[i] * (-1.0f);
|
|
i = this.g[i];
|
|
}
|
|
}
|
|
|
|
public String toString() {
|
|
int i = this.i;
|
|
String str = "";
|
|
for (int i2 = 0; i != -1 && i2 < this.a; i2++) {
|
|
str = ((str + " -> ") + this.h[i] + " : ") + this.c.c[this.f[i]];
|
|
i = this.g[i];
|
|
}
|
|
return str;
|
|
}
|
|
|
|
final float b(int i) {
|
|
int i2 = this.i;
|
|
for (int i3 = 0; i2 != -1 && i3 < this.a; i3++) {
|
|
if (i3 == i) {
|
|
return this.h[i2];
|
|
}
|
|
i2 = this.g[i2];
|
|
}
|
|
return 0.0f;
|
|
}
|
|
|
|
public final float b(SolverVariable solverVariable) {
|
|
int i = this.i;
|
|
for (int i2 = 0; i != -1 && i2 < this.a; i2++) {
|
|
if (this.f[i] == solverVariable.b) {
|
|
return this.h[i];
|
|
}
|
|
i = this.g[i];
|
|
}
|
|
return 0.0f;
|
|
}
|
|
|
|
final void a(SolverVariable solverVariable, float f, boolean z) {
|
|
if (f == 0.0f) {
|
|
return;
|
|
}
|
|
int i = this.i;
|
|
if (i == -1) {
|
|
this.i = 0;
|
|
float[] fArr = this.h;
|
|
int i2 = this.i;
|
|
fArr[i2] = f;
|
|
this.f[i2] = solverVariable.b;
|
|
this.g[i2] = -1;
|
|
solverVariable.j++;
|
|
solverVariable.a(this.b);
|
|
this.a++;
|
|
if (this.k) {
|
|
return;
|
|
}
|
|
this.j++;
|
|
int i3 = this.j;
|
|
int[] iArr = this.f;
|
|
if (i3 >= iArr.length) {
|
|
this.k = true;
|
|
this.j = iArr.length - 1;
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
int i4 = -1;
|
|
for (int i5 = 0; i != -1 && i5 < this.a; i5++) {
|
|
int[] iArr2 = this.f;
|
|
int i6 = iArr2[i];
|
|
int i7 = solverVariable.b;
|
|
if (i6 == i7) {
|
|
float[] fArr2 = this.h;
|
|
fArr2[i] = fArr2[i] + f;
|
|
if (fArr2[i] == 0.0f) {
|
|
if (i == this.i) {
|
|
this.i = this.g[i];
|
|
} else {
|
|
int[] iArr3 = this.g;
|
|
iArr3[i4] = iArr3[i];
|
|
}
|
|
if (z) {
|
|
solverVariable.b(this.b);
|
|
}
|
|
if (this.k) {
|
|
this.j = i;
|
|
}
|
|
solverVariable.j--;
|
|
this.a--;
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
if (iArr2[i] < i7) {
|
|
i4 = i;
|
|
}
|
|
i = this.g[i];
|
|
}
|
|
int i8 = this.j;
|
|
int i9 = i8 + 1;
|
|
if (this.k) {
|
|
int[] iArr4 = this.f;
|
|
if (iArr4[i8] != -1) {
|
|
i8 = iArr4.length;
|
|
}
|
|
} else {
|
|
i8 = i9;
|
|
}
|
|
int[] iArr5 = this.f;
|
|
if (i8 >= iArr5.length && this.a < iArr5.length) {
|
|
int i10 = 0;
|
|
while (true) {
|
|
int[] iArr6 = this.f;
|
|
if (i10 >= iArr6.length) {
|
|
break;
|
|
}
|
|
if (iArr6[i10] == -1) {
|
|
i8 = i10;
|
|
break;
|
|
}
|
|
i10++;
|
|
}
|
|
}
|
|
int[] iArr7 = this.f;
|
|
if (i8 >= iArr7.length) {
|
|
i8 = iArr7.length;
|
|
this.d *= 2;
|
|
this.k = false;
|
|
this.j = i8 - 1;
|
|
this.h = Arrays.copyOf(this.h, this.d);
|
|
this.f = Arrays.copyOf(this.f, this.d);
|
|
this.g = Arrays.copyOf(this.g, this.d);
|
|
}
|
|
this.f[i8] = solverVariable.b;
|
|
this.h[i8] = f;
|
|
if (i4 != -1) {
|
|
int[] iArr8 = this.g;
|
|
iArr8[i8] = iArr8[i4];
|
|
iArr8[i4] = i8;
|
|
} else {
|
|
this.g[i8] = this.i;
|
|
this.i = i8;
|
|
}
|
|
solverVariable.j++;
|
|
solverVariable.a(this.b);
|
|
this.a++;
|
|
if (!this.k) {
|
|
this.j++;
|
|
}
|
|
int i11 = this.j;
|
|
int[] iArr9 = this.f;
|
|
if (i11 >= iArr9.length) {
|
|
this.k = true;
|
|
this.j = iArr9.length - 1;
|
|
}
|
|
}
|
|
|
|
public final float a(SolverVariable solverVariable, boolean z) {
|
|
if (this.e == solverVariable) {
|
|
this.e = null;
|
|
}
|
|
int i = this.i;
|
|
if (i == -1) {
|
|
return 0.0f;
|
|
}
|
|
int i2 = 0;
|
|
int i3 = -1;
|
|
while (i != -1 && i2 < this.a) {
|
|
if (this.f[i] == solverVariable.b) {
|
|
if (i == this.i) {
|
|
this.i = this.g[i];
|
|
} else {
|
|
int[] iArr = this.g;
|
|
iArr[i3] = iArr[i];
|
|
}
|
|
if (z) {
|
|
solverVariable.b(this.b);
|
|
}
|
|
solverVariable.j--;
|
|
this.a--;
|
|
this.f[i] = -1;
|
|
if (this.k) {
|
|
this.j = i;
|
|
}
|
|
return this.h[i];
|
|
}
|
|
i2++;
|
|
i3 = i;
|
|
i = this.g[i];
|
|
}
|
|
return 0.0f;
|
|
}
|
|
|
|
public final void a() {
|
|
int i = this.i;
|
|
for (int i2 = 0; i != -1 && i2 < this.a; i2++) {
|
|
SolverVariable solverVariable = this.c.c[this.f[i]];
|
|
if (solverVariable != null) {
|
|
solverVariable.b(this.b);
|
|
}
|
|
i = this.g[i];
|
|
}
|
|
this.i = -1;
|
|
this.j = -1;
|
|
this.k = false;
|
|
this.a = 0;
|
|
}
|
|
|
|
final boolean a(SolverVariable solverVariable) {
|
|
int i = this.i;
|
|
if (i == -1) {
|
|
return false;
|
|
}
|
|
for (int i2 = 0; i != -1 && i2 < this.a; i2++) {
|
|
if (this.f[i] == solverVariable.b) {
|
|
return true;
|
|
}
|
|
i = this.g[i];
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void a(float f) {
|
|
int i = this.i;
|
|
for (int i2 = 0; i != -1 && i2 < this.a; i2++) {
|
|
float[] fArr = this.h;
|
|
fArr[i] = fArr[i] / f;
|
|
i = this.g[i];
|
|
}
|
|
}
|
|
|
|
private boolean a(SolverVariable solverVariable, LinearSystem linearSystem) {
|
|
return solverVariable.j <= 1;
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:14:0x0046 */
|
|
/* JADX WARN: Removed duplicated region for block: B:50:0x008f A[SYNTHETIC] */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
|
*/
|
|
androidx.constraintlayout.solver.SolverVariable a(androidx.constraintlayout.solver.LinearSystem r15) {
|
|
/*
|
|
r14 = this;
|
|
int r0 = r14.i
|
|
r1 = 0
|
|
r2 = 0
|
|
r3 = 0
|
|
r4 = r1
|
|
r5 = 0
|
|
r6 = 0
|
|
r7 = 0
|
|
r8 = 0
|
|
La:
|
|
r9 = -1
|
|
if (r0 == r9) goto L97
|
|
int r9 = r14.a
|
|
if (r2 >= r9) goto L97
|
|
float[] r9 = r14.h
|
|
r10 = r9[r0]
|
|
r11 = 981668463(0x3a83126f, float:0.001)
|
|
androidx.constraintlayout.solver.Cache r12 = r14.c
|
|
androidx.constraintlayout.solver.SolverVariable[] r12 = r12.c
|
|
int[] r13 = r14.f
|
|
r13 = r13[r0]
|
|
r12 = r12[r13]
|
|
int r13 = (r10 > r3 ? 1 : (r10 == r3 ? 0 : -1))
|
|
if (r13 >= 0) goto L35
|
|
r11 = -1165815185(0xffffffffba83126f, float:-0.001)
|
|
int r11 = (r10 > r11 ? 1 : (r10 == r11 ? 0 : -1))
|
|
if (r11 <= 0) goto L41
|
|
r9[r0] = r3
|
|
androidx.constraintlayout.solver.ArrayRow r9 = r14.b
|
|
r12.b(r9)
|
|
goto L40
|
|
L35:
|
|
int r11 = (r10 > r11 ? 1 : (r10 == r11 ? 0 : -1))
|
|
if (r11 >= 0) goto L41
|
|
r9[r0] = r3
|
|
androidx.constraintlayout.solver.ArrayRow r9 = r14.b
|
|
r12.b(r9)
|
|
L40:
|
|
r10 = 0
|
|
L41:
|
|
r9 = 1
|
|
int r11 = (r10 > r3 ? 1 : (r10 == r3 ? 0 : -1))
|
|
if (r11 == 0) goto L8f
|
|
androidx.constraintlayout.solver.SolverVariable$Type r11 = r12.g
|
|
androidx.constraintlayout.solver.SolverVariable$Type r13 = androidx.constraintlayout.solver.SolverVariable.Type.UNRESTRICTED
|
|
if (r11 != r13) goto L6b
|
|
if (r4 != 0) goto L56
|
|
boolean r4 = r14.a(r12, r15)
|
|
L52:
|
|
r6 = r4
|
|
r5 = r10
|
|
r4 = r12
|
|
goto L8f
|
|
L56:
|
|
int r11 = (r5 > r10 ? 1 : (r5 == r10 ? 0 : -1))
|
|
if (r11 <= 0) goto L5f
|
|
boolean r4 = r14.a(r12, r15)
|
|
goto L52
|
|
L5f:
|
|
if (r6 != 0) goto L8f
|
|
boolean r11 = r14.a(r12, r15)
|
|
if (r11 == 0) goto L8f
|
|
r5 = r10
|
|
r4 = r12
|
|
r6 = 1
|
|
goto L8f
|
|
L6b:
|
|
if (r4 != 0) goto L8f
|
|
int r11 = (r10 > r3 ? 1 : (r10 == r3 ? 0 : -1))
|
|
if (r11 >= 0) goto L8f
|
|
if (r1 != 0) goto L7b
|
|
boolean r1 = r14.a(r12, r15)
|
|
L77:
|
|
r8 = r1
|
|
r7 = r10
|
|
r1 = r12
|
|
goto L8f
|
|
L7b:
|
|
int r11 = (r7 > r10 ? 1 : (r7 == r10 ? 0 : -1))
|
|
if (r11 <= 0) goto L84
|
|
boolean r1 = r14.a(r12, r15)
|
|
goto L77
|
|
L84:
|
|
if (r8 != 0) goto L8f
|
|
boolean r11 = r14.a(r12, r15)
|
|
if (r11 == 0) goto L8f
|
|
r7 = r10
|
|
r1 = r12
|
|
r8 = 1
|
|
L8f:
|
|
int[] r9 = r14.g
|
|
r0 = r9[r0]
|
|
int r2 = r2 + 1
|
|
goto La
|
|
L97:
|
|
if (r4 == 0) goto L9a
|
|
return r4
|
|
L9a:
|
|
return r1
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.solver.ArrayLinkedVariables.a(androidx.constraintlayout.solver.LinearSystem):androidx.constraintlayout.solver.SolverVariable");
|
|
}
|
|
|
|
final void a(ArrayRow arrayRow, ArrayRow arrayRow2, boolean z) {
|
|
int i = this.i;
|
|
while (true) {
|
|
for (int i2 = 0; i != -1 && i2 < this.a; i2++) {
|
|
int i3 = this.f[i];
|
|
SolverVariable solverVariable = arrayRow2.a;
|
|
if (i3 == solverVariable.b) {
|
|
float f = this.h[i];
|
|
a(solverVariable, z);
|
|
ArrayLinkedVariables arrayLinkedVariables = arrayRow2.d;
|
|
int i4 = arrayLinkedVariables.i;
|
|
for (int i5 = 0; i4 != -1 && i5 < arrayLinkedVariables.a; i5++) {
|
|
a(this.c.c[arrayLinkedVariables.f[i4]], arrayLinkedVariables.h[i4] * f, z);
|
|
i4 = arrayLinkedVariables.g[i4];
|
|
}
|
|
arrayRow.b += arrayRow2.b * f;
|
|
if (z) {
|
|
arrayRow2.a.b(arrayRow);
|
|
}
|
|
i = this.i;
|
|
} else {
|
|
i = this.g[i];
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
|
|
void a(ArrayRow arrayRow, ArrayRow[] arrayRowArr) {
|
|
int i = this.i;
|
|
while (true) {
|
|
for (int i2 = 0; i != -1 && i2 < this.a; i2++) {
|
|
SolverVariable solverVariable = this.c.c[this.f[i]];
|
|
if (solverVariable.c != -1) {
|
|
float f = this.h[i];
|
|
a(solverVariable, true);
|
|
ArrayRow arrayRow2 = arrayRowArr[solverVariable.c];
|
|
if (!arrayRow2.e) {
|
|
ArrayLinkedVariables arrayLinkedVariables = arrayRow2.d;
|
|
int i3 = arrayLinkedVariables.i;
|
|
for (int i4 = 0; i3 != -1 && i4 < arrayLinkedVariables.a; i4++) {
|
|
a(this.c.c[arrayLinkedVariables.f[i3]], arrayLinkedVariables.h[i3] * f, true);
|
|
i3 = arrayLinkedVariables.g[i3];
|
|
}
|
|
}
|
|
arrayRow.b += arrayRow2.b * f;
|
|
arrayRow2.a.b(arrayRow);
|
|
i = this.i;
|
|
} else {
|
|
i = this.g[i];
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
|
|
SolverVariable a(boolean[] zArr, SolverVariable solverVariable) {
|
|
SolverVariable.Type type;
|
|
int i = this.i;
|
|
SolverVariable solverVariable2 = null;
|
|
float f = 0.0f;
|
|
for (int i2 = 0; i != -1 && i2 < this.a; i2++) {
|
|
if (this.h[i] < 0.0f) {
|
|
SolverVariable solverVariable3 = this.c.c[this.f[i]];
|
|
if ((zArr == null || !zArr[solverVariable3.b]) && solverVariable3 != solverVariable && ((type = solverVariable3.g) == SolverVariable.Type.SLACK || type == SolverVariable.Type.ERROR)) {
|
|
float f2 = this.h[i];
|
|
if (f2 < f) {
|
|
solverVariable2 = solverVariable3;
|
|
f = f2;
|
|
}
|
|
}
|
|
}
|
|
i = this.g[i];
|
|
}
|
|
return solverVariable2;
|
|
}
|
|
|
|
final SolverVariable a(int i) {
|
|
int i2 = this.i;
|
|
for (int i3 = 0; i2 != -1 && i3 < this.a; i3++) {
|
|
if (i3 == i) {
|
|
return this.c.c[this.f[i2]];
|
|
}
|
|
i2 = this.g[i2];
|
|
}
|
|
return null;
|
|
}
|
|
}
|