package o;

import java.util.AbstractList;
import java.util.ConcurrentModificationException;
import java.util.ListIterator;
import java.util.NoSuchElementException;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.eF, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C1083eF implements ListIterator, InterfaceC2989yJ {
    public final /* synthetic */ int l;
    public int m;
    public int n;

    /* renamed from: o, reason: collision with root package name */
    public int f507o;
    public final Object p;

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    public C1083eF(C1275gF c1275gF, int i, int i2) {
        this(c1275gF, (i2 & 1) != 0 ? 0 : i, 0, c1275gF.l.b);
        this.l = 0;
    }

    public void a() {
        if (((AbstractList) ((GL) this.p).p).modCount != this.f507o) {
            throw new ConcurrentModificationException();
        }
    }

    @Override // java.util.ListIterator
    public final void add(Object obj) {
        switch (this.l) {
            case 0:
                throw new UnsupportedOperationException("Operation is not supported for read-only collection");
            case 1:
                a();
                GL gl = (GL) this.p;
                int i = this.m;
                this.m = i + 1;
                gl.add(i, obj);
                this.n = -1;
                this.f507o = ((AbstractList) gl).modCount;
                return;
            case 2:
                b();
                HL hl = (HL) this.p;
                int i2 = this.m;
                this.m = i2 + 1;
                hl.add(i2, obj);
                this.n = -1;
                this.f507o = ((AbstractList) hl).modCount;
                return;
            default:
                c();
                H90 h90 = (H90) this.p;
                h90.add(this.m + 1, obj);
                this.n = -1;
                this.m++;
                this.f507o = F3.B(h90);
                return;
        }
    }

    public void b() {
        if (((AbstractList) ((HL) this.p)).modCount != this.f507o) {
            throw new ConcurrentModificationException();
        }
    }

    public void c() {
        if (F3.B((H90) this.p) != this.f507o) {
            throw new ConcurrentModificationException();
        }
    }

    @Override // java.util.ListIterator, java.util.Iterator
    public final boolean hasNext() {
        switch (this.l) {
            case 0:
                return this.m < this.f507o;
            case 1:
                return this.m < ((GL) this.p).n;
            case 2:
                return this.m < ((HL) this.p).m;
            default:
                return this.m < ((H90) this.p).size() - 1;
        }
    }

    @Override // java.util.ListIterator
    public final boolean hasPrevious() {
        switch (this.l) {
            case 0:
                if (this.m > this.n) {
                }
                break;
            case 1:
                if (this.m > 0) {
                }
                break;
            case 2:
                if (this.m > 0) {
                }
                break;
            default:
                if (this.m >= 0) {
                }
                break;
        }
        return false;
    }

    @Override // java.util.ListIterator, java.util.Iterator
    public final Object next() {
        switch (this.l) {
            case 0:
                UQ uq = ((C1275gF) this.p).l;
                int i = this.m;
                this.m = i + 1;
                return (LP) uq.e(i);
            case 1:
                a();
                int i2 = this.m;
                GL gl = (GL) this.p;
                if (i2 >= gl.n) {
                    throw new NoSuchElementException();
                }
                this.m = i2 + 1;
                this.n = i2;
                return gl.l[gl.m + i2];
            case 2:
                b();
                int i3 = this.m;
                HL hl = (HL) this.p;
                if (i3 >= hl.m) {
                    throw new NoSuchElementException();
                }
                this.m = i3 + 1;
                this.n = i3;
                return hl.l[i3];
            default:
                c();
                int i4 = this.m + 1;
                this.n = i4;
                H90 h90 = (H90) this.p;
                F3.b(i4, h90.size());
                Object obj = h90.get(i4);
                this.m = i4;
                return obj;
        }
    }

    @Override // java.util.ListIterator
    public final int nextIndex() {
        switch (this.l) {
            case 0:
                return this.m - this.n;
            case 1:
                return this.m;
            case 2:
                return this.m;
            default:
                return this.m + 1;
        }
    }

    @Override // java.util.ListIterator
    public final Object previous() {
        switch (this.l) {
            case 0:
                UQ uq = ((C1275gF) this.p).l;
                int i = this.m - 1;
                this.m = i;
                return (LP) uq.e(i);
            case 1:
                a();
                int i2 = this.m;
                if (i2 <= 0) {
                    throw new NoSuchElementException();
                }
                int i3 = i2 - 1;
                this.m = i3;
                this.n = i3;
                GL gl = (GL) this.p;
                return gl.l[gl.m + i3];
            case 2:
                b();
                int i4 = this.m;
                if (i4 <= 0) {
                    throw new NoSuchElementException();
                }
                int i5 = i4 - 1;
                this.m = i5;
                this.n = i5;
                return ((HL) this.p).l[i5];
            default:
                c();
                int i6 = this.m;
                H90 h90 = (H90) this.p;
                F3.b(i6, h90.size());
                int i7 = this.m;
                this.n = i7;
                this.m--;
                return h90.get(i7);
        }
    }

    @Override // java.util.ListIterator
    public final int previousIndex() {
        int i;
        switch (this.l) {
            case 0:
                i = this.m - this.n;
                break;
            case 1:
                i = this.m;
                break;
            case 2:
                i = this.m;
                break;
            default:
                return this.m;
        }
        return i - 1;
    }

    @Override // java.util.ListIterator, java.util.Iterator
    public final void remove() {
        switch (this.l) {
            case 0:
                throw new UnsupportedOperationException("Operation is not supported for read-only collection");
            case 1:
                GL gl = (GL) this.p;
                a();
                int i = this.n;
                if (i == -1) {
                    throw new IllegalStateException("Call next() or previous() before removing element from the iterator.");
                }
                gl.b(i);
                this.m = this.n;
                this.n = -1;
                this.f507o = ((AbstractList) gl).modCount;
                return;
            case 2:
                HL hl = (HL) this.p;
                b();
                int i2 = this.n;
                if (i2 == -1) {
                    throw new IllegalStateException("Call next() or previous() before removing element from the iterator.");
                }
                hl.b(i2);
                this.m = this.n;
                this.n = -1;
                this.f507o = ((AbstractList) hl).modCount;
                return;
            default:
                c();
                H90 h90 = (H90) this.p;
                h90.remove(this.n);
                this.m--;
                this.n = -1;
                this.f507o = F3.B(h90);
                return;
        }
    }

    @Override // java.util.ListIterator
    public final void set(Object obj) {
        switch (this.l) {
            case 0:
                throw new UnsupportedOperationException("Operation is not supported for read-only collection");
            case 1:
                a();
                int i = this.n;
                if (i == -1) {
                    throw new IllegalStateException("Call next() or previous() before replacing element from the iterator.");
                }
                ((GL) this.p).set(i, obj);
                return;
            case 2:
                b();
                int i2 = this.n;
                if (i2 == -1) {
                    throw new IllegalStateException("Call next() or previous() before replacing element from the iterator.");
                }
                ((HL) this.p).set(i2, obj);
                return;
            default:
                H90 h90 = (H90) this.p;
                c();
                int i3 = this.n;
                if (i3 < 0) {
                    throw new IllegalStateException("Cannot call set before the first call to next() or previous() or immediately after a call to add() or remove()");
                }
                h90.set(i3, obj);
                this.f507o = F3.B(h90);
                return;
        }
    }

    public C1083eF(HL hl, int i) {
        this.l = 2;
        this.p = hl;
        this.m = i;
        this.n = -1;
        this.f507o = ((AbstractList) hl).modCount;
    }

    public C1083eF(H90 h90, int i) {
        this.l = 3;
        this.p = h90;
        this.m = i - 1;
        this.n = -1;
        this.f507o = ((Ea0) AbstractC2884x90.i(h90.l)).e;
    }

    public C1083eF(C1275gF c1275gF, int i, int i2, int i3) {
        this.l = 0;
        this.p = c1275gF;
        this.m = i;
        this.n = i2;
        this.f507o = i3;
    }

    public C1083eF(GL gl, int i) {
        this.l = 1;
        this.p = gl;
        this.m = i;
        this.n = -1;
        this.f507o = ((AbstractList) gl).modCount;
    }
}
