package U6;

import java.util.Iterator;
import n4.u0;

/* JADX INFO: loaded from: classes.dex */
public class a implements Iterable, Q6.a {

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

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

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

    public a(int i, int i5, int i8) {
        if (i8 == 0) {
            throw new IllegalArgumentException("Step must be non-zero.");
        }
        if (i8 == Integer.MIN_VALUE) {
            throw new IllegalArgumentException("Step must be greater than Int.MIN_VALUE to avoid overflow on negation.");
        }
        this.f6797q = i;
        this.f6798r = u0.t(i, i5, i8);
        this.f6799s = i8;
    }

    public boolean equals(Object obj) {
        if (!(obj instanceof a)) {
            return false;
        }
        if (isEmpty() && ((a) obj).isEmpty()) {
            return true;
        }
        a aVar = (a) obj;
        return this.f6797q == aVar.f6797q && this.f6798r == aVar.f6798r && this.f6799s == aVar.f6799s;
    }

    public int hashCode() {
        if (isEmpty()) {
            return -1;
        }
        return (((this.f6797q * 31) + this.f6798r) * 31) + this.f6799s;
    }

    public boolean isEmpty() {
        int i = this.f6799s;
        int i5 = this.f6798r;
        int i8 = this.f6797q;
        return i > 0 ? i8 > i5 : i8 < i5;
    }

    @Override // java.lang.Iterable
    public final Iterator iterator() {
        return new b(this.f6797q, this.f6798r, this.f6799s);
    }

    public String toString() {
        StringBuilder sb;
        int i = this.f6798r;
        int i5 = this.f6797q;
        int i8 = this.f6799s;
        if (i8 > 0) {
            sb = new StringBuilder();
            sb.append(i5);
            sb.append("..");
            sb.append(i);
            sb.append(" step ");
            sb.append(i8);
        } else {
            sb = new StringBuilder();
            sb.append(i5);
            sb.append(" downTo ");
            sb.append(i);
            sb.append(" step ");
            sb.append(-i8);
        }
        return sb.toString();
    }
}
