package o; import java.text.FieldPosition; import java.text.Format; import java.text.ParsePosition; import java.util.Calendar; import java.util.Date; import java.util.Locale; import java.util.TimeZone; /* loaded from: classes6.dex */ public class gjT extends Format { private static final AbstractC15179gjV a = new AbstractC15179gjV() { // from class: o.gjT.2 @Override // o.AbstractC15179gjV protected final /* synthetic */ gjT a(String str, TimeZone timeZone, Locale locale) { return new gjT(str, timeZone, locale); } }; public final gjW b; public final gjU c; public static gjT b(String str) { return a.c(str, null); } public static gjT a(String str, Locale locale) { return a.c(str, locale); } protected gjT(String str, TimeZone timeZone, Locale locale) { this(str, timeZone, locale, (byte) 0); } private gjT(String str, TimeZone timeZone, Locale locale, byte b) { this.c = new gjU(str, timeZone, locale); this.b = new gjW(str, timeZone, locale); } public boolean equals(Object obj) { if (obj instanceof gjT) { return this.c.equals(((gjT) obj).c); } return false; } public int hashCode() { return this.c.hashCode(); } public String toString() { StringBuilder sb = new StringBuilder("FastDateFormat["); sb.append(this.c.b); sb.append(","); sb.append(this.c.a); sb.append(","); sb.append(this.c.d.getID()); sb.append("]"); return sb.toString(); } @Override // java.text.Format public StringBuffer format(Object obj, StringBuffer stringBuffer, FieldPosition fieldPosition) { String obj2; gjU gju = this.c; if (!(obj instanceof Date)) { if (obj instanceof Calendar) { Calendar calendar = (Calendar) obj; StringBuilder sb = new StringBuilder(gju.c); if (!calendar.getTimeZone().equals(gju.d)) { calendar = (Calendar) calendar.clone(); calendar.setTimeZone(gju.d); } obj2 = ((StringBuilder) gju.d(calendar, (Calendar) sb)).toString(); } else if (obj instanceof Long) { long longValue = ((Long) obj).longValue(); Calendar calendar2 = Calendar.getInstance(gju.d, gju.a); calendar2.setTimeInMillis(longValue); obj2 = ((StringBuilder) gju.d(calendar2, (Calendar) new StringBuilder(gju.c))).toString(); } else { StringBuilder sb2 = new StringBuilder("Unknown class: "); sb2.append(obj == null ? "" : obj.getClass().getName()); throw new IllegalArgumentException(sb2.toString()); } } else { Calendar calendar3 = Calendar.getInstance(gju.d, gju.a); calendar3.setTime((Date) obj); obj2 = ((StringBuilder) gju.d(calendar3, (Calendar) new StringBuilder(gju.c))).toString(); } return stringBuffer.append(obj2); } @Override // java.text.Format public Object parseObject(String str, ParsePosition parsePosition) { return this.b.a(str, parsePosition); } }