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

148 lines
4.8 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/* loaded from: classes6.dex */
public final class gtW implements Comparable<gtW>, Serializable {
private static final long serialVersionUID = -6946044323557704546L;
private final gsI offsetAfter;
private final gsI offsetBefore;
private final C15522gsr transition;
public static gtW of(C15522gsr c15522gsr, gsI gsi, gsI gsi2) {
gtG.requireNonNull(c15522gsr, "transition");
gtG.requireNonNull(gsi, "offsetBefore");
gtG.requireNonNull(gsi2, "offsetAfter");
if (gsi.equals(gsi2)) {
throw new IllegalArgumentException("Offsets must not be equal");
}
if (c15522gsr.getNano() != 0) {
throw new IllegalArgumentException("Nano-of-second must be zero");
}
return new gtW(c15522gsr, gsi, gsi2);
}
/* JADX INFO: Access modifiers changed from: package-private */
public gtW(C15522gsr c15522gsr, gsI gsi, gsI gsi2) {
this.transition = c15522gsr;
this.offsetBefore = gsi;
this.offsetAfter = gsi2;
}
/* JADX INFO: Access modifiers changed from: package-private */
public gtW(long j, gsI gsi, gsI gsi2) {
this.transition = C15522gsr.ofEpochSecond(j, 0, gsi);
this.offsetBefore = gsi;
this.offsetAfter = gsi2;
}
private Object writeReplace() {
return new gtU((byte) 2, this);
}
/* JADX INFO: Access modifiers changed from: package-private */
public final void writeExternal(DataOutput dataOutput) throws IOException {
gtU.writeEpochSec(toEpochSecond(), dataOutput);
gtU.writeOffset(this.offsetBefore, dataOutput);
gtU.writeOffset(this.offsetAfter, dataOutput);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static gtW readExternal(DataInput dataInput) throws IOException {
long readEpochSec = gtU.readEpochSec(dataInput);
gsI readOffset = gtU.readOffset(dataInput);
gsI readOffset2 = gtU.readOffset(dataInput);
if (readOffset.equals(readOffset2)) {
throw new IllegalArgumentException("Offsets must not be equal");
}
return new gtW(readEpochSec, readOffset, readOffset2);
}
public final C15523gss getInstant() {
return this.transition.toInstant(this.offsetBefore);
}
public final long toEpochSecond() {
return this.transition.toEpochSecond(this.offsetBefore);
}
public final C15522gsr getDateTimeAfter() {
return this.transition.plusSeconds(getDurationSeconds());
}
public final C15519gso getDuration() {
return C15519gso.ofSeconds(getDurationSeconds());
}
private int getDurationSeconds() {
return getOffsetAfter().getTotalSeconds() - getOffsetBefore().getTotalSeconds();
}
public final boolean isGap() {
return getOffsetAfter().getTotalSeconds() > getOffsetBefore().getTotalSeconds();
}
public final boolean isOverlap() {
return getOffsetAfter().getTotalSeconds() < getOffsetBefore().getTotalSeconds();
}
public final boolean isValidOffset(gsI gsi) {
return !isGap() && (getOffsetBefore().equals(gsi) || getOffsetAfter().equals(gsi));
}
/* JADX INFO: Access modifiers changed from: package-private */
public final List<gsI> getValidOffsets() {
return isGap() ? Collections.emptyList() : Arrays.asList(getOffsetBefore(), getOffsetAfter());
}
@Override // java.lang.Comparable
public final int compareTo(gtW gtw) {
return getInstant().compareTo(gtw.getInstant());
}
public final boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof gtW)) {
return false;
}
gtW gtw = (gtW) obj;
return this.transition.equals(gtw.transition) && this.offsetBefore.equals(gtw.offsetBefore) && this.offsetAfter.equals(gtw.offsetAfter);
}
public final int hashCode() {
return (this.transition.hashCode() ^ this.offsetBefore.hashCode()) ^ Integer.rotateLeft(this.offsetAfter.hashCode(), 16);
}
public final String toString() {
StringBuilder sb = new StringBuilder("Transition[");
sb.append(isGap() ? "Gap" : "Overlap");
sb.append(" at ");
sb.append(this.transition);
sb.append(this.offsetBefore);
sb.append(" to ");
sb.append(this.offsetAfter);
sb.append(']');
return sb.toString();
}
public final gsI getOffsetBefore() {
return this.offsetBefore;
}
public final gsI getOffsetAfter() {
return this.offsetAfter;
}
public final C15522gsr getDateTimeBefore() {
return this.transition;
}
}