package androidx.constraintlayout.solver.widgets; import androidx.constraintlayout.solver.Cache; import androidx.constraintlayout.solver.SolverVariable; /* loaded from: classes.dex */ public class ConstraintAnchor { final ConstraintWidget b; final Type c; ConstraintAnchor d; private int h; SolverVariable i; private ResolutionAnchor a = new ResolutionAnchor(this); public int e = 0; int f = -1; private Strength g = Strength.NONE; /* renamed from: androidx.constraintlayout.solver.widgets.ConstraintAnchor$1, reason: invalid class name */ static /* synthetic */ class AnonymousClass1 { static final /* synthetic */ int[] a = new int[Type.values().length]; static { try { a[Type.CENTER.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { a[Type.LEFT.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { a[Type.RIGHT.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } try { a[Type.TOP.ordinal()] = 4; } catch (NoSuchFieldError unused4) { } try { a[Type.BOTTOM.ordinal()] = 5; } catch (NoSuchFieldError unused5) { } try { a[Type.BASELINE.ordinal()] = 6; } catch (NoSuchFieldError unused6) { } try { a[Type.CENTER_X.ordinal()] = 7; } catch (NoSuchFieldError unused7) { } try { a[Type.CENTER_Y.ordinal()] = 8; } catch (NoSuchFieldError unused8) { } try { a[Type.NONE.ordinal()] = 9; } catch (NoSuchFieldError unused9) { } } } public enum ConnectionType { RELAXED, STRICT } public enum Strength { NONE, STRONG, WEAK } public enum Type { NONE, LEFT, TOP, RIGHT, BOTTOM, BASELINE, CENTER, CENTER_X, CENTER_Y } public ConstraintAnchor(ConstraintWidget constraintWidget, Type type) { ConnectionType connectionType = ConnectionType.RELAXED; this.h = 0; this.b = constraintWidget; this.c = type; } public void a(Cache cache) { SolverVariable solverVariable = this.i; if (solverVariable == null) { this.i = new SolverVariable(SolverVariable.Type.UNRESTRICTED, null); } else { solverVariable.a(); } } public int b() { ConstraintAnchor constraintAnchor; if (this.b.r() == 8) { return 0; } return (this.f <= -1 || (constraintAnchor = this.d) == null || constraintAnchor.b.r() != 8) ? this.e : this.f; } public ConstraintWidget c() { return this.b; } public ResolutionAnchor d() { return this.a; } public SolverVariable e() { return this.i; } public Strength f() { return this.g; } public ConstraintAnchor g() { return this.d; } public Type h() { return this.c; } public boolean i() { return this.d != null; } public void j() { this.d = null; this.e = 0; this.f = -1; this.g = Strength.STRONG; this.h = 0; ConnectionType connectionType = ConnectionType.RELAXED; this.a.d(); } public String toString() { return this.b.f() + ":" + this.c.toString(); } public int a() { return this.h; } public boolean a(ConstraintAnchor constraintAnchor, int i, Strength strength, int i2) { return a(constraintAnchor, i, -1, strength, i2, false); } public boolean a(ConstraintAnchor constraintAnchor, int i, int i2, Strength strength, int i3, boolean z) { if (constraintAnchor == null) { this.d = null; this.e = 0; this.f = -1; this.g = Strength.NONE; this.h = 2; return true; } if (!z && !a(constraintAnchor)) { return false; } this.d = constraintAnchor; if (i > 0) { this.e = i; } else { this.e = 0; } this.f = i2; this.g = strength; this.h = i3; return true; } public boolean a(ConstraintAnchor constraintAnchor) { if (constraintAnchor == null) { return false; } Type h = constraintAnchor.h(); Type type = this.c; if (h == type) { return type != Type.BASELINE || (constraintAnchor.c().x() && c().x()); } switch (AnonymousClass1.a[type.ordinal()]) { case 1: return (h == Type.BASELINE || h == Type.CENTER_X || h == Type.CENTER_Y) ? false : true; case 2: case 3: boolean z = h == Type.LEFT || h == Type.RIGHT; return constraintAnchor.c() instanceof Guideline ? z || h == Type.CENTER_X : z; case 4: case 5: boolean z2 = h == Type.TOP || h == Type.BOTTOM; return constraintAnchor.c() instanceof Guideline ? z2 || h == Type.CENTER_Y : z2; case 6: case 7: case 8: case 9: return false; default: throw new AssertionError(this.c.name()); } } }