what-the-bank/sources/o/gtO.java

155 lines
5.4 KiB
Java

package o;
/* loaded from: classes6.dex */
public final class gtO {
private gtO() {
}
public static gtJ firstDayOfMonth() {
return Sts.FIRST_DAY_OF_MONTH;
}
public static gtJ lastDayOfMonth() {
return Sts.LAST_DAY_OF_MONTH;
}
public static gtJ firstDayOfNextMonth() {
return Sts.FIRST_DAY_OF_NEXT_MONTH;
}
public static gtJ firstDayOfYear() {
return Sts.FIRST_DAY_OF_YEAR;
}
public static gtJ lastDayOfYear() {
return Sts.LAST_DAY_OF_YEAR;
}
public static gtJ firstDayOfNextYear() {
return Sts.FIRST_DAY_OF_NEXT_YEAR;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes6.dex */
public static class Sts implements gtJ {
private final int ordinal;
private static final Sts FIRST_DAY_OF_MONTH = new Sts(0);
private static final Sts LAST_DAY_OF_MONTH = new Sts(1);
private static final Sts FIRST_DAY_OF_NEXT_MONTH = new Sts(2);
private static final Sts FIRST_DAY_OF_YEAR = new Sts(3);
private static final Sts LAST_DAY_OF_YEAR = new Sts(4);
private static final Sts FIRST_DAY_OF_NEXT_YEAR = new Sts(5);
private Sts(int i) {
this.ordinal = i;
}
@Override // o.gtJ
public InterfaceC15536gtL adjustInto(InterfaceC15536gtL interfaceC15536gtL) {
int i = this.ordinal;
if (i == 0) {
return interfaceC15536gtL.with(EnumC15534gtD.DAY_OF_MONTH, 1L);
}
if (i == 1) {
return interfaceC15536gtL.with(EnumC15534gtD.DAY_OF_MONTH, interfaceC15536gtL.range(EnumC15534gtD.DAY_OF_MONTH).getMaximum());
}
if (i == 2) {
return interfaceC15536gtL.with(EnumC15534gtD.DAY_OF_MONTH, 1L).plus(1L, gtH.MONTHS);
}
if (i == 3) {
return interfaceC15536gtL.with(EnumC15534gtD.DAY_OF_YEAR, 1L);
}
if (i == 4) {
return interfaceC15536gtL.with(EnumC15534gtD.DAY_OF_YEAR, interfaceC15536gtL.range(EnumC15534gtD.DAY_OF_YEAR).getMaximum());
}
if (i == 5) {
return interfaceC15536gtL.with(EnumC15534gtD.DAY_OF_YEAR, 1L).plus(1L, gtH.YEARS);
}
throw new IllegalStateException("Unreachable");
}
}
public static gtJ firstInMonth(EnumC15515gsk enumC15515gsk) {
gtG.requireNonNull(enumC15515gsk, "dayOfWeek");
return new HBt(1, enumC15515gsk);
}
public static gtJ lastInMonth(EnumC15515gsk enumC15515gsk) {
gtG.requireNonNull(enumC15515gsk, "dayOfWeek");
return new HBt(-1, enumC15515gsk);
}
public static gtJ dayOfWeekInMonth(int i, EnumC15515gsk enumC15515gsk) {
gtG.requireNonNull(enumC15515gsk, "dayOfWeek");
return new HBt(i, enumC15515gsk);
}
/* loaded from: classes6.dex */
static final class HBt implements gtJ {
private final int dowValue;
private final int ordinal;
private HBt(int i, EnumC15515gsk enumC15515gsk) {
this.ordinal = i;
this.dowValue = enumC15515gsk.getValue();
}
@Override // o.gtJ
public final InterfaceC15536gtL adjustInto(InterfaceC15536gtL interfaceC15536gtL) {
if (this.ordinal >= 0) {
return interfaceC15536gtL.with(EnumC15534gtD.DAY_OF_MONTH, 1L).plus((((this.dowValue - r10.get(EnumC15534gtD.DAY_OF_WEEK)) + 7) % 7) + ((this.ordinal - 1) * 7), gtH.DAYS);
}
InterfaceC15536gtL with = interfaceC15536gtL.with(EnumC15534gtD.DAY_OF_MONTH, interfaceC15536gtL.range(EnumC15534gtD.DAY_OF_MONTH).getMaximum());
long j = this.dowValue - with.get(EnumC15534gtD.DAY_OF_WEEK);
if (j == 0) {
j = 0;
} else if (j > 0) {
j -= 7;
}
return with.plus(j - (((-this.ordinal) - 1) * 7), gtH.DAYS);
}
}
public static gtJ next(EnumC15515gsk enumC15515gsk) {
return new RVV(2, enumC15515gsk);
}
public static gtJ nextOrSame(EnumC15515gsk enumC15515gsk) {
return new RVV(0, enumC15515gsk);
}
public static gtJ previous(EnumC15515gsk enumC15515gsk) {
return new RVV(3, enumC15515gsk);
}
public static gtJ previousOrSame(EnumC15515gsk enumC15515gsk) {
return new RVV(1, enumC15515gsk);
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes6.dex */
public static final class RVV implements gtJ {
private final int dowValue;
private final int relative;
private RVV(int i, EnumC15515gsk enumC15515gsk) {
gtG.requireNonNull(enumC15515gsk, "dayOfWeek");
this.relative = i;
this.dowValue = enumC15515gsk.getValue();
}
@Override // o.gtJ
public final InterfaceC15536gtL adjustInto(InterfaceC15536gtL interfaceC15536gtL) {
int i = interfaceC15536gtL.get(EnumC15534gtD.DAY_OF_WEEK);
int i2 = this.relative;
if (i2 < 2 && i == this.dowValue) {
return interfaceC15536gtL;
}
if ((i2 & 1) == 0) {
return interfaceC15536gtL.plus(i - this.dowValue >= 0 ? 7 - r0 : -r0, gtH.DAYS);
}
return interfaceC15536gtL.minus(this.dowValue - i >= 0 ? 7 - r1 : -r1, gtH.DAYS);
}
}
}