package android.support.constraint.i.j;

import android.support.constraint.i.j.e;
import android.support.constraint.i.j.f;
import java.util.ArrayList;

/* JADX INFO: compiled from: Guideline.java */
/* JADX INFO: loaded from: classes.dex */
public class i extends f {
    protected float k0 = -1.0f;
    protected int l0 = -1;
    protected int m0 = -1;
    private e n0 = this.t;
    private int o0 = 0;
    private boolean p0 = false;

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

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

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

    public i() {
        this.B.clear();
        this.B.add(this.n0);
        int length = this.A.length;
        for (int i = 0; i < length; i++) {
            this.A[i] = this.n0;
        }
    }

    @Override // android.support.constraint.i.j.f
    public void G0(android.support.constraint.i.e eVar) {
        if (u() == null) {
            return;
        }
        int iY = eVar.y(this.n0);
        if (this.o0 == 1) {
            C0(iY);
            D0(0);
            b0(u().r());
            y0(0);
            return;
        }
        C0(0);
        D0(iY);
        y0(u().D());
        b0(0);
    }

    public int I0() {
        return this.o0;
    }

    public void J0(int i) {
        if (i > -1) {
            this.k0 = -1.0f;
            this.l0 = i;
            this.m0 = -1;
        }
    }

    public void K0(int i) {
        if (i > -1) {
            this.k0 = -1.0f;
            this.l0 = -1;
            this.m0 = i;
        }
    }

    public void L0(float f2) {
        if (f2 > -1.0f) {
            this.k0 = f2;
            this.l0 = -1;
            this.m0 = -1;
        }
    }

    public void M0(int i) {
        if (this.o0 == i) {
            return;
        }
        this.o0 = i;
        this.B.clear();
        if (this.o0 == 1) {
            this.n0 = this.s;
        } else {
            this.n0 = this.t;
        }
        this.B.add(this.n0);
        int length = this.A.length;
        for (int i2 = 0; i2 < length; i2++) {
            this.A[i2] = this.n0;
        }
    }

    @Override // android.support.constraint.i.j.f
    public void b(android.support.constraint.i.e eVar) {
        g gVar = (g) u();
        if (gVar == null) {
            return;
        }
        e eVarH = gVar.h(e.d.LEFT);
        e eVarH2 = gVar.h(e.d.RIGHT);
        f fVar = this.D;
        boolean z = fVar != null && fVar.C[0] == f.b.WRAP_CONTENT;
        if (this.o0 == 0) {
            eVarH = gVar.h(e.d.TOP);
            eVarH2 = gVar.h(e.d.BOTTOM);
            f fVar2 = this.D;
            z = fVar2 != null && fVar2.C[1] == f.b.WRAP_CONTENT;
        }
        if (this.l0 != -1) {
            android.support.constraint.i.i iVarR = eVar.r(this.n0);
            eVar.e(iVarR, eVar.r(eVarH), this.l0, 6);
            if (z) {
                eVar.i(eVar.r(eVarH2), iVarR, 0, 5);
                return;
            }
            return;
        }
        if (this.m0 == -1) {
            if (this.k0 != -1.0f) {
                eVar.d(android.support.constraint.i.e.t(eVar, eVar.r(this.n0), eVar.r(eVarH), eVar.r(eVarH2), this.k0, this.p0));
                return;
            }
            return;
        }
        android.support.constraint.i.i iVarR2 = eVar.r(this.n0);
        android.support.constraint.i.i iVarR3 = eVar.r(eVarH2);
        eVar.e(iVarR2, iVarR3, -this.m0, 6);
        if (z) {
            eVar.i(iVarR2, eVar.r(eVarH), 0, 5);
            eVar.i(iVarR3, iVarR2, 0, 5);
        }
    }

    @Override // android.support.constraint.i.j.f
    public boolean c() {
        return true;
    }

    @Override // android.support.constraint.i.j.f
    public void d(int i) {
        f fVarU = u();
        if (fVarU == null) {
            return;
        }
        if (I0() == 1) {
            this.t.f().h(1, fVarU.t.f(), 0);
            this.v.f().h(1, fVarU.t.f(), 0);
            if (this.l0 != -1) {
                this.s.f().h(1, fVarU.s.f(), this.l0);
                this.u.f().h(1, fVarU.s.f(), this.l0);
                return;
            } else if (this.m0 != -1) {
                this.s.f().h(1, fVarU.u.f(), -this.m0);
                this.u.f().h(1, fVarU.u.f(), -this.m0);
                return;
            } else {
                if (this.k0 == -1.0f || fVarU.s() != f.b.FIXED) {
                    return;
                }
                int i2 = (int) (fVarU.E * this.k0);
                this.s.f().h(1, fVarU.s.f(), i2);
                this.u.f().h(1, fVarU.s.f(), i2);
                return;
            }
        }
        this.s.f().h(1, fVarU.s.f(), 0);
        this.u.f().h(1, fVarU.s.f(), 0);
        if (this.l0 != -1) {
            this.t.f().h(1, fVarU.t.f(), this.l0);
            this.v.f().h(1, fVarU.t.f(), this.l0);
        } else if (this.m0 != -1) {
            this.t.f().h(1, fVarU.v.f(), -this.m0);
            this.v.f().h(1, fVarU.v.f(), -this.m0);
        } else {
            if (this.k0 == -1.0f || fVarU.B() != f.b.FIXED) {
                return;
            }
            int i3 = (int) (fVarU.F * this.k0);
            this.t.f().h(1, fVarU.t.f(), i3);
            this.v.f().h(1, fVarU.t.f(), i3);
        }
    }

    @Override // android.support.constraint.i.j.f
    public e h(e.d dVar) {
        switch (a.f469a[dVar.ordinal()]) {
            case 1:
            case 2:
                if (this.o0 == 1) {
                    return this.n0;
                }
                break;
            case 3:
            case 4:
                if (this.o0 == 0) {
                    return this.n0;
                }
                break;
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
                return null;
        }
        throw new AssertionError(dVar.name());
    }

    @Override // android.support.constraint.i.j.f
    public ArrayList<e> i() {
        return this.B;
    }
}
