package org.joda.time;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import org.joda.time.chrono.ISOChronology;

/* loaded from: classes.dex */
public final class LocalDate extends mr.d implements Serializable {

    /* renamed from: q, reason: collision with root package name */
    private static final Set f31882q;
    private static final long serialVersionUID = -8775358157899L;
    private final a iChronology;
    private final long iLocalMillis;

    /* renamed from: p, reason: collision with root package name */
    private transient int f31883p;

    static {
        HashSet hashSet = new HashSet();
        f31882q = hashSet;
        hashSet.add(DurationFieldType.b());
        hashSet.add(DurationFieldType.l());
        hashSet.add(DurationFieldType.j());
        hashSet.add(DurationFieldType.m());
        hashSet.add(DurationFieldType.n());
        hashSet.add(DurationFieldType.a());
        hashSet.add(DurationFieldType.c());
    }

    public LocalDate(long j10, a aVar) {
        a c10 = c.c(aVar);
        long o10 = c10.m().o(DateTimeZone.f31852p, j10);
        a J = c10.J();
        this.iLocalMillis = J.e().y(o10);
        this.iChronology = J;
    }

    private Object readResolve() {
        a aVar = this.iChronology;
        return aVar == null ? new LocalDate(this.iLocalMillis, ISOChronology.V()) : !DateTimeZone.f31852p.equals(aVar.m()) ? new LocalDate(this.iLocalMillis, this.iChronology.J()) : this;
    }

    public static LocalDate t(String str, org.joda.time.format.b bVar) {
        return bVar.f(str);
    }

    @Override // java.lang.Comparable
    /* renamed from: a, reason: merged with bridge method [inline-methods] */
    public int compareTo(i iVar) {
        if (this == iVar) {
            return 0;
        }
        if (iVar instanceof LocalDate) {
            LocalDate localDate = (LocalDate) iVar;
            if (this.iChronology.equals(localDate.iChronology)) {
                long j10 = this.iLocalMillis;
                long j11 = localDate.iLocalMillis;
                if (j10 < j11) {
                    return -1;
                }
                return j10 == j11 ? 0 : 1;
            }
        }
        return super.compareTo(iVar);
    }

    @Override // org.joda.time.i
    public a d() {
        return this.iChronology;
    }

    @Override // mr.c
    protected b e(int i10, a aVar) {
        if (i10 == 0) {
            return aVar.L();
        }
        if (i10 == 1) {
            return aVar.y();
        }
        if (i10 == 2) {
            return aVar.e();
        }
        throw new IndexOutOfBoundsException("Invalid index: " + i10);
    }

    @Override // mr.c
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj instanceof LocalDate) {
            LocalDate localDate = (LocalDate) obj;
            if (this.iChronology.equals(localDate.iChronology)) {
                return this.iLocalMillis == localDate.iLocalMillis;
            }
        }
        return super.equals(obj);
    }

    @Override // org.joda.time.i
    public int f(int i10) {
        if (i10 == 0) {
            return d().L().c(m());
        }
        if (i10 == 1) {
            return d().y().c(m());
        }
        if (i10 == 2) {
            return d().e().c(m());
        }
        throw new IndexOutOfBoundsException("Invalid index: " + i10);
    }

    @Override // mr.c
    public int hashCode() {
        int i10 = this.f31883p;
        if (i10 != 0) {
            return i10;
        }
        int hashCode = super.hashCode();
        this.f31883p = hashCode;
        return hashCode;
    }

    protected long m() {
        return this.iLocalMillis;
    }

    @Override // org.joda.time.i
    public boolean p(DateTimeFieldType dateTimeFieldType) {
        if (dateTimeFieldType == null) {
            return false;
        }
        DurationFieldType E = dateTimeFieldType.E();
        if (f31882q.contains(E) || E.d(d()).s() >= d().h().s()) {
            return dateTimeFieldType.F(d()).v();
        }
        return false;
    }

    @Override // org.joda.time.i
    public int q(DateTimeFieldType dateTimeFieldType) {
        if (dateTimeFieldType == null) {
            throw new IllegalArgumentException("The DateTimeFieldType must not be null");
        }
        if (p(dateTimeFieldType)) {
            return dateTimeFieldType.F(d()).c(m());
        }
        throw new IllegalArgumentException("Field '" + dateTimeFieldType + "' is not supported");
    }

    public int r() {
        return d().y().c(m());
    }

    public int s() {
        return d().L().c(m());
    }

    @Override // org.joda.time.i
    public int size() {
        return 3;
    }

    public String toString() {
        return org.joda.time.format.i.a().j(this);
    }
}
