package o; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import o.C15553gtn; import org.threeten.bp.temporal.UnsupportedTemporalTypeException; /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.gtv, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ public final class C15561gtv { private boolean caseSensitive; private Locale locale; private gsR overrideChronology; private AbstractC15502gsH overrideZone; private final ArrayList parsed; private boolean strict; private C15559gtt symbols; /* JADX INFO: Access modifiers changed from: package-private */ public C15561gtv(C15554gto c15554gto) { this.caseSensitive = true; this.strict = true; ArrayList arrayList = new ArrayList<>(); this.parsed = arrayList; this.locale = c15554gto.getLocale(); this.symbols = c15554gto.getDecimalStyle(); this.overrideChronology = c15554gto.getChronology(); this.overrideZone = c15554gto.getZone(); arrayList.add(new IeS()); } C15561gtv(Locale locale, C15559gtt c15559gtt, gsR gsr) { this.caseSensitive = true; this.strict = true; ArrayList arrayList = new ArrayList<>(); this.parsed = arrayList; this.locale = locale; this.symbols = c15559gtt; this.overrideChronology = gsr; this.overrideZone = null; arrayList.add(new IeS()); } C15561gtv(C15561gtv c15561gtv) { this.caseSensitive = true; this.strict = true; ArrayList arrayList = new ArrayList<>(); this.parsed = arrayList; this.locale = c15561gtv.locale; this.symbols = c15561gtv.symbols; this.overrideChronology = c15561gtv.overrideChronology; this.overrideZone = c15561gtv.overrideZone; this.caseSensitive = c15561gtv.caseSensitive; this.strict = c15561gtv.strict; arrayList.add(new IeS()); } /* JADX INFO: Access modifiers changed from: package-private */ public final C15561gtv copy() { return new C15561gtv(this); } /* JADX INFO: Access modifiers changed from: package-private */ public final gsR getEffectiveChronology() { gsR gsr = currentParsed().chrono; if (gsr != null) { return gsr; } gsR gsr2 = this.overrideChronology; return gsr2 == null ? gsV.INSTANCE : gsr2; } /* JADX INFO: Access modifiers changed from: package-private */ public final boolean subSequenceEquals(CharSequence charSequence, int i, CharSequence charSequence2, int i2, int i3) { if (i + i3 > charSequence.length() || i2 + i3 > charSequence2.length()) { return false; } if (isCaseSensitive()) { for (int i4 = 0; i4 < i3; i4++) { if (charSequence.charAt(i + i4) != charSequence2.charAt(i2 + i4)) { return false; } } return true; } for (int i5 = 0; i5 < i3; i5++) { char charAt = charSequence.charAt(i + i5); char charAt2 = charSequence2.charAt(i2 + i5); if (charAt != charAt2 && Character.toUpperCase(charAt) != Character.toUpperCase(charAt2) && Character.toLowerCase(charAt) != Character.toLowerCase(charAt2)) { return false; } } return true; } /* JADX INFO: Access modifiers changed from: package-private */ public final boolean charEquals(char c, char c2) { if (isCaseSensitive()) { return c == c2; } return charEqualsIgnoreCase(c, c2); } static boolean charEqualsIgnoreCase(char c, char c2) { return c == c2 || Character.toUpperCase(c) == Character.toUpperCase(c2) || Character.toLowerCase(c) == Character.toLowerCase(c2); } /* JADX INFO: Access modifiers changed from: package-private */ public final void startOptional() { this.parsed.add(currentParsed().copy()); } /* JADX INFO: Access modifiers changed from: package-private */ public final void endOptional(boolean z) { if (z) { this.parsed.remove(r2.size() - 2); } else { this.parsed.remove(r2.size() - 1); } } private IeS currentParsed() { return this.parsed.get(r0.size() - 1); } /* JADX INFO: Access modifiers changed from: package-private */ public final Long getParsed(InterfaceC15537gtP interfaceC15537gtP) { return currentParsed().fieldValues.get(interfaceC15537gtP); } /* JADX INFO: Access modifiers changed from: package-private */ public final int setParsedField(InterfaceC15537gtP interfaceC15537gtP, long j, int i, int i2) { gtG.requireNonNull(interfaceC15537gtP, "field"); Long put = currentParsed().fieldValues.put(interfaceC15537gtP, Long.valueOf(j)); return (put == null || put.longValue() == j) ? i2 : ~i; } /* JADX INFO: Access modifiers changed from: package-private */ public final void setParsed(gsR gsr) { gtG.requireNonNull(gsr, "chrono"); IeS currentParsed = currentParsed(); currentParsed.chrono = gsr; if (currentParsed.callbacks != null) { ArrayList arrayList = new ArrayList(currentParsed.callbacks); currentParsed.callbacks.clear(); for (Object[] objArr : arrayList) { ((C15553gtn.vUG) objArr[0]).setValue(this, ((Long) objArr[1]).longValue(), ((Integer) objArr[2]).intValue(), ((Integer) objArr[3]).intValue()); } } } /* JADX INFO: Access modifiers changed from: package-private */ public final void addChronologyChangedParser(C15553gtn.vUG vug, long j, int i, int i2) { IeS currentParsed = currentParsed(); if (currentParsed.callbacks == null) { currentParsed.callbacks = new ArrayList(2); } currentParsed.callbacks.add(new Object[]{vug, Long.valueOf(j), Integer.valueOf(i), Integer.valueOf(i2)}); } /* JADX INFO: Access modifiers changed from: package-private */ public final void setParsed(AbstractC15502gsH abstractC15502gsH) { gtG.requireNonNull(abstractC15502gsH, "zone"); currentParsed().zone = abstractC15502gsH; } /* JADX INFO: Access modifiers changed from: package-private */ public final void setParsedLeapSecond() { currentParsed().leapSecond = true; } /* JADX INFO: Access modifiers changed from: package-private */ public final IeS toParsed() { return currentParsed(); } public final String toString() { return currentParsed().toString(); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.gtv$IeS */ /* loaded from: classes6.dex */ public final class IeS extends gtE { List callbacks; gsR chrono; C15500gsA excessDays; final Map fieldValues; boolean leapSecond; final C15561gtv this$0; AbstractC15502gsH zone; private IeS(C15561gtv c15561gtv) { this.this$0 = c15561gtv; this.chrono = null; this.zone = null; this.fieldValues = new HashMap(); this.excessDays = C15500gsA.ZERO; } protected final IeS copy() { IeS ieS = new IeS(this.this$0); ieS.chrono = this.chrono; ieS.zone = this.zone; ieS.fieldValues.putAll(this.fieldValues); ieS.leapSecond = this.leapSecond; return ieS; } public final String toString() { StringBuilder sb = new StringBuilder(); sb.append(this.fieldValues.toString()); sb.append(","); sb.append(this.chrono); sb.append(","); sb.append(this.zone); return sb.toString(); } @Override // o.gtK public final boolean isSupported(InterfaceC15537gtP interfaceC15537gtP) { return this.fieldValues.containsKey(interfaceC15537gtP); } @Override // o.gtE, o.gtK public final int get(InterfaceC15537gtP interfaceC15537gtP) { if (!this.fieldValues.containsKey(interfaceC15537gtP)) { throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(String.valueOf(interfaceC15537gtP))); } return gtG.safeToInt(this.fieldValues.get(interfaceC15537gtP).longValue()); } @Override // o.gtK public final long getLong(InterfaceC15537gtP interfaceC15537gtP) { if (!this.fieldValues.containsKey(interfaceC15537gtP)) { throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(String.valueOf(interfaceC15537gtP))); } return this.fieldValues.get(interfaceC15537gtP).longValue(); } @Override // o.gtE, o.gtK public final R query(gtQ gtq) { return gtq == gtM.chronology() ? (R) this.chrono : (gtq == gtM.zoneId() || gtq == gtM.zone()) ? (R) this.zone : (R) super.query(gtq); } /* JADX INFO: Access modifiers changed from: package-private */ public final C15552gtm toBuilder() { C15552gtm c15552gtm = new C15552gtm(); c15552gtm.fieldValues.putAll(this.fieldValues); c15552gtm.chrono = this.this$0.getEffectiveChronology(); AbstractC15502gsH abstractC15502gsH = this.zone; if (abstractC15502gsH == null) { c15552gtm.zone = this.this$0.overrideZone; } else { c15552gtm.zone = abstractC15502gsH; } c15552gtm.leapSecond = this.leapSecond; c15552gtm.excessDays = this.excessDays; return c15552gtm; } } final void setLocale(Locale locale) { gtG.requireNonNull(locale, "locale"); this.locale = locale; } /* JADX INFO: Access modifiers changed from: package-private */ public final void setStrict(boolean z) { this.strict = z; } /* JADX INFO: Access modifiers changed from: package-private */ public final void setCaseSensitive(boolean z) { this.caseSensitive = z; } /* JADX INFO: Access modifiers changed from: package-private */ public final boolean isStrict() { return this.strict; } /* JADX INFO: Access modifiers changed from: package-private */ public final boolean isCaseSensitive() { return this.caseSensitive; } /* JADX INFO: Access modifiers changed from: package-private */ public final C15559gtt getSymbols() { return this.symbols; } /* JADX INFO: Access modifiers changed from: package-private */ public final Locale getLocale() { return this.locale; } }