mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-16 19:07:17 +01:00
258 lines
8.6 KiB
Java
258 lines
8.6 KiB
Java
package androidx.constraintlayout.solver;
|
|
|
|
import androidx.compose.runtime.BitVector$$ExternalSyntheticOutline0;
|
|
import androidx.exifinterface.media.ExifInterface;
|
|
import com.amazon.alexa.ra.core.ui.markdown.parser.formatter.MarkdownConstants;
|
|
import java.util.Arrays;
|
|
import okio.Buffer$$ExternalSyntheticBUOutline0;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes13.dex */
|
|
public class SolverVariable {
|
|
private static final boolean INTERNAL_DEBUG = false;
|
|
static final int MAX_STRENGTH = 7;
|
|
public static final int STRENGTH_BARRIER = 7;
|
|
public static final int STRENGTH_EQUALITY = 5;
|
|
public static final int STRENGTH_FIXED = 6;
|
|
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 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;
|
|
int definitionId;
|
|
public int id;
|
|
ArrayRow[] mClientEquations;
|
|
int mClientEquationsCount;
|
|
private String mName;
|
|
Type mType;
|
|
public int strength;
|
|
float[] strengthVector;
|
|
public int usageInRowCount;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* renamed from: androidx.constraintlayout.solver.SolverVariable$1, reason: invalid class name */
|
|
public static /* synthetic */ class AnonymousClass1 {
|
|
static final /* synthetic */ int[] $SwitchMap$androidx$constraintlayout$solver$SolverVariable$Type;
|
|
|
|
static {
|
|
int[] iArr = new int[Type.values().length];
|
|
$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) {
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public enum Type {
|
|
UNRESTRICTED,
|
|
CONSTANT,
|
|
SLACK,
|
|
ERROR,
|
|
UNKNOWN
|
|
}
|
|
|
|
public SolverVariable(String str, Type type) {
|
|
this.id = -1;
|
|
this.definitionId = -1;
|
|
this.strength = 0;
|
|
this.strengthVector = new float[7];
|
|
this.mClientEquations = new ArrayRow[8];
|
|
this.mClientEquationsCount = 0;
|
|
this.usageInRowCount = 0;
|
|
this.mName = str;
|
|
this.mType = type;
|
|
}
|
|
|
|
private static String getUniqueName(Type type, String str) {
|
|
if (str != null) {
|
|
StringBuilder m = BitVector$$ExternalSyntheticOutline0.m(str);
|
|
m.append(uniqueErrorId);
|
|
return m.toString();
|
|
}
|
|
int i = AnonymousClass1.$SwitchMap$androidx$constraintlayout$solver$SolverVariable$Type[type.ordinal()];
|
|
if (i == 1) {
|
|
StringBuilder sb = new StringBuilder("U");
|
|
int i2 = uniqueUnrestrictedId + 1;
|
|
uniqueUnrestrictedId = i2;
|
|
sb.append(i2);
|
|
return sb.toString();
|
|
}
|
|
if (i == 2) {
|
|
StringBuilder sb2 = new StringBuilder("C");
|
|
int i3 = uniqueConstantId + 1;
|
|
uniqueConstantId = i3;
|
|
sb2.append(i3);
|
|
return sb2.toString();
|
|
}
|
|
if (i == 3) {
|
|
StringBuilder sb3 = new StringBuilder(ExifInterface.LATITUDE_SOUTH);
|
|
int i4 = uniqueSlackId + 1;
|
|
uniqueSlackId = i4;
|
|
sb3.append(i4);
|
|
return sb3.toString();
|
|
}
|
|
if (i == 4) {
|
|
StringBuilder sb4 = new StringBuilder("e");
|
|
int i5 = uniqueErrorId + 1;
|
|
uniqueErrorId = i5;
|
|
sb4.append(i5);
|
|
return sb4.toString();
|
|
}
|
|
if (i != 5) {
|
|
Buffer$$ExternalSyntheticBUOutline0.m((Object) type.name());
|
|
return null;
|
|
}
|
|
StringBuilder sb5 = new StringBuilder(ExifInterface.GPS_MEASUREMENT_INTERRUPTED);
|
|
int i6 = uniqueId + 1;
|
|
uniqueId = i6;
|
|
sb5.append(i6);
|
|
return sb5.toString();
|
|
}
|
|
|
|
public static void increaseErrorId() {
|
|
uniqueErrorId++;
|
|
}
|
|
|
|
public final void addToRow(ArrayRow arrayRow) {
|
|
int i = 0;
|
|
while (true) {
|
|
int i2 = this.mClientEquationsCount;
|
|
ArrayRow[] arrayRowArr = this.mClientEquations;
|
|
if (i >= i2) {
|
|
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;
|
|
}
|
|
if (arrayRowArr[i] == arrayRow) {
|
|
return;
|
|
} else {
|
|
i++;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void clearStrengths() {
|
|
for (int i = 0; i < 7; i++) {
|
|
this.strengthVector[i] = 0.0f;
|
|
}
|
|
}
|
|
|
|
public String getName() {
|
|
return this.mName;
|
|
}
|
|
|
|
public final void removeFromRow(ArrayRow arrayRow) {
|
|
int i = this.mClientEquationsCount;
|
|
for (int i2 = 0; i2 < i; i2++) {
|
|
if (this.mClientEquations[i2] == arrayRow) {
|
|
for (int i3 = 0; i3 < (i - i2) - 1; i3++) {
|
|
ArrayRow[] arrayRowArr = this.mClientEquations;
|
|
int i4 = i2 + i3;
|
|
arrayRowArr[i4] = arrayRowArr[i4 + 1];
|
|
}
|
|
this.mClientEquationsCount--;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void reset() {
|
|
this.mName = null;
|
|
this.mType = Type.UNKNOWN;
|
|
this.strength = 0;
|
|
this.id = -1;
|
|
this.definitionId = -1;
|
|
this.computedValue = 0.0f;
|
|
this.mClientEquationsCount = 0;
|
|
this.usageInRowCount = 0;
|
|
}
|
|
|
|
public void setName(String str) {
|
|
this.mName = str;
|
|
}
|
|
|
|
public void setType(Type type, String str) {
|
|
this.mType = type;
|
|
}
|
|
|
|
public String strengthsToString() {
|
|
String str = this + MarkdownConstants.LEFT_BRACKET;
|
|
int i = 0;
|
|
boolean z = false;
|
|
boolean z2 = true;
|
|
while (i < this.strengthVector.length) {
|
|
StringBuilder m = BitVector$$ExternalSyntheticOutline0.m(str);
|
|
m.append(this.strengthVector[i]);
|
|
String sb = m.toString();
|
|
float[] fArr = this.strengthVector;
|
|
float f = fArr[i];
|
|
if (f > 0.0f) {
|
|
z = false;
|
|
} else if (f < 0.0f) {
|
|
z = true;
|
|
}
|
|
if (f != 0.0f) {
|
|
z2 = false;
|
|
}
|
|
str = i < fArr.length - 1 ? sb.concat(", ") : sb.concat("] ");
|
|
i++;
|
|
}
|
|
if (z) {
|
|
str = str.concat(" (-)");
|
|
}
|
|
return z2 ? str.concat(" (*)") : str;
|
|
}
|
|
|
|
public String toString() {
|
|
return "" + this.mName;
|
|
}
|
|
|
|
public final void updateReferencesWithNewDefinition(ArrayRow arrayRow) {
|
|
int i = this.mClientEquationsCount;
|
|
for (int i2 = 0; i2 < i; i2++) {
|
|
ArrayRow arrayRow2 = this.mClientEquations[i2];
|
|
arrayRow2.variables.updateFromRow(arrayRow2, arrayRow, false);
|
|
}
|
|
this.mClientEquationsCount = 0;
|
|
}
|
|
|
|
public SolverVariable(Type type, String str) {
|
|
this.id = -1;
|
|
this.definitionId = -1;
|
|
this.strength = 0;
|
|
this.strengthVector = new float[7];
|
|
this.mClientEquations = new ArrayRow[8];
|
|
this.mClientEquationsCount = 0;
|
|
this.usageInRowCount = 0;
|
|
this.mType = type;
|
|
}
|
|
}
|