package o;

import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.i30, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C1449i30 implements Jb0, Ib0 {
    public static final TreeMap t = new TreeMap();
    public final int l;
    public volatile String m;
    public final long[] n;

    /* renamed from: o, reason: collision with root package name */
    public final double[] f575o;
    public final String[] p;
    public final byte[][] q;
    public final int[] r;
    public int s;

    public C1449i30(int i) {
        this.l = i;
        int i2 = i + 1;
        this.r = new int[i2];
        this.n = new long[i2];
        this.f575o = new double[i2];
        this.p = new String[i2];
        this.q = new byte[i2][];
    }

    public static final C1449i30 d(int i, String str) {
        TreeMap treeMap = t;
        synchronized (treeMap) {
            Map.Entry entryCeilingEntry = treeMap.ceilingEntry(Integer.valueOf(i));
            if (entryCeilingEntry == null) {
                C1449i30 c1449i30 = new C1449i30(i);
                c1449i30.m = str;
                c1449i30.s = i;
                return c1449i30;
            }
            treeMap.remove(entryCeilingEntry.getKey());
            C1449i30 c1449i302 = (C1449i30) entryCeilingEntry.getValue();
            c1449i302.m = str;
            c1449i302.s = i;
            return c1449i302;
        }
    }

    @Override // o.Ib0
    public final void B(int i, long j) {
        this.r[i] = 2;
        this.n[i] = j;
    }

    @Override // o.Ib0
    public final void E(int i, byte[] bArr) {
        this.r[i] = 5;
        this.q[i] = bArr;
    }

    @Override // o.Jb0
    public final String b() {
        String str = this.m;
        if (str != null) {
            return str;
        }
        throw new IllegalStateException("Required value was null.");
    }

    @Override // o.Jb0
    public final void c(Ib0 ib0) {
        int i = this.s;
        if (1 > i) {
            return;
        }
        int i2 = 1;
        while (true) {
            int i3 = this.r[i2];
            if (i3 == 1) {
                ib0.r(i2);
            } else if (i3 == 2) {
                ib0.B(i2, this.n[i2]);
            } else if (i3 == 3) {
                ib0.p(this.f575o[i2], i2);
            } else if (i3 == 4) {
                String str = this.p[i2];
                if (str == null) {
                    throw new IllegalArgumentException("Required value was null.");
                }
                ib0.k(i2, str);
            } else if (i3 == 5) {
                byte[] bArr = this.q[i2];
                if (bArr == null) {
                    throw new IllegalArgumentException("Required value was null.");
                }
                ib0.E(i2, bArr);
            }
            if (i2 == i) {
                return;
            } else {
                i2++;
            }
        }
    }

    @Override // o.Ib0
    public final void k(int i, String str) {
        this.r[i] = 4;
        this.p[i] = str;
    }

    @Override // o.Ib0
    public final void p(double d, int i) {
        this.r[i] = 3;
        this.f575o[i] = d;
    }

    @Override // o.Ib0
    public final void r(int i) {
        this.r[i] = 1;
    }

    public final void release() {
        TreeMap treeMap = t;
        synchronized (treeMap) {
            treeMap.put(Integer.valueOf(this.l), this);
            if (treeMap.size() > 15) {
                int size = treeMap.size() - 10;
                Iterator it = treeMap.descendingKeySet().iterator();
                while (true) {
                    int i = size - 1;
                    if (size <= 0) {
                        break;
                    }
                    it.next();
                    it.remove();
                    size = i;
                }
            }
        }
    }

    @Override // java.io.Closeable, java.lang.AutoCloseable
    public final void close() {
    }
}
