package org.joda.time.tz;

import org.joda.time.DateTimeZone;

/* loaded from: classes5.dex */
public class CachedDateTimeZone extends DateTimeZone {
    private static final long serialVersionUID = 5472298452022250685L;

    /* renamed from: u, reason: collision with root package name */
    private static final int f32189u;
    private final DateTimeZone iZone;

    /* renamed from: t, reason: collision with root package name */
    private final transient a[] f32190t;

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes5.dex */
    public static final class a {

        /* renamed from: a, reason: collision with root package name */
        public final long f32191a;

        /* renamed from: b, reason: collision with root package name */
        public final DateTimeZone f32192b;

        /* renamed from: c, reason: collision with root package name */
        a f32193c;

        /* renamed from: d, reason: collision with root package name */
        private String f32194d;

        /* renamed from: e, reason: collision with root package name */
        private int f32195e = Integer.MIN_VALUE;

        /* renamed from: f, reason: collision with root package name */
        private int f32196f = Integer.MIN_VALUE;

        a(DateTimeZone dateTimeZone, long j10) {
            this.f32191a = j10;
            this.f32192b = dateTimeZone;
        }

        public String a(long j10) {
            a aVar = this.f32193c;
            if (aVar != null && j10 >= aVar.f32191a) {
                return aVar.a(j10);
            }
            if (this.f32194d == null) {
                this.f32194d = this.f32192b.q(this.f32191a);
            }
            return this.f32194d;
        }

        public int b(long j10) {
            a aVar = this.f32193c;
            if (aVar != null && j10 >= aVar.f32191a) {
                return aVar.b(j10);
            }
            if (this.f32195e == Integer.MIN_VALUE) {
                this.f32195e = this.f32192b.s(this.f32191a);
            }
            return this.f32195e;
        }

        public int c(long j10) {
            a aVar = this.f32193c;
            if (aVar != null && j10 >= aVar.f32191a) {
                return aVar.c(j10);
            }
            if (this.f32196f == Integer.MIN_VALUE) {
                this.f32196f = this.f32192b.w(this.f32191a);
            }
            return this.f32196f;
        }
    }

    static {
        Integer num;
        int i10;
        try {
            num = Integer.getInteger("org.joda.time.tz.CachedDateTimeZone.size");
        } catch (SecurityException unused) {
            num = null;
        }
        if (num == null) {
            i10 = 512;
        } else {
            int i11 = 0;
            for (int intValue = num.intValue() - 1; intValue > 0; intValue >>= 1) {
                i11++;
            }
            i10 = 1 << i11;
        }
        f32189u = i10 - 1;
    }

    private CachedDateTimeZone(DateTimeZone dateTimeZone) {
        super(dateTimeZone.n());
        this.f32190t = new a[f32189u + 1];
        this.iZone = dateTimeZone;
    }

    private a G(long j10) {
        long j11 = j10 & (-4294967296L);
        a aVar = new a(this.iZone, j11);
        long j12 = 4294967295L | j11;
        a aVar2 = aVar;
        while (true) {
            long z10 = this.iZone.z(j11);
            if (z10 == j11 || z10 > j12) {
                break;
            }
            a aVar3 = new a(this.iZone, z10);
            aVar2.f32193c = aVar3;
            aVar2 = aVar3;
            j11 = z10;
        }
        return aVar;
    }

    public static CachedDateTimeZone H(DateTimeZone dateTimeZone) {
        return dateTimeZone instanceof CachedDateTimeZone ? (CachedDateTimeZone) dateTimeZone : new CachedDateTimeZone(dateTimeZone);
    }

    private a I(long j10) {
        int i10 = (int) (j10 >> 32);
        a[] aVarArr = this.f32190t;
        int i11 = f32189u & i10;
        a aVar = aVarArr[i11];
        if (aVar != null && ((int) (aVar.f32191a >> 32)) == i10) {
            return aVar;
        }
        a G = G(j10);
        aVarArr[i11] = G;
        return G;
    }

    @Override // org.joda.time.DateTimeZone
    public long B(long j10) {
        return this.iZone.B(j10);
    }

    @Override // org.joda.time.DateTimeZone
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj instanceof CachedDateTimeZone) {
            return this.iZone.equals(((CachedDateTimeZone) obj).iZone);
        }
        return false;
    }

    @Override // org.joda.time.DateTimeZone
    public int hashCode() {
        return this.iZone.hashCode();
    }

    @Override // org.joda.time.DateTimeZone
    public String q(long j10) {
        return I(j10).a(j10);
    }

    @Override // org.joda.time.DateTimeZone
    public int s(long j10) {
        return I(j10).b(j10);
    }

    @Override // org.joda.time.DateTimeZone
    public int w(long j10) {
        return I(j10).c(j10);
    }

    @Override // org.joda.time.DateTimeZone
    public boolean x() {
        return this.iZone.x();
    }

    @Override // org.joda.time.DateTimeZone
    public long z(long j10) {
        return this.iZone.z(j10);
    }
}
