mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-18 03:47:18 +01:00
465 lines
17 KiB
Java
465 lines
17 KiB
Java
package androidx.constraintlayout.solver;
|
|
|
|
import androidx.constraintlayout.solver.LinearSystem;
|
|
import androidx.constraintlayout.solver.SolverVariable;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes13.dex */
|
|
public class ArrayRow implements LinearSystem.Row {
|
|
private static final boolean DEBUG = false;
|
|
private static final float epsilon = 0.001f;
|
|
public final ArrayLinkedVariables variables;
|
|
SolverVariable variable = null;
|
|
float constantValue = 0.0f;
|
|
boolean used = false;
|
|
boolean isSimpleDefinition = false;
|
|
|
|
public ArrayRow(Cache cache) {
|
|
this.variables = new ArrayLinkedVariables(this, cache);
|
|
}
|
|
|
|
@Override // androidx.constraintlayout.solver.LinearSystem.Row
|
|
public void addError(SolverVariable solverVariable) {
|
|
int i = solverVariable.strength;
|
|
float f = 1.0f;
|
|
if (i != 1) {
|
|
if (i == 2) {
|
|
f = 1000.0f;
|
|
} else if (i == 3) {
|
|
f = 1000000.0f;
|
|
} else if (i == 4) {
|
|
f = 1.0E9f;
|
|
} else if (i == 5) {
|
|
f = 1.0E12f;
|
|
}
|
|
}
|
|
this.variables.put(solverVariable, f);
|
|
}
|
|
|
|
public ArrayRow addSingleError(SolverVariable solverVariable, int i) {
|
|
this.variables.put(solverVariable, i);
|
|
return this;
|
|
}
|
|
|
|
public boolean chooseSubject(LinearSystem linearSystem) {
|
|
boolean z;
|
|
SolverVariable chooseSubject = this.variables.chooseSubject(linearSystem);
|
|
if (chooseSubject == null) {
|
|
z = true;
|
|
} else {
|
|
pivot(chooseSubject);
|
|
z = false;
|
|
}
|
|
if (this.variables.currentSize == 0) {
|
|
this.isSimpleDefinition = true;
|
|
}
|
|
return z;
|
|
}
|
|
|
|
@Override // androidx.constraintlayout.solver.LinearSystem.Row
|
|
public void clear() {
|
|
this.variables.clear();
|
|
this.variable = null;
|
|
this.constantValue = 0.0f;
|
|
}
|
|
|
|
public ArrayRow createRowCentering(SolverVariable solverVariable, SolverVariable solverVariable2, int i, float f, SolverVariable solverVariable3, SolverVariable solverVariable4, int i2) {
|
|
if (solverVariable2 == solverVariable3) {
|
|
this.variables.put(solverVariable, 1.0f);
|
|
this.variables.put(solverVariable4, 1.0f);
|
|
this.variables.put(solverVariable2, -2.0f);
|
|
return this;
|
|
}
|
|
if (f == 0.5f) {
|
|
this.variables.put(solverVariable, 1.0f);
|
|
this.variables.put(solverVariable2, -1.0f);
|
|
this.variables.put(solverVariable3, -1.0f);
|
|
this.variables.put(solverVariable4, 1.0f);
|
|
if (i > 0 || i2 > 0) {
|
|
this.constantValue = (-i) + i2;
|
|
return this;
|
|
}
|
|
} else {
|
|
if (f <= 0.0f) {
|
|
this.variables.put(solverVariable, -1.0f);
|
|
this.variables.put(solverVariable2, 1.0f);
|
|
this.constantValue = i;
|
|
return this;
|
|
}
|
|
ArrayLinkedVariables arrayLinkedVariables = this.variables;
|
|
if (f >= 1.0f) {
|
|
arrayLinkedVariables.put(solverVariable3, -1.0f);
|
|
this.variables.put(solverVariable4, 1.0f);
|
|
this.constantValue = i2;
|
|
return this;
|
|
}
|
|
float f2 = 1.0f - f;
|
|
arrayLinkedVariables.put(solverVariable, f2 * 1.0f);
|
|
this.variables.put(solverVariable2, f2 * (-1.0f));
|
|
this.variables.put(solverVariable3, (-1.0f) * f);
|
|
this.variables.put(solverVariable4, 1.0f * f);
|
|
if (i > 0 || i2 > 0) {
|
|
this.constantValue = (i2 * f) + ((-i) * f2);
|
|
return this;
|
|
}
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public ArrayRow createRowDefinition(SolverVariable solverVariable, int i) {
|
|
this.variable = solverVariable;
|
|
float f = i;
|
|
solverVariable.computedValue = f;
|
|
this.constantValue = f;
|
|
this.isSimpleDefinition = true;
|
|
return this;
|
|
}
|
|
|
|
public ArrayRow createRowDimensionPercent(SolverVariable solverVariable, SolverVariable solverVariable2, SolverVariable solverVariable3, float f) {
|
|
this.variables.put(solverVariable, -1.0f);
|
|
this.variables.put(solverVariable2, 1.0f - f);
|
|
this.variables.put(solverVariable3, f);
|
|
return this;
|
|
}
|
|
|
|
public ArrayRow createRowDimensionRatio(SolverVariable solverVariable, SolverVariable solverVariable2, SolverVariable solverVariable3, SolverVariable solverVariable4, float f) {
|
|
this.variables.put(solverVariable, -1.0f);
|
|
this.variables.put(solverVariable2, 1.0f);
|
|
this.variables.put(solverVariable3, f);
|
|
this.variables.put(solverVariable4, -f);
|
|
return this;
|
|
}
|
|
|
|
public ArrayRow createRowEqualDimension(float f, float f2, float f3, SolverVariable solverVariable, int i, SolverVariable solverVariable2, int i2, SolverVariable solverVariable3, int i3, SolverVariable solverVariable4, int i4) {
|
|
if (f2 == 0.0f || f == f3) {
|
|
this.constantValue = ((-i) - i2) + i3 + i4;
|
|
this.variables.put(solverVariable, 1.0f);
|
|
this.variables.put(solverVariable2, -1.0f);
|
|
this.variables.put(solverVariable4, 1.0f);
|
|
this.variables.put(solverVariable3, -1.0f);
|
|
return this;
|
|
}
|
|
float f4 = (f / f2) / (f3 / f2);
|
|
this.constantValue = (i4 * f4) + (i3 * f4) + ((-i) - i2);
|
|
this.variables.put(solverVariable, 1.0f);
|
|
this.variables.put(solverVariable2, -1.0f);
|
|
this.variables.put(solverVariable4, f4);
|
|
this.variables.put(solverVariable3, -f4);
|
|
return this;
|
|
}
|
|
|
|
public ArrayRow createRowEqualMatchDimensions(float f, float f2, float f3, SolverVariable solverVariable, SolverVariable solverVariable2, SolverVariable solverVariable3, SolverVariable solverVariable4) {
|
|
this.constantValue = 0.0f;
|
|
if (f2 == 0.0f || f == f3) {
|
|
this.variables.put(solverVariable, 1.0f);
|
|
this.variables.put(solverVariable2, -1.0f);
|
|
this.variables.put(solverVariable4, 1.0f);
|
|
this.variables.put(solverVariable3, -1.0f);
|
|
return this;
|
|
}
|
|
if (f == 0.0f) {
|
|
this.variables.put(solverVariable, 1.0f);
|
|
this.variables.put(solverVariable2, -1.0f);
|
|
return this;
|
|
}
|
|
ArrayLinkedVariables arrayLinkedVariables = this.variables;
|
|
if (f3 == 0.0f) {
|
|
arrayLinkedVariables.put(solverVariable3, 1.0f);
|
|
this.variables.put(solverVariable4, -1.0f);
|
|
return this;
|
|
}
|
|
float f4 = (f / f2) / (f3 / f2);
|
|
arrayLinkedVariables.put(solverVariable, 1.0f);
|
|
this.variables.put(solverVariable2, -1.0f);
|
|
this.variables.put(solverVariable4, f4);
|
|
this.variables.put(solverVariable3, -f4);
|
|
return this;
|
|
}
|
|
|
|
public ArrayRow createRowEquals(SolverVariable solverVariable, SolverVariable solverVariable2, int i) {
|
|
boolean z = false;
|
|
if (i != 0) {
|
|
if (i < 0) {
|
|
i *= -1;
|
|
z = true;
|
|
}
|
|
this.constantValue = i;
|
|
}
|
|
ArrayLinkedVariables arrayLinkedVariables = this.variables;
|
|
if (z) {
|
|
arrayLinkedVariables.put(solverVariable, 1.0f);
|
|
this.variables.put(solverVariable2, -1.0f);
|
|
return this;
|
|
}
|
|
arrayLinkedVariables.put(solverVariable, -1.0f);
|
|
this.variables.put(solverVariable2, 1.0f);
|
|
return this;
|
|
}
|
|
|
|
public ArrayRow createRowGreaterThan(SolverVariable solverVariable, SolverVariable solverVariable2, SolverVariable solverVariable3, int i) {
|
|
boolean z = false;
|
|
if (i != 0) {
|
|
if (i < 0) {
|
|
i *= -1;
|
|
z = true;
|
|
}
|
|
this.constantValue = i;
|
|
}
|
|
ArrayLinkedVariables arrayLinkedVariables = this.variables;
|
|
if (z) {
|
|
arrayLinkedVariables.put(solverVariable, 1.0f);
|
|
this.variables.put(solverVariable2, -1.0f);
|
|
this.variables.put(solverVariable3, -1.0f);
|
|
return this;
|
|
}
|
|
arrayLinkedVariables.put(solverVariable, -1.0f);
|
|
this.variables.put(solverVariable2, 1.0f);
|
|
this.variables.put(solverVariable3, 1.0f);
|
|
return this;
|
|
}
|
|
|
|
public ArrayRow createRowLowerThan(SolverVariable solverVariable, SolverVariable solverVariable2, SolverVariable solverVariable3, int i) {
|
|
boolean z = false;
|
|
if (i != 0) {
|
|
if (i < 0) {
|
|
i *= -1;
|
|
z = true;
|
|
}
|
|
this.constantValue = i;
|
|
}
|
|
ArrayLinkedVariables arrayLinkedVariables = this.variables;
|
|
if (z) {
|
|
arrayLinkedVariables.put(solverVariable, 1.0f);
|
|
this.variables.put(solverVariable2, -1.0f);
|
|
this.variables.put(solverVariable3, 1.0f);
|
|
return this;
|
|
}
|
|
arrayLinkedVariables.put(solverVariable, -1.0f);
|
|
this.variables.put(solverVariable2, 1.0f);
|
|
this.variables.put(solverVariable3, -1.0f);
|
|
return this;
|
|
}
|
|
|
|
public ArrayRow createRowWithAngle(SolverVariable solverVariable, SolverVariable solverVariable2, SolverVariable solverVariable3, SolverVariable solverVariable4, float f) {
|
|
this.variables.put(solverVariable3, 0.5f);
|
|
this.variables.put(solverVariable4, 0.5f);
|
|
this.variables.put(solverVariable, -0.5f);
|
|
this.variables.put(solverVariable2, -0.5f);
|
|
this.constantValue = -f;
|
|
return this;
|
|
}
|
|
|
|
public void ensurePositiveConstant() {
|
|
float f = this.constantValue;
|
|
if (f < 0.0f) {
|
|
this.constantValue = f * (-1.0f);
|
|
this.variables.invert();
|
|
}
|
|
}
|
|
|
|
@Override // androidx.constraintlayout.solver.LinearSystem.Row
|
|
public SolverVariable getKey() {
|
|
return this.variable;
|
|
}
|
|
|
|
@Override // androidx.constraintlayout.solver.LinearSystem.Row
|
|
public SolverVariable getPivotCandidate(LinearSystem linearSystem, boolean[] zArr) {
|
|
return this.variables.getPivotCandidate(zArr, null);
|
|
}
|
|
|
|
public boolean hasKeyVariable() {
|
|
SolverVariable solverVariable = this.variable;
|
|
if (solverVariable != null) {
|
|
return solverVariable.mType == SolverVariable.Type.UNRESTRICTED || this.constantValue >= 0.0f;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public boolean hasVariable(SolverVariable solverVariable) {
|
|
return this.variables.containsKey(solverVariable);
|
|
}
|
|
|
|
@Override // androidx.constraintlayout.solver.LinearSystem.Row
|
|
public void initFromRow(LinearSystem.Row row) {
|
|
if (!(row instanceof ArrayRow)) {
|
|
return;
|
|
}
|
|
ArrayRow arrayRow = (ArrayRow) row;
|
|
this.variable = null;
|
|
this.variables.clear();
|
|
int i = 0;
|
|
while (true) {
|
|
ArrayLinkedVariables arrayLinkedVariables = arrayRow.variables;
|
|
if (i >= arrayLinkedVariables.currentSize) {
|
|
return;
|
|
}
|
|
this.variables.add(arrayLinkedVariables.getVariable(i), arrayRow.variables.getVariableValue(i), true);
|
|
i++;
|
|
}
|
|
}
|
|
|
|
@Override // androidx.constraintlayout.solver.LinearSystem.Row
|
|
public boolean isEmpty() {
|
|
return this.variable == null && this.constantValue == 0.0f && this.variables.currentSize == 0;
|
|
}
|
|
|
|
public SolverVariable pickPivot(SolverVariable solverVariable) {
|
|
return this.variables.getPivotCandidate(null, solverVariable);
|
|
}
|
|
|
|
public void pivot(SolverVariable solverVariable) {
|
|
SolverVariable solverVariable2 = this.variable;
|
|
if (solverVariable2 != null) {
|
|
this.variables.put(solverVariable2, -1.0f);
|
|
this.variable = null;
|
|
}
|
|
float remove = this.variables.remove(solverVariable, true) * (-1.0f);
|
|
this.variable = solverVariable;
|
|
if (remove == 1.0f) {
|
|
return;
|
|
}
|
|
this.constantValue /= remove;
|
|
this.variables.divideByAmount(remove);
|
|
}
|
|
|
|
public void reset() {
|
|
this.variable = null;
|
|
this.variables.clear();
|
|
this.constantValue = 0.0f;
|
|
this.isSimpleDefinition = false;
|
|
}
|
|
|
|
public int sizeInBytes() {
|
|
return this.variables.sizeInBytes() + (this.variable != null ? 4 : 0) + 8;
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:21:0x007a */
|
|
/* JADX WARN: Removed duplicated region for block: B:25:0x007f */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public java.lang.String toReadableString() {
|
|
/*
|
|
r10 = this;
|
|
androidx.constraintlayout.solver.SolverVariable r0 = r10.variable
|
|
if (r0 != 0) goto L7
|
|
java.lang.String r0 = "0"
|
|
goto L17
|
|
L7:
|
|
java.lang.StringBuilder r0 = new java.lang.StringBuilder
|
|
java.lang.String r1 = ""
|
|
r0.<init>(r1)
|
|
androidx.constraintlayout.solver.SolverVariable r1 = r10.variable
|
|
r0.append(r1)
|
|
java.lang.String r0 = r0.toString()
|
|
L17:
|
|
java.lang.String r1 = " = "
|
|
java.lang.String r0 = r0.concat(r1)
|
|
float r1 = r10.constantValue
|
|
r2 = 0
|
|
int r1 = (r1 > r2 ? 1 : (r1 == r2 ? 0 : -1))
|
|
r3 = 0
|
|
r4 = 1
|
|
if (r1 == 0) goto L35
|
|
java.lang.StringBuilder r0 = androidx.compose.runtime.BitVector$$ExternalSyntheticOutline0.m(r0)
|
|
float r1 = r10.constantValue
|
|
r0.append(r1)
|
|
java.lang.String r0 = r0.toString()
|
|
r1 = r4
|
|
goto L36
|
|
L35:
|
|
r1 = r3
|
|
L36:
|
|
androidx.constraintlayout.solver.ArrayLinkedVariables r5 = r10.variables
|
|
int r5 = r5.currentSize
|
|
L3a:
|
|
if (r3 >= r5) goto L9a
|
|
androidx.constraintlayout.solver.ArrayLinkedVariables r6 = r10.variables
|
|
androidx.constraintlayout.solver.SolverVariable r6 = r6.getVariable(r3)
|
|
if (r6 != 0) goto L45
|
|
goto L97
|
|
L45:
|
|
androidx.constraintlayout.solver.ArrayLinkedVariables r7 = r10.variables
|
|
float r7 = r7.getVariableValue(r3)
|
|
int r8 = (r7 > r2 ? 1 : (r7 == r2 ? 0 : -1))
|
|
if (r8 != 0) goto L50
|
|
goto L97
|
|
L50:
|
|
java.lang.String r6 = r6.toString()
|
|
r9 = -1082130432(0xffffffffbf800000, float:-1.0)
|
|
if (r1 != 0) goto L64
|
|
int r1 = (r7 > r2 ? 1 : (r7 == r2 ? 0 : -1))
|
|
if (r1 >= 0) goto L74
|
|
java.lang.String r1 = "- "
|
|
java.lang.String r0 = androidx.compose.runtime.BitVector$$ExternalSyntheticOutline0.m(r0, r1)
|
|
L62:
|
|
float r7 = r7 * r9
|
|
goto L74
|
|
L64:
|
|
if (r8 <= 0) goto L6d
|
|
java.lang.String r1 = " + "
|
|
java.lang.String r0 = androidx.compose.runtime.BitVector$$ExternalSyntheticOutline0.m(r0, r1)
|
|
goto L74
|
|
L6d:
|
|
java.lang.String r1 = " - "
|
|
java.lang.String r0 = androidx.compose.runtime.BitVector$$ExternalSyntheticOutline0.m(r0, r1)
|
|
goto L62
|
|
L74:
|
|
r1 = 1065353216(0x3f800000, float:1.0)
|
|
int r1 = (r7 > r1 ? 1 : (r7 == r1 ? 0 : -1))
|
|
if (r1 != 0) goto L7f
|
|
java.lang.String r0 = androidx.compose.runtime.BitVector$$ExternalSyntheticOutline0.m(r0, r6)
|
|
goto L96
|
|
L7f:
|
|
java.lang.StringBuilder r1 = new java.lang.StringBuilder
|
|
r1.<init>()
|
|
r1.append(r0)
|
|
r1.append(r7)
|
|
java.lang.String r0 = " "
|
|
r1.append(r0)
|
|
r1.append(r6)
|
|
java.lang.String r0 = r1.toString()
|
|
L96:
|
|
r1 = r4
|
|
L97:
|
|
int r3 = r3 + 1
|
|
goto L3a
|
|
L9a:
|
|
if (r1 != 0) goto La3
|
|
java.lang.String r10 = "0.0"
|
|
java.lang.String r10 = androidx.compose.runtime.BitVector$$ExternalSyntheticOutline0.m(r0, r10)
|
|
return r10
|
|
La3:
|
|
return r0
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.solver.ArrayRow.toReadableString():java.lang.String");
|
|
}
|
|
|
|
public String toString() {
|
|
return toReadableString();
|
|
}
|
|
|
|
public ArrayRow createRowEquals(SolverVariable solverVariable, int i) {
|
|
if (i < 0) {
|
|
this.constantValue = i * (-1);
|
|
this.variables.put(solverVariable, 1.0f);
|
|
return this;
|
|
}
|
|
this.constantValue = i;
|
|
this.variables.put(solverVariable, -1.0f);
|
|
return this;
|
|
}
|
|
|
|
public ArrayRow addError(LinearSystem linearSystem, int i) {
|
|
this.variables.put(linearSystem.createErrorVariable(i, "ep"), 1.0f);
|
|
this.variables.put(linearSystem.createErrorVariable(i, "em"), -1.0f);
|
|
return this;
|
|
}
|
|
|
|
public ArrayRow createRowGreaterThan(SolverVariable solverVariable, int i, SolverVariable solverVariable2) {
|
|
this.constantValue = i;
|
|
this.variables.put(solverVariable, -1.0f);
|
|
return this;
|
|
}
|
|
}
|