2021-07-24 02:37:17 +00:00
|
|
|
package androidx.constraintlayout.solver;
|
|
|
|
|
2021-08-09 22:51:56 +00:00
|
|
|
import androidx.exifinterface.media.ExifInterface;
|
2021-12-17 21:59:34 +00:00
|
|
|
import b.d.b.a.a;
|
2021-07-24 02:37:17 +00:00
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.HashSet;
|
2022-03-07 09:34:54 +00:00
|
|
|
/* loaded from: classes.dex */
|
2021-07-24 02:37:17 +00:00
|
|
|
public class SolverVariable {
|
|
|
|
private static final boolean INTERNAL_DEBUG = false;
|
|
|
|
public static final int MAX_STRENGTH = 9;
|
|
|
|
public static final int STRENGTH_BARRIER = 6;
|
|
|
|
public static final int STRENGTH_CENTERING = 7;
|
|
|
|
public static final int STRENGTH_EQUALITY = 5;
|
|
|
|
public static final int STRENGTH_FIXED = 8;
|
|
|
|
public static final int STRENGTH_HIGH = 3;
|
|
|
|
public static final int STRENGTH_HIGHEST = 4;
|
|
|
|
public static final int STRENGTH_LOW = 1;
|
|
|
|
public static final int STRENGTH_MEDIUM = 2;
|
|
|
|
public static final int STRENGTH_NONE = 0;
|
|
|
|
private static final boolean VAR_USE_HASH = false;
|
|
|
|
private static int uniqueConstantId = 1;
|
|
|
|
private static int uniqueErrorId = 1;
|
|
|
|
private static int uniqueId = 1;
|
|
|
|
private static int uniqueSlackId = 1;
|
|
|
|
private static int uniqueUnrestrictedId = 1;
|
|
|
|
public float computedValue;
|
|
|
|
public int definitionId;
|
|
|
|
public float[] goalStrengthVector;
|
|
|
|
|
|
|
|
/* renamed from: id reason: collision with root package name */
|
2021-12-17 21:59:34 +00:00
|
|
|
public int f30id;
|
2021-07-24 02:37:17 +00:00
|
|
|
public boolean inGoal;
|
|
|
|
public HashSet<ArrayRow> inRows;
|
|
|
|
public boolean isFinalValue;
|
|
|
|
public boolean isSynonym;
|
|
|
|
public ArrayRow[] mClientEquations;
|
|
|
|
public int mClientEquationsCount;
|
|
|
|
private String mName;
|
|
|
|
public Type mType;
|
|
|
|
public int strength;
|
|
|
|
public float[] strengthVector;
|
|
|
|
public int synonym;
|
|
|
|
public float synonymDelta;
|
|
|
|
public int usageInRowCount;
|
|
|
|
|
|
|
|
/* renamed from: androidx.constraintlayout.solver.SolverVariable$1 reason: invalid class name */
|
2022-03-07 09:34:54 +00:00
|
|
|
/* loaded from: classes.dex */
|
2021-07-24 02:37:17 +00:00
|
|
|
public static /* synthetic */ class AnonymousClass1 {
|
|
|
|
public static final /* synthetic */ int[] $SwitchMap$androidx$constraintlayout$solver$SolverVariable$Type;
|
|
|
|
|
|
|
|
static {
|
|
|
|
Type.values();
|
|
|
|
int[] iArr = new int[5];
|
|
|
|
$SwitchMap$androidx$constraintlayout$solver$SolverVariable$Type = iArr;
|
|
|
|
try {
|
|
|
|
iArr[Type.UNRESTRICTED.ordinal()] = 1;
|
|
|
|
} catch (NoSuchFieldError unused) {
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
$SwitchMap$androidx$constraintlayout$solver$SolverVariable$Type[Type.CONSTANT.ordinal()] = 2;
|
|
|
|
} catch (NoSuchFieldError unused2) {
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
$SwitchMap$androidx$constraintlayout$solver$SolverVariable$Type[Type.SLACK.ordinal()] = 3;
|
|
|
|
} catch (NoSuchFieldError unused3) {
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
$SwitchMap$androidx$constraintlayout$solver$SolverVariable$Type[Type.ERROR.ordinal()] = 4;
|
|
|
|
} catch (NoSuchFieldError unused4) {
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
$SwitchMap$androidx$constraintlayout$solver$SolverVariable$Type[Type.UNKNOWN.ordinal()] = 5;
|
|
|
|
} catch (NoSuchFieldError unused5) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-07 09:34:54 +00:00
|
|
|
/* loaded from: classes.dex */
|
2021-07-24 02:37:17 +00:00
|
|
|
public enum Type {
|
|
|
|
UNRESTRICTED,
|
|
|
|
CONSTANT,
|
|
|
|
SLACK,
|
|
|
|
ERROR,
|
|
|
|
UNKNOWN
|
|
|
|
}
|
|
|
|
|
|
|
|
public SolverVariable(Type type, String str) {
|
2021-12-17 21:59:34 +00:00
|
|
|
this.f30id = -1;
|
2021-07-24 02:37:17 +00:00
|
|
|
this.definitionId = -1;
|
|
|
|
this.strength = 0;
|
|
|
|
this.isFinalValue = false;
|
|
|
|
this.strengthVector = new float[9];
|
|
|
|
this.goalStrengthVector = new float[9];
|
|
|
|
this.mClientEquations = new ArrayRow[16];
|
|
|
|
this.mClientEquationsCount = 0;
|
|
|
|
this.usageInRowCount = 0;
|
|
|
|
this.isSynonym = false;
|
|
|
|
this.synonym = -1;
|
|
|
|
this.synonymDelta = 0.0f;
|
|
|
|
this.inRows = null;
|
|
|
|
this.mType = type;
|
|
|
|
}
|
|
|
|
|
|
|
|
public SolverVariable(String str, Type type) {
|
2021-12-17 21:59:34 +00:00
|
|
|
this.f30id = -1;
|
2021-07-24 02:37:17 +00:00
|
|
|
this.definitionId = -1;
|
|
|
|
this.strength = 0;
|
|
|
|
this.isFinalValue = false;
|
|
|
|
this.strengthVector = new float[9];
|
|
|
|
this.goalStrengthVector = new float[9];
|
|
|
|
this.mClientEquations = new ArrayRow[16];
|
|
|
|
this.mClientEquationsCount = 0;
|
|
|
|
this.usageInRowCount = 0;
|
|
|
|
this.isSynonym = false;
|
|
|
|
this.synonym = -1;
|
|
|
|
this.synonymDelta = 0.0f;
|
|
|
|
this.inRows = null;
|
|
|
|
this.mName = str;
|
|
|
|
this.mType = type;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static String getUniqueName(Type type, String str) {
|
|
|
|
if (str != null) {
|
2022-03-21 18:52:30 +00:00
|
|
|
StringBuilder R = a.R(str);
|
|
|
|
R.append(uniqueErrorId);
|
|
|
|
return R.toString();
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
int ordinal = type.ordinal();
|
|
|
|
if (ordinal == 0) {
|
2022-03-21 18:52:30 +00:00
|
|
|
StringBuilder R2 = a.R("U");
|
2021-07-24 02:37:17 +00:00
|
|
|
int i = uniqueUnrestrictedId + 1;
|
|
|
|
uniqueUnrestrictedId = i;
|
2022-03-21 18:52:30 +00:00
|
|
|
R2.append(i);
|
|
|
|
return R2.toString();
|
2021-07-24 02:37:17 +00:00
|
|
|
} else if (ordinal == 1) {
|
2022-03-21 18:52:30 +00:00
|
|
|
StringBuilder R3 = a.R("C");
|
2021-07-24 02:37:17 +00:00
|
|
|
int i2 = uniqueConstantId + 1;
|
|
|
|
uniqueConstantId = i2;
|
2022-03-21 18:52:30 +00:00
|
|
|
R3.append(i2);
|
|
|
|
return R3.toString();
|
2021-07-24 02:37:17 +00:00
|
|
|
} else if (ordinal == 2) {
|
2022-03-21 18:52:30 +00:00
|
|
|
StringBuilder R4 = a.R(ExifInterface.LATITUDE_SOUTH);
|
2021-07-24 02:37:17 +00:00
|
|
|
int i3 = uniqueSlackId + 1;
|
|
|
|
uniqueSlackId = i3;
|
2022-03-21 18:52:30 +00:00
|
|
|
R4.append(i3);
|
|
|
|
return R4.toString();
|
2021-07-24 02:37:17 +00:00
|
|
|
} else if (ordinal == 3) {
|
2022-03-21 18:52:30 +00:00
|
|
|
StringBuilder R5 = a.R("e");
|
2021-07-24 02:37:17 +00:00
|
|
|
int i4 = uniqueErrorId + 1;
|
|
|
|
uniqueErrorId = i4;
|
2022-03-21 18:52:30 +00:00
|
|
|
R5.append(i4);
|
|
|
|
return R5.toString();
|
2021-07-24 02:37:17 +00:00
|
|
|
} else if (ordinal == 4) {
|
2022-03-21 18:52:30 +00:00
|
|
|
StringBuilder R6 = a.R(ExifInterface.GPS_MEASUREMENT_INTERRUPTED);
|
2021-07-24 02:37:17 +00:00
|
|
|
int i5 = uniqueId + 1;
|
|
|
|
uniqueId = i5;
|
2022-03-21 18:52:30 +00:00
|
|
|
R6.append(i5);
|
|
|
|
return R6.toString();
|
2021-07-24 02:37:17 +00:00
|
|
|
} else {
|
|
|
|
throw new AssertionError(type.name());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void increaseErrorId() {
|
|
|
|
uniqueErrorId++;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void addToRow(ArrayRow arrayRow) {
|
|
|
|
int i = 0;
|
|
|
|
while (true) {
|
|
|
|
int i2 = this.mClientEquationsCount;
|
|
|
|
if (i >= i2) {
|
|
|
|
ArrayRow[] arrayRowArr = this.mClientEquations;
|
|
|
|
if (i2 >= arrayRowArr.length) {
|
|
|
|
this.mClientEquations = (ArrayRow[]) Arrays.copyOf(arrayRowArr, arrayRowArr.length * 2);
|
|
|
|
}
|
|
|
|
ArrayRow[] arrayRowArr2 = this.mClientEquations;
|
|
|
|
int i3 = this.mClientEquationsCount;
|
|
|
|
arrayRowArr2[i3] = arrayRow;
|
|
|
|
this.mClientEquationsCount = i3 + 1;
|
|
|
|
return;
|
|
|
|
} else if (this.mClientEquations[i] != arrayRow) {
|
|
|
|
i++;
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void clearStrengths() {
|
|
|
|
for (int i = 0; i < 9; i++) {
|
|
|
|
this.strengthVector[i] = 0.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getName() {
|
|
|
|
return this.mName;
|
|
|
|
}
|
|
|
|
|
2022-03-07 09:34:54 +00:00
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:10:0x001f, code lost:
|
|
|
|
return;
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:7:0x000d, code lost:
|
|
|
|
if (r1 >= (r0 - 1)) goto L_0x0019;
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:8:0x000f, code lost:
|
|
|
|
r5 = r4.mClientEquations;
|
|
|
|
r2 = r1 + 1;
|
|
|
|
r5[r1] = r5[r2];
|
|
|
|
r1 = r2;
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:9:0x0019, code lost:
|
|
|
|
r4.mClientEquationsCount--;
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
|
|
*/
|
2021-07-24 02:37:17 +00:00
|
|
|
public final void removeFromRow(ArrayRow arrayRow) {
|
|
|
|
int i = this.mClientEquationsCount;
|
|
|
|
int i2 = 0;
|
|
|
|
while (i2 < i) {
|
|
|
|
if (this.mClientEquations[i2] == arrayRow) {
|
2022-03-07 09:34:54 +00:00
|
|
|
break;
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
i2++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void reset() {
|
|
|
|
this.mName = null;
|
|
|
|
this.mType = Type.UNKNOWN;
|
|
|
|
this.strength = 0;
|
2021-12-17 21:59:34 +00:00
|
|
|
this.f30id = -1;
|
2021-07-24 02:37:17 +00:00
|
|
|
this.definitionId = -1;
|
|
|
|
this.computedValue = 0.0f;
|
|
|
|
this.isFinalValue = false;
|
|
|
|
this.isSynonym = false;
|
|
|
|
this.synonym = -1;
|
|
|
|
this.synonymDelta = 0.0f;
|
|
|
|
int i = this.mClientEquationsCount;
|
|
|
|
for (int i2 = 0; i2 < i; i2++) {
|
|
|
|
this.mClientEquations[i2] = null;
|
|
|
|
}
|
|
|
|
this.mClientEquationsCount = 0;
|
|
|
|
this.usageInRowCount = 0;
|
|
|
|
this.inGoal = false;
|
|
|
|
Arrays.fill(this.goalStrengthVector, 0.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setFinalValue(LinearSystem linearSystem, float f) {
|
|
|
|
this.computedValue = f;
|
|
|
|
this.isFinalValue = true;
|
|
|
|
this.isSynonym = false;
|
|
|
|
this.synonym = -1;
|
|
|
|
this.synonymDelta = 0.0f;
|
|
|
|
int i = this.mClientEquationsCount;
|
|
|
|
this.definitionId = -1;
|
|
|
|
for (int i2 = 0; i2 < i; i2++) {
|
|
|
|
this.mClientEquations[i2].updateFromFinalVariable(linearSystem, this, false);
|
|
|
|
}
|
|
|
|
this.mClientEquationsCount = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setName(String str) {
|
|
|
|
this.mName = str;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSynonym(LinearSystem linearSystem, SolverVariable solverVariable, float f) {
|
|
|
|
this.isSynonym = true;
|
2021-12-17 21:59:34 +00:00
|
|
|
this.synonym = solverVariable.f30id;
|
2021-07-24 02:37:17 +00:00
|
|
|
this.synonymDelta = f;
|
|
|
|
int i = this.mClientEquationsCount;
|
|
|
|
this.definitionId = -1;
|
|
|
|
for (int i2 = 0; i2 < i; i2++) {
|
|
|
|
this.mClientEquations[i2].updateFromSynonymVariable(linearSystem, this, false);
|
|
|
|
}
|
|
|
|
this.mClientEquationsCount = 0;
|
|
|
|
linearSystem.displayReadableRows();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setType(Type type, String str) {
|
|
|
|
this.mType = type;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String strengthsToString() {
|
|
|
|
String str = this + "[";
|
|
|
|
int i = 0;
|
|
|
|
boolean z2 = false;
|
|
|
|
boolean z3 = true;
|
|
|
|
while (i < this.strengthVector.length) {
|
2022-03-21 18:52:30 +00:00
|
|
|
StringBuilder R = a.R(str);
|
|
|
|
R.append(this.strengthVector[i]);
|
|
|
|
String sb = R.toString();
|
2021-07-24 02:37:17 +00:00
|
|
|
float[] fArr = this.strengthVector;
|
|
|
|
if (fArr[i] > 0.0f) {
|
|
|
|
z2 = false;
|
|
|
|
} else if (fArr[i] < 0.0f) {
|
|
|
|
z2 = true;
|
|
|
|
}
|
|
|
|
if (fArr[i] != 0.0f) {
|
|
|
|
z3 = false;
|
|
|
|
}
|
2022-03-07 09:34:54 +00:00
|
|
|
str = i < fArr.length + (-1) ? a.v(sb, ", ") : a.v(sb, "] ");
|
2021-07-24 02:37:17 +00:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
if (z2) {
|
2021-11-05 06:48:17 +00:00
|
|
|
str = a.v(str, " (-)");
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
2021-11-05 06:48:17 +00:00
|
|
|
return z3 ? a.v(str, " (*)") : str;
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
if (this.mName != null) {
|
2022-03-21 18:52:30 +00:00
|
|
|
StringBuilder R = a.R("");
|
|
|
|
R.append(this.mName);
|
|
|
|
return R.toString();
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
2022-03-21 18:52:30 +00:00
|
|
|
StringBuilder R2 = a.R("");
|
|
|
|
R2.append(this.f30id);
|
|
|
|
return R2.toString();
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final void updateReferencesWithNewDefinition(LinearSystem linearSystem, ArrayRow arrayRow) {
|
|
|
|
int i = this.mClientEquationsCount;
|
|
|
|
for (int i2 = 0; i2 < i; i2++) {
|
|
|
|
this.mClientEquations[i2].updateFromRow(linearSystem, arrayRow, false);
|
|
|
|
}
|
|
|
|
this.mClientEquationsCount = 0;
|
|
|
|
}
|
|
|
|
}
|