323 lines
11 KiB
Java
323 lines
11 KiB
Java
package o;
|
|
|
|
import java.io.DataInput;
|
|
import java.io.DataOutput;
|
|
import java.io.IOException;
|
|
import java.io.InvalidObjectException;
|
|
import java.io.ObjectStreamException;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import java.lang.reflect.Method;
|
|
import java.util.HashSet;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Locale;
|
|
import java.util.Map;
|
|
import java.util.ServiceLoader;
|
|
import java.util.Set;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
import org.threeten.bp.DateTimeException;
|
|
import org.threeten.bp.temporal.UnsupportedTemporalTypeException;
|
|
|
|
/* loaded from: classes.dex */
|
|
public abstract class gsR implements Comparable<gsR> {
|
|
private static final Method LOCALE_METHOD;
|
|
public static final gtQ<gsR> FROM = new gtQ<gsR>() { // from class: o.gsR.1
|
|
@Override // o.gtQ
|
|
public final gsR queryFrom(gtK gtk) {
|
|
return gsR.from(gtk);
|
|
}
|
|
};
|
|
private static final ConcurrentHashMap<String, gsR> CHRONOS_BY_ID = new ConcurrentHashMap<>();
|
|
private static final ConcurrentHashMap<String, gsR> CHRONOS_BY_TYPE = new ConcurrentHashMap<>();
|
|
|
|
public abstract gsJ date(int i, int i2, int i3);
|
|
|
|
public abstract gsJ date(gtK gtk);
|
|
|
|
public abstract gsJ dateEpochDay(long j);
|
|
|
|
public abstract gsJ dateYearDay(int i, int i2);
|
|
|
|
public abstract gsY eraOf(int i);
|
|
|
|
public abstract List<gsY> eras();
|
|
|
|
public abstract String getCalendarType();
|
|
|
|
public abstract String getId();
|
|
|
|
public abstract boolean isLeapYear(long j);
|
|
|
|
public abstract int prolepticYear(gsY gsy, int i);
|
|
|
|
public abstract gtT range(EnumC15534gtD enumC15534gtD);
|
|
|
|
public abstract gsJ resolveDate(Map<InterfaceC15537gtP, Long> map, gtA gta);
|
|
|
|
static {
|
|
Method method;
|
|
try {
|
|
method = Locale.class.getMethod("getUnicodeLocaleType", String.class);
|
|
} catch (Throwable unused) {
|
|
method = null;
|
|
}
|
|
LOCALE_METHOD = method;
|
|
}
|
|
|
|
public static gsR from(gtK gtk) {
|
|
gtG.requireNonNull(gtk, "temporal");
|
|
gsR gsr = (gsR) gtk.query(gtM.chronology());
|
|
return gsr == null ? gsV.INSTANCE : gsr;
|
|
}
|
|
|
|
public static gsR ofLocale(Locale locale) {
|
|
String str;
|
|
init();
|
|
gtG.requireNonNull(locale, "locale");
|
|
Method method = LOCALE_METHOD;
|
|
if (method != null) {
|
|
try {
|
|
str = (String) method.invoke(locale, "ca");
|
|
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException unused) {
|
|
}
|
|
} else {
|
|
if (locale.equals(C15545gtf.LOCALE)) {
|
|
str = "japanese";
|
|
}
|
|
str = "iso";
|
|
}
|
|
if (str == null || "iso".equals(str) || "iso8601".equals(str)) {
|
|
return gsV.INSTANCE;
|
|
}
|
|
gsR gsr = CHRONOS_BY_TYPE.get(str);
|
|
if (gsr != null) {
|
|
return gsr;
|
|
}
|
|
throw new DateTimeException("Unknown calendar system: ".concat(String.valueOf(str)));
|
|
}
|
|
|
|
public static gsR of(String str) {
|
|
init();
|
|
gsR gsr = CHRONOS_BY_ID.get(str);
|
|
if (gsr != null) {
|
|
return gsr;
|
|
}
|
|
gsR gsr2 = CHRONOS_BY_TYPE.get(str);
|
|
if (gsr2 != null) {
|
|
return gsr2;
|
|
}
|
|
throw new DateTimeException("Unknown chronology: ".concat(String.valueOf(str)));
|
|
}
|
|
|
|
public static Set<gsR> getAvailableChronologies() {
|
|
init();
|
|
return new HashSet(CHRONOS_BY_ID.values());
|
|
}
|
|
|
|
private static void init() {
|
|
ConcurrentHashMap<String, gsR> concurrentHashMap = CHRONOS_BY_ID;
|
|
if (concurrentHashMap.isEmpty()) {
|
|
register(gsV.INSTANCE);
|
|
register(C15549gtj.INSTANCE);
|
|
register(C15544gte.INSTANCE);
|
|
register(C15545gtf.INSTANCE);
|
|
register(C15540gta.INSTANCE);
|
|
concurrentHashMap.putIfAbsent("Hijrah", C15540gta.INSTANCE);
|
|
CHRONOS_BY_TYPE.putIfAbsent("islamic", C15540gta.INSTANCE);
|
|
Iterator it = ServiceLoader.load(gsR.class, gsR.class.getClassLoader()).iterator();
|
|
while (it.hasNext()) {
|
|
gsR gsr = (gsR) it.next();
|
|
CHRONOS_BY_ID.putIfAbsent(gsr.getId(), gsr);
|
|
String calendarType = gsr.getCalendarType();
|
|
if (calendarType != null) {
|
|
CHRONOS_BY_TYPE.putIfAbsent(calendarType, gsr);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void register(gsR gsr) {
|
|
CHRONOS_BY_ID.putIfAbsent(gsr.getId(), gsr);
|
|
String calendarType = gsr.getCalendarType();
|
|
if (calendarType != null) {
|
|
CHRONOS_BY_TYPE.putIfAbsent(calendarType, gsr);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public <D extends gsJ> D ensureChronoLocalDate(InterfaceC15536gtL interfaceC15536gtL) {
|
|
D d = (D) interfaceC15536gtL;
|
|
if (equals(d.getChronology())) {
|
|
return d;
|
|
}
|
|
StringBuilder sb = new StringBuilder("Chrono mismatch, expected: ");
|
|
sb.append(getId());
|
|
sb.append(", actual: ");
|
|
sb.append(d.getChronology().getId());
|
|
throw new ClassCastException(sb.toString());
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public <D extends gsJ> gsL<D> ensureChronoLocalDateTime(InterfaceC15536gtL interfaceC15536gtL) {
|
|
gsL<D> gsl = (gsL) interfaceC15536gtL;
|
|
if (equals(gsl.toLocalDate().getChronology())) {
|
|
return gsl;
|
|
}
|
|
StringBuilder sb = new StringBuilder("Chrono mismatch, required: ");
|
|
sb.append(getId());
|
|
sb.append(", supplied: ");
|
|
sb.append(gsl.toLocalDate().getChronology().getId());
|
|
throw new ClassCastException(sb.toString());
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public <D extends gsJ> gsP<D> ensureChronoZonedDateTime(InterfaceC15536gtL interfaceC15536gtL) {
|
|
gsP<D> gsp = (gsP) interfaceC15536gtL;
|
|
if (equals(gsp.toLocalDate().getChronology())) {
|
|
return gsp;
|
|
}
|
|
StringBuilder sb = new StringBuilder("Chrono mismatch, required: ");
|
|
sb.append(getId());
|
|
sb.append(", supplied: ");
|
|
sb.append(gsp.toLocalDate().getChronology().getId());
|
|
throw new ClassCastException(sb.toString());
|
|
}
|
|
|
|
public gsJ date(gsY gsy, int i, int i2, int i3) {
|
|
return date(prolepticYear(gsy, i), i2, i3);
|
|
}
|
|
|
|
public gsJ dateYearDay(gsY gsy, int i, int i2) {
|
|
return dateYearDay(prolepticYear(gsy, i), i2);
|
|
}
|
|
|
|
public gsJ dateNow() {
|
|
return dateNow(AbstractC15514gsj.systemDefaultZone());
|
|
}
|
|
|
|
public gsJ dateNow(AbstractC15502gsH abstractC15502gsH) {
|
|
return dateNow(AbstractC15514gsj.system(abstractC15502gsH));
|
|
}
|
|
|
|
public gsJ dateNow(AbstractC15514gsj abstractC15514gsj) {
|
|
gtG.requireNonNull(abstractC15514gsj, "clock");
|
|
return date(C15520gsp.now(abstractC15514gsj));
|
|
}
|
|
|
|
public gsO<?> localDateTime(gtK gtk) {
|
|
try {
|
|
return date(gtk).atTime(C15521gsq.from(gtk));
|
|
} catch (DateTimeException e) {
|
|
StringBuilder sb = new StringBuilder("Unable to obtain ChronoLocalDateTime from TemporalAccessor: ");
|
|
sb.append(gtk.getClass());
|
|
throw new DateTimeException(sb.toString(), e);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX WARN: Type inference failed for: r5v6, types: [o.gsS, o.gsS<?>] */
|
|
public gsS<?> zonedDateTime(gtK gtk) {
|
|
try {
|
|
AbstractC15502gsH from = AbstractC15502gsH.from(gtk);
|
|
try {
|
|
gtk = zonedDateTime(C15523gss.from(gtk), from);
|
|
return gtk;
|
|
} catch (DateTimeException unused) {
|
|
return gsP.ofBest(ensureChronoLocalDateTime(localDateTime(gtk)), from, null);
|
|
}
|
|
} catch (DateTimeException e) {
|
|
StringBuilder sb = new StringBuilder("Unable to obtain ChronoZonedDateTime from TemporalAccessor: ");
|
|
sb.append(gtk.getClass());
|
|
throw new DateTimeException(sb.toString(), e);
|
|
}
|
|
}
|
|
|
|
public gsS<?> zonedDateTime(C15523gss c15523gss, AbstractC15502gsH abstractC15502gsH) {
|
|
return gsP.ofInstant(this, c15523gss, abstractC15502gsH);
|
|
}
|
|
|
|
public gsT period(int i, int i2, int i3) {
|
|
return new C15503gsU(this, i, i2, i3);
|
|
}
|
|
|
|
public String getDisplayName(EnumC15532gtB enumC15532gtB, Locale locale) {
|
|
return new C15553gtn().appendChronologyText(enumC15532gtB).toFormatter(locale).format(new gtE(this) { // from class: o.gsR.4
|
|
final gsR this$0;
|
|
|
|
@Override // o.gtK
|
|
public final boolean isSupported(InterfaceC15537gtP interfaceC15537gtP) {
|
|
return false;
|
|
}
|
|
|
|
{
|
|
this.this$0 = this;
|
|
}
|
|
|
|
@Override // o.gtK
|
|
public final long getLong(InterfaceC15537gtP interfaceC15537gtP) {
|
|
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(String.valueOf(interfaceC15537gtP)));
|
|
}
|
|
|
|
@Override // o.gtE, o.gtK
|
|
public final <R> R query(gtQ<R> gtq) {
|
|
return gtq == gtM.chronology() ? (R) this.this$0 : (R) super.query(gtq);
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public void updateResolveMap(Map<InterfaceC15537gtP, Long> map, EnumC15534gtD enumC15534gtD, long j) {
|
|
Long l = map.get(enumC15534gtD);
|
|
if (l != null && l.longValue() != j) {
|
|
StringBuilder sb = new StringBuilder("Invalid state, field: ");
|
|
sb.append(enumC15534gtD);
|
|
sb.append(" ");
|
|
sb.append(l);
|
|
sb.append(" conflicts with ");
|
|
sb.append(enumC15534gtD);
|
|
sb.append(" ");
|
|
sb.append(j);
|
|
throw new DateTimeException(sb.toString());
|
|
}
|
|
map.put(enumC15534gtD, Long.valueOf(j));
|
|
}
|
|
|
|
@Override // java.lang.Comparable
|
|
public int compareTo(gsR gsr) {
|
|
return getId().compareTo(gsr.getId());
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
return (obj instanceof gsR) && compareTo((gsR) obj) == 0;
|
|
}
|
|
|
|
public int hashCode() {
|
|
return getClass().hashCode() ^ getId().hashCode();
|
|
}
|
|
|
|
public String toString() {
|
|
return getId();
|
|
}
|
|
|
|
private Object writeReplace() {
|
|
return new C15548gti((byte) 11, this);
|
|
}
|
|
|
|
private Object readResolve() throws ObjectStreamException {
|
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public void writeExternal(DataOutput dataOutput) throws IOException {
|
|
dataOutput.writeUTF(getId());
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static gsR readExternal(DataInput dataInput) throws IOException {
|
|
return of(dataInput.readUTF());
|
|
}
|
|
}
|