154 lines
5.1 KiB
Java
154 lines
5.1 KiB
Java
|
package com.google.common.collect;
|
||
|
|
||
|
import com.google.common.primitives.Booleans;
|
||
|
import com.google.common.primitives.Ints;
|
||
|
import com.google.common.primitives.Longs;
|
||
|
import java.util.Comparator;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public abstract class ComparisonChain {
|
||
|
private static final ComparisonChain ACTIVE = new ComparisonChain() { // from class: com.google.common.collect.ComparisonChain.1
|
||
|
@Override // com.google.common.collect.ComparisonChain
|
||
|
public int result() {
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.common.collect.ComparisonChain
|
||
|
public ComparisonChain compare(Comparable comparable, Comparable comparable2) {
|
||
|
return classify(comparable.compareTo(comparable2));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.common.collect.ComparisonChain
|
||
|
public <T> ComparisonChain compare(T t, T t2, Comparator<T> comparator) {
|
||
|
return classify(comparator.compare(t, t2));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.common.collect.ComparisonChain
|
||
|
public ComparisonChain compare(int i, int i2) {
|
||
|
return classify(Ints.compare(i, i2));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.common.collect.ComparisonChain
|
||
|
public ComparisonChain compare(long j, long j2) {
|
||
|
return classify(Longs.compare(j, j2));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.common.collect.ComparisonChain
|
||
|
public ComparisonChain compare(float f, float f2) {
|
||
|
return classify(Float.compare(f, f2));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.common.collect.ComparisonChain
|
||
|
public ComparisonChain compare(double d, double d2) {
|
||
|
return classify(Double.compare(d, d2));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.common.collect.ComparisonChain
|
||
|
public ComparisonChain compareTrueFirst(boolean z, boolean z2) {
|
||
|
return classify(Booleans.compare(z2, z));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.common.collect.ComparisonChain
|
||
|
public ComparisonChain compareFalseFirst(boolean z, boolean z2) {
|
||
|
return classify(Booleans.compare(z, z2));
|
||
|
}
|
||
|
|
||
|
ComparisonChain classify(int i) {
|
||
|
if (i < 0) {
|
||
|
return ComparisonChain.LESS;
|
||
|
}
|
||
|
if (i <= 0) {
|
||
|
return ComparisonChain.ACTIVE;
|
||
|
}
|
||
|
return ComparisonChain.GREATER;
|
||
|
}
|
||
|
};
|
||
|
private static final ComparisonChain LESS = new InactiveComparisonChain(-1);
|
||
|
private static final ComparisonChain GREATER = new InactiveComparisonChain(1);
|
||
|
|
||
|
public abstract ComparisonChain compare(double d, double d2);
|
||
|
|
||
|
public abstract ComparisonChain compare(float f, float f2);
|
||
|
|
||
|
public abstract ComparisonChain compare(int i, int i2);
|
||
|
|
||
|
public abstract ComparisonChain compare(long j, long j2);
|
||
|
|
||
|
public abstract ComparisonChain compare(Comparable<?> comparable, Comparable<?> comparable2);
|
||
|
|
||
|
public abstract <T> ComparisonChain compare(T t, T t2, Comparator<T> comparator);
|
||
|
|
||
|
public abstract ComparisonChain compareFalseFirst(boolean z, boolean z2);
|
||
|
|
||
|
public abstract ComparisonChain compareTrueFirst(boolean z, boolean z2);
|
||
|
|
||
|
public abstract int result();
|
||
|
|
||
|
private ComparisonChain() {
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
static final class InactiveComparisonChain extends ComparisonChain {
|
||
|
final int result;
|
||
|
|
||
|
@Override // com.google.common.collect.ComparisonChain
|
||
|
public final ComparisonChain compare(double d, double d2) {
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.common.collect.ComparisonChain
|
||
|
public final ComparisonChain compare(float f, float f2) {
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.common.collect.ComparisonChain
|
||
|
public final ComparisonChain compare(int i, int i2) {
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.common.collect.ComparisonChain
|
||
|
public final ComparisonChain compare(long j, long j2) {
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.common.collect.ComparisonChain
|
||
|
public final ComparisonChain compare(Comparable comparable, Comparable comparable2) {
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.common.collect.ComparisonChain
|
||
|
public final <T> ComparisonChain compare(T t, T t2, Comparator<T> comparator) {
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.common.collect.ComparisonChain
|
||
|
public final ComparisonChain compareFalseFirst(boolean z, boolean z2) {
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.common.collect.ComparisonChain
|
||
|
public final ComparisonChain compareTrueFirst(boolean z, boolean z2) {
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
InactiveComparisonChain(int i) {
|
||
|
super();
|
||
|
this.result = i;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.common.collect.ComparisonChain
|
||
|
public final int result() {
|
||
|
return this.result;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Deprecated
|
||
|
public final ComparisonChain compare(Boolean bool, Boolean bool2) {
|
||
|
return compareFalseFirst(bool.booleanValue(), bool2.booleanValue());
|
||
|
}
|
||
|
|
||
|
public static ComparisonChain start() {
|
||
|
return ACTIVE;
|
||
|
}
|
||
|
}
|