package o; import java.util.Comparator; import org.threeten.bp.DateTimeException; /* loaded from: classes.dex */ public abstract class gsJ extends AbstractC15535gtF implements gtJ, Comparable { private static final Comparator DATE_COMPARATOR = new Comparator() { // from class: o.gsJ.5 @Override // java.util.Comparator public final int compare(gsJ gsj, gsJ gsj2) { return gtG.compareLongs(gsj.toEpochDay(), gsj2.toEpochDay()); } }; public abstract gsR getChronology(); public abstract int lengthOfMonth(); @Override // o.InterfaceC15536gtL public abstract gsJ plus(long j, InterfaceC15539gtV interfaceC15539gtV); public abstract gsT until(gsJ gsj); @Override // o.InterfaceC15536gtL public abstract gsJ with(InterfaceC15537gtP interfaceC15537gtP, long j); public static gsJ from(gtK gtk) { gtG.requireNonNull(gtk, "temporal"); if (gtk instanceof gsJ) { return (gsJ) gtk; } gsR gsr = (gsR) gtk.query(gtM.chronology()); if (gsr == null) { StringBuilder sb = new StringBuilder("No Chronology found to create ChronoLocalDate: "); sb.append(gtk.getClass()); throw new DateTimeException(sb.toString()); } return gsr.date(gtk); } public gsY getEra() { return getChronology().eraOf(get(EnumC15534gtD.ERA)); } public boolean isLeapYear() { return getChronology().isLeapYear(getLong(EnumC15534gtD.YEAR)); } public int lengthOfYear() { return isLeapYear() ? 366 : 365; } @Override // o.gtK public boolean isSupported(InterfaceC15537gtP interfaceC15537gtP) { if (interfaceC15537gtP instanceof EnumC15534gtD) { return interfaceC15537gtP.isDateBased(); } return interfaceC15537gtP != null && interfaceC15537gtP.isSupportedBy(this); } @Override // o.InterfaceC15536gtL public boolean isSupported(InterfaceC15539gtV interfaceC15539gtV) { if (interfaceC15539gtV instanceof gtH) { return interfaceC15539gtV.isDateBased(); } return interfaceC15539gtV != null && interfaceC15539gtV.isSupportedBy(this); } @Override // o.AbstractC15535gtF, o.InterfaceC15536gtL public gsJ with(gtJ gtj) { return getChronology().ensureChronoLocalDate(super.with(gtj)); } @Override // o.AbstractC15535gtF, o.InterfaceC15536gtL public gsJ plus(gtN gtn) { return getChronology().ensureChronoLocalDate(super.plus(gtn)); } @Override // o.AbstractC15535gtF, o.InterfaceC15536gtL public gsJ minus(gtN gtn) { return getChronology().ensureChronoLocalDate(super.minus(gtn)); } @Override // o.AbstractC15535gtF, o.InterfaceC15536gtL public gsJ minus(long j, InterfaceC15539gtV interfaceC15539gtV) { return getChronology().ensureChronoLocalDate(super.minus(j, interfaceC15539gtV)); } @Override // o.gtE, o.gtK public R query(gtQ gtq) { if (gtq == gtM.chronology()) { return (R) getChronology(); } if (gtq == gtM.precision()) { return (R) gtH.DAYS; } if (gtq == gtM.localDate()) { return (R) C15520gsp.ofEpochDay(toEpochDay()); } if (gtq == gtM.localTime() || gtq == gtM.zone() || gtq == gtM.zoneId() || gtq == gtM.offset()) { return null; } return (R) super.query(gtq); } @Override // o.gtJ public InterfaceC15536gtL adjustInto(InterfaceC15536gtL interfaceC15536gtL) { return interfaceC15536gtL.with(EnumC15534gtD.EPOCH_DAY, toEpochDay()); } public String format(C15554gto c15554gto) { gtG.requireNonNull(c15554gto, "formatter"); return c15554gto.format(this); } public gsO atTime(C15521gsq c15521gsq) { return gsL.of(this, c15521gsq); } public long toEpochDay() { return getLong(EnumC15534gtD.EPOCH_DAY); } @Override // java.lang.Comparable public int compareTo(gsJ gsj) { int compareLongs = gtG.compareLongs(toEpochDay(), gsj.toEpochDay()); return compareLongs == 0 ? getChronology().compareTo(gsj.getChronology()) : compareLongs; } public boolean isAfter(gsJ gsj) { return toEpochDay() > gsj.toEpochDay(); } public boolean isBefore(gsJ gsj) { return toEpochDay() < gsj.toEpochDay(); } public boolean isEqual(gsJ gsj) { return toEpochDay() == gsj.toEpochDay(); } public boolean equals(Object obj) { if (this == obj) { return true; } return (obj instanceof gsJ) && compareTo((gsJ) obj) == 0; } public int hashCode() { long epochDay = toEpochDay(); return ((int) (epochDay ^ (epochDay >>> 32))) ^ getChronology().hashCode(); } public String toString() { long j = getLong(EnumC15534gtD.YEAR_OF_ERA); long j2 = getLong(EnumC15534gtD.MONTH_OF_YEAR); long j3 = getLong(EnumC15534gtD.DAY_OF_MONTH); StringBuilder sb = new StringBuilder(30); sb.append(getChronology().toString()); sb.append(" "); sb.append(getEra()); sb.append(" "); sb.append(j); sb.append(j2 < 10 ? "-0" : "-"); sb.append(j2); sb.append(j3 < 10 ? "-0" : "-"); sb.append(j3); return sb.toString(); } public static Comparator timeLineOrder() { return DATE_COMPARATOR; } }