package org.joda.time.field;

import org.joda.time.DateTimeFieldType;

/* loaded from: classes5.dex */
public class h extends b {

    /* renamed from: r, reason: collision with root package name */
    final int f32047r;

    /* renamed from: s, reason: collision with root package name */
    final org.joda.time.d f32048s;

    /* renamed from: t, reason: collision with root package name */
    final org.joda.time.d f32049t;

    public h(org.joda.time.b bVar, org.joda.time.d dVar, DateTimeFieldType dateTimeFieldType, int i10) {
        super(bVar, dateTimeFieldType);
        if (i10 >= 2) {
            this.f32049t = dVar;
            this.f32048s = bVar.l();
            this.f32047r = i10;
            return;
        }
        throw new IllegalArgumentException("The divisor must be at least 2");
    }

    private int K(int i10) {
        return i10 >= 0 ? i10 / this.f32047r : ((i10 + 1) / this.f32047r) - 1;
    }

    @Override // org.joda.time.field.a, org.joda.time.b
    public long A(long j10) {
        return J().A(j10);
    }

    @Override // org.joda.time.field.a, org.joda.time.b
    public long B(long j10) {
        return J().B(j10);
    }

    @Override // org.joda.time.field.b, org.joda.time.field.a, org.joda.time.b
    public long C(long j10, int i10) {
        d.h(this, i10, 0, this.f32047r - 1);
        return J().C(j10, (K(J().c(j10)) * this.f32047r) + i10);
    }

    @Override // org.joda.time.field.b, org.joda.time.field.a, org.joda.time.b
    public int c(long j10) {
        int c10 = J().c(j10);
        if (c10 >= 0) {
            return c10 % this.f32047r;
        }
        int i10 = this.f32047r;
        return (i10 - 1) + ((c10 + 1) % i10);
    }

    @Override // org.joda.time.field.b, org.joda.time.field.a, org.joda.time.b
    public org.joda.time.d l() {
        return this.f32048s;
    }

    @Override // org.joda.time.field.b, org.joda.time.field.a, org.joda.time.b
    public int o() {
        return this.f32047r - 1;
    }

    @Override // org.joda.time.field.b, org.joda.time.b
    public int p() {
        return 0;
    }

    @Override // org.joda.time.field.b, org.joda.time.b
    public org.joda.time.d r() {
        return this.f32049t;
    }

    @Override // org.joda.time.field.a, org.joda.time.b
    public long w(long j10) {
        return J().w(j10);
    }

    @Override // org.joda.time.field.a, org.joda.time.b
    public long x(long j10) {
        return J().x(j10);
    }

    @Override // org.joda.time.field.a, org.joda.time.b
    public long y(long j10) {
        return J().y(j10);
    }

    @Override // org.joda.time.field.a, org.joda.time.b
    public long z(long j10) {
        return J().z(j10);
    }

    public h(c cVar) {
        this(cVar, cVar.s());
    }

    public h(c cVar, DateTimeFieldType dateTimeFieldType) {
        this(cVar, cVar.J().l(), dateTimeFieldType);
    }

    public h(c cVar, org.joda.time.d dVar, DateTimeFieldType dateTimeFieldType) {
        super(cVar.J(), dateTimeFieldType);
        this.f32047r = cVar.f32035r;
        this.f32048s = dVar;
        this.f32049t = cVar.f32036s;
    }
}
