package androidx.leanback.widget;

import androidx.leanback.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import defpackage.g01;

/* JADX INFO: loaded from: classes.dex */
abstract class am {
    public GridLayoutManager.b b;
    public boolean c;
    public int d;
    public int e;
    public g01[] h;
    public final Object[] a = new Object[1];
    public int f = -1;
    public int g = -1;
    public int i = -1;

    public static class a {
        public final int a;

        public a(int i) {
            this.a = i;
        }
    }

    public interface b {
    }

    public final boolean a() {
        return b(this.c ? Integer.MAX_VALUE : Integer.MIN_VALUE, true);
    }

    public abstract boolean b(int i, boolean z);

    public final boolean c(int i) {
        return this.g >= 0 && (!this.c ? g(null, false) < i - this.d : i(null, true) > i + this.d);
    }

    public final boolean d(int i) {
        return this.g >= 0 && (!this.c ? i(null, true) > i + this.d : g(null, false) < i - this.d);
    }

    public void e(int i, int i2, RecyclerView.o.c cVar) {
    }

    public abstract int f(int[] iArr, int i, boolean z);

    public final int g(int[] iArr, boolean z) {
        return f(iArr, this.c ? this.f : this.g, z);
    }

    public abstract int h(int[] iArr, int i, boolean z);

    public final int i(int[] iArr, boolean z) {
        return h(iArr, this.c ? this.g : this.f, z);
    }

    public abstract g01[] j(int i, int i2);

    public abstract a k(int i);

    public void l(int i) {
        int i2;
        if (i >= 0 && (i2 = this.g) >= 0) {
            if (i2 >= i) {
                this.g = i - 1;
            }
            if (this.g < this.f) {
                this.g = -1;
                this.f = -1;
            }
            if (this.f < 0) {
                this.i = i;
            }
        }
    }

    public abstract boolean m(int i, boolean z);

    public final void n(int i) {
        if (i <= 0) {
            throw new IllegalArgumentException();
        }
        if (this.e == i) {
            return;
        }
        this.e = i;
        this.h = new g01[i];
        for (int i2 = 0; i2 < this.e; i2++) {
            this.h[i2] = new g01();
        }
    }
}
