package android.support.constraint.i.j;

import android.support.constraint.i.i;

/* JADX INFO: compiled from: ConstraintAnchor.java */
/* JADX INFO: loaded from: classes.dex */
public class e {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    final f f449b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    final d f450c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    e f451d;
    private int h;
    android.support.constraint.i.i i;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private l f448a = new l(this);

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public int f452e = 0;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    int f453f = -1;
    private c g = c.NONE;

    /* JADX INFO: compiled from: ConstraintAnchor.java */
    static /* synthetic */ class a {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        static final /* synthetic */ int[] f454a;

        static {
            int[] iArr = new int[d.values().length];
            f454a = iArr;
            try {
                iArr[d.CENTER.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                f454a[d.LEFT.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                f454a[d.RIGHT.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                f454a[d.TOP.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                f454a[d.BOTTOM.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                f454a[d.BASELINE.ordinal()] = 6;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                f454a[d.CENTER_X.ordinal()] = 7;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                f454a[d.CENTER_Y.ordinal()] = 8;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                f454a[d.NONE.ordinal()] = 9;
            } catch (NoSuchFieldError unused9) {
            }
        }
    }

    /* JADX INFO: compiled from: ConstraintAnchor.java */
    public enum b {
        RELAXED,
        STRICT
    }

    /* JADX INFO: compiled from: ConstraintAnchor.java */
    public enum c {
        NONE,
        STRONG,
        WEAK
    }

    /* JADX INFO: compiled from: ConstraintAnchor.java */
    public enum d {
        NONE,
        LEFT,
        TOP,
        RIGHT,
        BOTTOM,
        BASELINE,
        CENTER,
        CENTER_X,
        CENTER_Y
    }

    public e(f fVar, d dVar) {
        b bVar = b.RELAXED;
        this.h = 0;
        this.f449b = fVar;
        this.f450c = dVar;
    }

    public boolean a(e eVar, int i, int i2, c cVar, int i3, boolean z) {
        if (eVar == null) {
            this.f451d = null;
            this.f452e = 0;
            this.f453f = -1;
            this.g = c.NONE;
            this.h = 2;
            return true;
        }
        if (!z && !l(eVar)) {
            return false;
        }
        this.f451d = eVar;
        if (i > 0) {
            this.f452e = i;
        } else {
            this.f452e = 0;
        }
        this.f453f = i2;
        this.g = cVar;
        this.h = i3;
        return true;
    }

    public boolean b(e eVar, int i, c cVar, int i2) {
        return a(eVar, i, -1, cVar, i2, false);
    }

    public int c() {
        return this.h;
    }

    public int d() {
        e eVar;
        if (this.f449b.C() == 8) {
            return 0;
        }
        return (this.f453f <= -1 || (eVar = this.f451d) == null || eVar.f449b.C() != 8) ? this.f452e : this.f453f;
    }

    public f e() {
        return this.f449b;
    }

    public l f() {
        return this.f448a;
    }

    public android.support.constraint.i.i g() {
        return this.i;
    }

    public c h() {
        return this.g;
    }

    public e i() {
        return this.f451d;
    }

    public d j() {
        return this.f450c;
    }

    public boolean k() {
        return this.f451d != null;
    }

    public boolean l(e eVar) {
        if (eVar == null) {
            return false;
        }
        d dVarJ = eVar.j();
        d dVar = this.f450c;
        if (dVarJ == dVar) {
            return dVar != d.BASELINE || (eVar.e().I() && e().I());
        }
        switch (a.f454a[dVar.ordinal()]) {
            case 1:
                return (dVarJ == d.BASELINE || dVarJ == d.CENTER_X || dVarJ == d.CENTER_Y) ? false : true;
            case 2:
            case 3:
                boolean z = dVarJ == d.LEFT || dVarJ == d.RIGHT;
                if (eVar.e() instanceof i) {
                    return z || dVarJ == d.CENTER_X;
                }
                return z;
            case 4:
            case 5:
                boolean z2 = dVarJ == d.TOP || dVarJ == d.BOTTOM;
                if (eVar.e() instanceof i) {
                    return z2 || dVarJ == d.CENTER_Y;
                }
                return z2;
            case 6:
            case 7:
            case 8:
            case 9:
                return false;
            default:
                throw new AssertionError(this.f450c.name());
        }
    }

    public void m() {
        this.f451d = null;
        this.f452e = 0;
        this.f453f = -1;
        this.g = c.STRONG;
        this.h = 0;
        b bVar = b.RELAXED;
        this.f448a.e();
    }

    public void n(android.support.constraint.i.c cVar) {
        android.support.constraint.i.i iVar = this.i;
        if (iVar == null) {
            this.i = new android.support.constraint.i.i(i.a.UNRESTRICTED, null);
        } else {
            iVar.d();
        }
    }

    public String toString() {
        return this.f449b.n() + ":" + this.f450c.toString();
    }
}
