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

86 lines
3.0 KiB
Java

package o;
import java.util.Collections;
import java.util.Iterator;
import java.util.NavigableMap;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArrayList;
import org.threeten.bp.zone.ZoneRulesException;
/* renamed from: o.guc, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
public abstract class AbstractC15576guc {
private static final CopyOnWriteArrayList<AbstractC15576guc> PROVIDERS = new CopyOnWriteArrayList<>();
private static final ConcurrentMap<String, AbstractC15576guc> ZONES = new ConcurrentHashMap(512, 0.75f, 2);
protected boolean provideRefresh() {
return false;
}
protected abstract AbstractC15574gua provideRules(String str, boolean z);
protected abstract NavigableMap<String, AbstractC15574gua> provideVersions(String str);
protected abstract Set<String> provideZoneIds();
static {
AbstractC15575gub.initialize();
}
public static Set<String> getAvailableZoneIds() {
return Collections.unmodifiableSet(ZONES.keySet());
}
public static AbstractC15574gua getRules(String str, boolean z) {
gtG.requireNonNull(str, "zoneId");
return getProvider(str).provideRules(str, z);
}
public static NavigableMap<String, AbstractC15574gua> getVersions(String str) {
gtG.requireNonNull(str, "zoneId");
return getProvider(str).provideVersions(str);
}
private static AbstractC15576guc getProvider(String str) {
ConcurrentMap<String, AbstractC15576guc> concurrentMap = ZONES;
AbstractC15576guc abstractC15576guc = concurrentMap.get(str);
if (abstractC15576guc != null) {
return abstractC15576guc;
}
if (concurrentMap.isEmpty()) {
throw new ZoneRulesException("No time-zone data files registered");
}
throw new ZoneRulesException("Unknown time-zone ID: ".concat(String.valueOf(str)));
}
public static void registerProvider(AbstractC15576guc abstractC15576guc) {
gtG.requireNonNull(abstractC15576guc, "provider");
registerProvider0(abstractC15576guc);
PROVIDERS.add(abstractC15576guc);
}
private static void registerProvider0(AbstractC15576guc abstractC15576guc) {
for (String str : abstractC15576guc.provideZoneIds()) {
gtG.requireNonNull(str, "zoneId");
if (ZONES.putIfAbsent(str, abstractC15576guc) != null) {
StringBuilder sb = new StringBuilder("Unable to register zone as one already registered with that ID: ");
sb.append(str);
sb.append(", currently loading from provider: ");
sb.append(abstractC15576guc);
throw new ZoneRulesException(sb.toString());
}
}
}
public static boolean refresh() {
Iterator<AbstractC15576guc> it = PROVIDERS.iterator();
boolean z = false;
while (it.hasNext()) {
z |= it.next().provideRefresh();
}
return z;
}
}