package C6;

import M.C0171a;
import M.C0172b;
import M.J;
import android.os.Build;
import android.view.View;
import java.nio.ByteBuffer;
import java.util.ConcurrentModificationException;

/* JADX INFO: loaded from: classes.dex */
public abstract class f {

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public int f1390q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public int f1391r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public int f1392s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public Object f1393t;

    public f() {
        if (C4.f.f1334r == null) {
            C4.f.f1334r = new C4.f(24);
        }
    }

    public int a(int i) {
        if (i < this.f1392s) {
            return ((ByteBuffer) this.f1393t).getShort(this.f1391r + i);
        }
        return 0;
    }

    public void b() {
        if (((g) this.f1393t).f1404x != this.f1392s) {
            throw new ConcurrentModificationException();
        }
    }

    public abstract Object c(View view);

    public abstract void d(View view, Object obj);

    public void e() {
        while (true) {
            int i = this.f1390q;
            g gVar = (g) this.f1393t;
            if (i >= gVar.f1402v || gVar.f1399s[i] >= 0) {
                return;
            } else {
                this.f1390q = i + 1;
            }
        }
    }

    public void f(View view, Object obj) {
        Object tag;
        if (Build.VERSION.SDK_INT >= this.f1391r) {
            d(view, obj);
            return;
        }
        if (Build.VERSION.SDK_INT >= this.f1391r) {
            tag = c(view);
        } else {
            tag = view.getTag(this.f1390q);
            if (!((Class) this.f1393t).isInstance(tag)) {
                tag = null;
            }
        }
        if (g(tag, obj)) {
            View.AccessibilityDelegate accessibilityDelegateB = J.b(view);
            C0172b c0172b = accessibilityDelegateB == null ? null : accessibilityDelegateB instanceof C0171a ? ((C0171a) accessibilityDelegateB).f4095a : new C0172b(accessibilityDelegateB);
            if (c0172b == null) {
                c0172b = new C0172b();
            }
            J.j(view, c0172b);
            view.setTag(this.f1390q, obj);
            J.e(view, this.f1392s);
        }
    }

    public abstract boolean g(Object obj, Object obj2);

    public boolean hasNext() {
        return this.f1390q < ((g) this.f1393t).f1402v;
    }

    public void remove() {
        b();
        if (this.f1391r == -1) {
            throw new IllegalStateException("Call next() before removing element from the iterator.");
        }
        g gVar = (g) this.f1393t;
        gVar.c();
        gVar.l(this.f1391r);
        this.f1391r = -1;
        this.f1392s = gVar.f1404x;
    }
}
