package o;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.e90, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C1077e90 implements Iterable, InterfaceC2989yJ {
    public int m;

    /* renamed from: o, reason: collision with root package name */
    public int f504o;
    public int p;
    public boolean r;
    public int s;
    public HashMap u;
    public IQ v;
    public int[] l = new int[0];
    public Object[] n = new Object[0];
    public final Object q = new Object();
    public ArrayList t = new ArrayList();

    public final int a(G2 g2) {
        if (this.r) {
            AbstractC0373Ok.c("Use active SlotWriter to determine anchor location instead");
        }
        if (!g2.a()) {
            AbstractC1102eY.a("Anchor refers to a group that was removed");
        }
        return g2.a;
    }

    public final void b() {
        this.u = new HashMap();
    }

    public final C0982d90 c() {
        if (this.r) {
            throw new IllegalStateException("Cannot read while a writer is pending");
        }
        this.p++;
        return new C0982d90(this);
    }

    public final C1365h90 d() {
        if (this.r) {
            AbstractC0373Ok.c("Cannot start a writer when another writer is pending");
        }
        if (this.p > 0) {
            AbstractC0373Ok.c("Cannot start a writer when a reader is pending");
        }
        this.r = true;
        this.s++;
        return new C1365h90(this);
    }

    public final boolean e(G2 g2) {
        int iE;
        return g2.a() && (iE = AbstractC1269g90.e(this.t, g2.a, this.m)) >= 0 && F3.c(this.t.get(iE), g2);
    }

    public final AbstractC2414sE f(int i) {
        int i2;
        ArrayList arrayList;
        int iE;
        HashMap map = this.u;
        if (map != null) {
            if (this.r) {
                AbstractC0373Ok.c("use active SlotWriter to crate an anchor for location instead");
            }
            G2 g2 = (i < 0 || i >= (i2 = this.m) || (iE = AbstractC1269g90.e((arrayList = this.t), i, i2)) < 0) ? null : (G2) arrayList.get(iE);
            if (g2 != null) {
                return (AbstractC2414sE) map.get(g2);
            }
        }
        return null;
    }

    @Override // java.lang.Iterable
    public final Iterator iterator() {
        return new C2319rE(this, 0, this.m);
    }
}
