package o;

import java.text.CharacterIterator;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.qh, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C2261qh implements CharacterIterator {
    public final CharSequence l;
    public final int m;
    public int n = 0;

    public C2261qh(CharSequence charSequence, int i) {
        this.l = charSequence;
        this.m = i;
    }

    @Override // java.text.CharacterIterator
    public final Object clone() {
        try {
            return super.clone();
        } catch (CloneNotSupportedException unused) {
            throw new InternalError();
        }
    }

    @Override // java.text.CharacterIterator
    public final char current() {
        int i = this.n;
        if (i == this.m) {
            return (char) 65535;
        }
        return this.l.charAt(i);
    }

    @Override // java.text.CharacterIterator
    public final char first() {
        this.n = 0;
        return current();
    }

    @Override // java.text.CharacterIterator
    public final int getBeginIndex() {
        return 0;
    }

    @Override // java.text.CharacterIterator
    public final int getEndIndex() {
        return this.m;
    }

    @Override // java.text.CharacterIterator
    public final int getIndex() {
        return this.n;
    }

    @Override // java.text.CharacterIterator
    public final char last() {
        int i = this.m;
        if (i == 0) {
            this.n = i;
            return (char) 65535;
        }
        int i2 = i - 1;
        this.n = i2;
        return this.l.charAt(i2);
    }

    @Override // java.text.CharacterIterator
    public final char next() {
        int i = this.n + 1;
        this.n = i;
        int i2 = this.m;
        if (i < i2) {
            return this.l.charAt(i);
        }
        this.n = i2;
        return (char) 65535;
    }

    @Override // java.text.CharacterIterator
    public final char previous() {
        int i = this.n;
        if (i <= 0) {
            return (char) 65535;
        }
        int i2 = i - 1;
        this.n = i2;
        return this.l.charAt(i2);
    }

    @Override // java.text.CharacterIterator
    public final char setIndex(int i) {
        if (i > this.m || i < 0) {
            throw new IllegalArgumentException("invalid position");
        }
        this.n = i;
        return current();
    }
}
