what-the-bank/sources/o/C15542gtc.java

170 lines
6.2 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import com.pingan.ai.face.common.PaFaceConstants;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectStreamException;
import java.io.Serializable;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicReference;
import org.threeten.bp.DateTimeException;
/* renamed from: o.gtc, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
public final class C15542gtc extends AbstractC15533gtC implements Serializable {
private static final int ADDITIONAL_VALUE = 4;
static final int ERA_OFFSET = 2;
public static final C15542gtc HEISEI;
private static final AtomicReference<C15542gtc[]> KNOWN_ERAS;
public static final C15542gtc MEIJI;
public static final C15542gtc REIWA;
public static final C15542gtc SHOWA;
public static final C15542gtc TAISHO;
private static final long serialVersionUID = 1466499369062886794L;
private final int eraValue;
private final transient String name;
private final transient C15520gsp since;
private static int ordinal(int i) {
return i + 1;
}
static {
C15542gtc c15542gtc = new C15542gtc(-1, C15520gsp.of(1868, 9, 8), "Meiji");
MEIJI = c15542gtc;
C15542gtc c15542gtc2 = new C15542gtc(0, C15520gsp.of(1912, 7, 30), "Taisho");
TAISHO = c15542gtc2;
C15542gtc c15542gtc3 = new C15542gtc(1, C15520gsp.of(1926, 12, 25), "Showa");
SHOWA = c15542gtc3;
C15542gtc c15542gtc4 = new C15542gtc(2, C15520gsp.of(1989, 1, 8), "Heisei");
HEISEI = c15542gtc4;
C15542gtc c15542gtc5 = new C15542gtc(3, C15520gsp.of(PaFaceConstants.EnvironmentalTips.COVER_MOUTH, 5, 1), "Reiwa");
REIWA = c15542gtc5;
KNOWN_ERAS = new AtomicReference<>(new C15542gtc[]{c15542gtc, c15542gtc2, c15542gtc3, c15542gtc4, c15542gtc5});
}
private C15542gtc(int i, C15520gsp c15520gsp, String str) {
this.eraValue = i;
this.since = c15520gsp;
this.name = str;
}
private Object readResolve() throws ObjectStreamException {
try {
return of(this.eraValue);
} catch (DateTimeException e) {
InvalidObjectException invalidObjectException = new InvalidObjectException("Invalid era");
invalidObjectException.initCause(e);
throw invalidObjectException;
}
}
public static C15542gtc registerEra(C15520gsp c15520gsp, String str) {
AtomicReference<C15542gtc[]> atomicReference = KNOWN_ERAS;
C15542gtc[] c15542gtcArr = atomicReference.get();
if (c15542gtcArr.length > 5) {
throw new DateTimeException("Only one additional Japanese era can be added");
}
gtG.requireNonNull(c15520gsp, "since");
gtG.requireNonNull(str, "name");
if (!c15520gsp.isAfter(REIWA.since)) {
throw new DateTimeException("Invalid since date for additional Japanese era, must be after Reiwa");
}
C15542gtc c15542gtc = new C15542gtc(4, c15520gsp, str);
C15542gtc[] c15542gtcArr2 = (C15542gtc[]) Arrays.copyOf(c15542gtcArr, 6);
c15542gtcArr2[5] = c15542gtc;
while (!atomicReference.compareAndSet(c15542gtcArr, c15542gtcArr2)) {
if (atomicReference.get() != c15542gtcArr) {
throw new DateTimeException("Only one additional Japanese era can be added");
}
}
return c15542gtc;
}
public static C15542gtc of(int i) {
C15542gtc[] c15542gtcArr = KNOWN_ERAS.get();
if (i < MEIJI.eraValue || i > c15542gtcArr[c15542gtcArr.length - 1].eraValue) {
throw new DateTimeException("japaneseEra is invalid");
}
return c15542gtcArr[ordinal(i)];
}
public static C15542gtc valueOf(String str) {
gtG.requireNonNull(str, "japaneseEra");
for (C15542gtc c15542gtc : KNOWN_ERAS.get()) {
if (str.equals(c15542gtc.name)) {
return c15542gtc;
}
}
throw new IllegalArgumentException("Era not found: ".concat(String.valueOf(str)));
}
public static C15542gtc[] values() {
C15542gtc[] c15542gtcArr = KNOWN_ERAS.get();
return (C15542gtc[]) Arrays.copyOf(c15542gtcArr, c15542gtcArr.length);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static C15542gtc from(C15520gsp c15520gsp) {
if (c15520gsp.isBefore(MEIJI.since)) {
throw new DateTimeException("Date too early: ".concat(String.valueOf(c15520gsp)));
}
C15542gtc[] c15542gtcArr = KNOWN_ERAS.get();
for (int length = c15542gtcArr.length - 1; length >= 0; length--) {
C15542gtc c15542gtc = c15542gtcArr[length];
if (c15520gsp.compareTo((gsJ) c15542gtc.since) >= 0) {
return c15542gtc;
}
}
return null;
}
/* JADX INFO: Access modifiers changed from: package-private */
public final C15520gsp endDate() {
int ordinal = ordinal(this.eraValue);
C15542gtc[] values = values();
if (ordinal >= values.length - 1) {
return C15520gsp.MAX;
}
return values[ordinal + 1].startDate().minusDays(1L);
}
@Override // o.gtE, o.gtK
public final gtT range(InterfaceC15537gtP interfaceC15537gtP) {
if (interfaceC15537gtP == EnumC15534gtD.ERA) {
return C15545gtf.INSTANCE.range(EnumC15534gtD.ERA);
}
return super.range(interfaceC15537gtP);
}
private Object writeReplace() {
return new C15548gti((byte) 2, this);
}
/* JADX INFO: Access modifiers changed from: package-private */
public final void writeExternal(DataOutput dataOutput) throws IOException {
dataOutput.writeByte(getValue());
}
/* JADX INFO: Access modifiers changed from: package-private */
public static C15542gtc readExternal(DataInput dataInput) throws IOException {
return of(dataInput.readByte());
}
public final String toString() {
return this.name;
}
/* JADX INFO: Access modifiers changed from: package-private */
public final C15520gsp startDate() {
return this.since;
}
@Override // o.gsY
public final int getValue() {
return this.eraValue;
}
}