// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package org.apache.commons.lang3.time; import java.text.DateFormat; import java.text.Format; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Locale; import java.util.TimeZone; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; abstract class FormatCache { private static class MultipartKey { private int hashCode; private final Object keys[]; public boolean equals(Object obj) { return Arrays.equals(keys, ((MultipartKey)obj).keys); } public int hashCode() { if (hashCode == 0) { int j = 0; Object aobj[] = keys; int l = aobj.length; for (int i = 0; i < l;) { Object obj = aobj[i]; int k = j; if (obj != null) { k = j * 7 + obj.hashCode(); } i++; j = k; } hashCode = j; } return hashCode; } public transient MultipartKey(Object aobj[]) { keys = aobj; } } static final int NONE = -1; private static final ConcurrentMap cDateTimeInstanceCache = new ConcurrentHashMap(7); private final ConcurrentMap cInstanceCache = new ConcurrentHashMap(7); FormatCache() { } private Format getDateTimeInstance(Integer integer, Integer integer1, TimeZone timezone, Locale locale) { Locale locale1 = locale; if (locale == null) { locale1 = Locale.getDefault(); } return getInstance(getPatternForStyle(integer, integer1, locale1), timezone, locale1); } static String getPatternForStyle(Integer integer, Integer integer1, Locale locale) { String s; MultipartKey multipartkey; multipartkey = new MultipartKey(new Object[] { integer, integer1, locale }); String s1 = (String)cDateTimeInstanceCache.get(multipartkey); s = s1; if (s1 != null) { break MISSING_BLOCK_LABEL_150; } if (integer != null) goto _L2; else goto _L1 _L1: integer = DateFormat.getTimeInstance(integer1.intValue(), locale); _L3: s = ((SimpleDateFormat)integer).toPattern(); integer = (String)cDateTimeInstanceCache.putIfAbsent(multipartkey, s); if (integer != null) { return integer; } break MISSING_BLOCK_LABEL_150; _L2: label0: { if (integer1 != null) { break label0; } try { integer = DateFormat.getDateInstance(integer.intValue(), locale); } // Misplaced declaration of an exception variable catch (Integer integer) { throw new IllegalArgumentException((new StringBuilder()).append("No date time pattern for locale: ").append(locale).toString()); } } goto _L3 integer = DateFormat.getDateTimeInstance(integer.intValue(), integer1.intValue(), locale); goto _L3 return s; } protected abstract Format createInstance(String s, TimeZone timezone, Locale locale); Format getDateInstance(int i, TimeZone timezone, Locale locale) { return getDateTimeInstance(Integer.valueOf(i), ((Integer) (null)), timezone, locale); } Format getDateTimeInstance(int i, int j, TimeZone timezone, Locale locale) { return getDateTimeInstance(Integer.valueOf(i), Integer.valueOf(j), timezone, locale); } public Format getInstance() { return getDateTimeInstance(3, 3, TimeZone.getDefault(), Locale.getDefault()); } public Format getInstance(String s, TimeZone timezone, Locale locale) { if (s == null) { throw new NullPointerException("pattern must not be null"); } TimeZone timezone1 = timezone; if (timezone == null) { timezone1 = TimeZone.getDefault(); } Locale locale1 = locale; if (locale == null) { locale1 = Locale.getDefault(); } MultipartKey multipartkey = new MultipartKey(new Object[] { s, timezone1, locale1 }); locale = (Format)cInstanceCache.get(multipartkey); timezone = locale; if (locale == null) { timezone = createInstance(s, timezone1, locale1); s = (Format)cInstanceCache.putIfAbsent(multipartkey, timezone); if (s != null) { timezone = s; } } return timezone; } Format getTimeInstance(int i, TimeZone timezone, Locale locale) { return getDateTimeInstance(((Integer) (null)), Integer.valueOf(i), timezone, locale); } }