package R1;

import android.database.Cursor;
import java.util.Arrays;

/* JADX INFO: loaded from: classes.dex */
public final class e extends g {

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public int[] f6035t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public long[] f6036u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public double[] f6037v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public String[] f6038w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public byte[][] f6039x;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public Cursor f6040y;

    public static void j(Cursor cursor, int i) {
        if (i < 0 || i >= cursor.getColumnCount()) {
            android.support.v4.media.session.a.t(25, "column index out of range");
            throw null;
        }
    }

    @Override // X1.c
    public final void D(double d8) {
        a();
        b(2, 9);
        this.f6035t[9] = 2;
        this.f6037v[9] = d8;
    }

    @Override // X1.c
    public final boolean N(int i) {
        a();
        Cursor cursorM = m();
        j(cursorM, i);
        return cursorM.isNull(i);
    }

    @Override // X1.c
    public final String P(int i) {
        a();
        g();
        Cursor cursor = this.f6040y;
        if (cursor == null) {
            throw new IllegalStateException("Required value was null.");
        }
        j(cursor, i);
        String columnName = cursor.getColumnName(i);
        P6.g.d(columnName, "getColumnName(...)");
        return columnName;
    }

    @Override // X1.c
    public final boolean W() {
        a();
        g();
        Cursor cursor = this.f6040y;
        if (cursor != null) {
            return cursor.moveToNext();
        }
        throw new IllegalStateException("Required value was null.");
    }

    public final void b(int i, int i5) {
        int i8 = i5 + 1;
        int[] iArr = this.f6035t;
        if (iArr.length < i8) {
            int[] iArrCopyOf = Arrays.copyOf(iArr, i8);
            P6.g.d(iArrCopyOf, "copyOf(...)");
            this.f6035t = iArrCopyOf;
        }
        if (i == 1) {
            long[] jArr = this.f6036u;
            if (jArr.length < i8) {
                long[] jArrCopyOf = Arrays.copyOf(jArr, i8);
                P6.g.d(jArrCopyOf, "copyOf(...)");
                this.f6036u = jArrCopyOf;
                return;
            }
            return;
        }
        if (i == 2) {
            double[] dArr = this.f6037v;
            if (dArr.length < i8) {
                double[] dArrCopyOf = Arrays.copyOf(dArr, i8);
                P6.g.d(dArrCopyOf, "copyOf(...)");
                this.f6037v = dArrCopyOf;
                return;
            }
            return;
        }
        if (i == 3) {
            String[] strArr = this.f6038w;
            if (strArr.length < i8) {
                Object[] objArrCopyOf = Arrays.copyOf(strArr, i8);
                P6.g.d(objArrCopyOf, "copyOf(...)");
                this.f6038w = (String[]) objArrCopyOf;
                return;
            }
            return;
        }
        if (i != 4) {
            return;
        }
        byte[][] bArr = this.f6039x;
        if (bArr.length < i8) {
            Object[] objArrCopyOf2 = Arrays.copyOf(bArr, i8);
            P6.g.d(objArrCopyOf2, "copyOf(...)");
            this.f6039x = (byte[][]) objArrCopyOf2;
        }
    }

    @Override // X1.c
    public final double b0(int i) {
        a();
        Cursor cursorM = m();
        j(cursorM, i);
        return cursorM.getDouble(i);
    }

    @Override // X1.c
    public final void c(int i) {
        a();
        b(5, i);
        this.f6035t[i] = 5;
    }

    @Override // java.lang.AutoCloseable
    public final void close() {
        if (!this.f6044s) {
            a();
            this.f6035t = new int[0];
            this.f6036u = new long[0];
            this.f6037v = new double[0];
            this.f6038w = new String[0];
            this.f6039x = new byte[0][];
            reset();
        }
        this.f6044s = true;
    }

    @Override // X1.c
    public final void e(long j8, int i) {
        a();
        b(1, i);
        this.f6035t[i] = 1;
        this.f6036u[i] = j8;
    }

    public final void g() {
        if (this.f6040y == null) {
            this.f6040y = this.f6042q.E(new P.g(6, this));
        }
    }

    public final Cursor m() {
        Cursor cursor = this.f6040y;
        if (cursor != null) {
            return cursor;
        }
        android.support.v4.media.session.a.t(21, "no row");
        throw null;
    }

    @Override // X1.c
    public final String o(int i) {
        a();
        Cursor cursorM = m();
        j(cursorM, i);
        String string = cursorM.getString(i);
        P6.g.d(string, "getString(...)");
        return string;
    }

    @Override // X1.c
    public final int p() {
        a();
        g();
        Cursor cursor = this.f6040y;
        if (cursor != null) {
            return cursor.getColumnCount();
        }
        return 0;
    }

    @Override // X1.c
    public final long q(int i) {
        a();
        Cursor cursorM = m();
        j(cursorM, i);
        return cursorM.getLong(i);
    }

    @Override // X1.c
    public final void reset() {
        a();
        Cursor cursor = this.f6040y;
        if (cursor != null) {
            cursor.close();
        }
        this.f6040y = null;
    }

    @Override // X1.c
    public final void s(int i, String str) {
        P6.g.e(str, "value");
        a();
        b(3, i);
        this.f6035t[i] = 3;
        this.f6038w[i] = str;
    }
}
