440 lines
13 KiB
Java
440 lines
13 KiB
Java
package com.google.common.collect;
|
|
|
|
import com.google.common.base.Preconditions;
|
|
import com.google.common.primitives.Booleans;
|
|
import java.io.Serializable;
|
|
import java.lang.Comparable;
|
|
import java.util.NoSuchElementException;
|
|
|
|
/* loaded from: classes.dex */
|
|
abstract class Cut<C extends Comparable> implements Comparable<Cut<C>>, Serializable {
|
|
final C a;
|
|
|
|
/* renamed from: com.google.common.collect.Cut$1, reason: invalid class name */
|
|
static /* synthetic */ class AnonymousClass1 {
|
|
static final /* synthetic */ int[] a = new int[BoundType.values().length];
|
|
|
|
static {
|
|
try {
|
|
a[BoundType.CLOSED.ordinal()] = 1;
|
|
} catch (NoSuchFieldError unused) {
|
|
}
|
|
try {
|
|
a[BoundType.OPEN.ordinal()] = 2;
|
|
} catch (NoSuchFieldError unused2) {
|
|
}
|
|
}
|
|
}
|
|
|
|
private static final class AboveAll extends Cut<Comparable<?>> {
|
|
private static final AboveAll b = new AboveAll();
|
|
|
|
private AboveAll() {
|
|
super(null);
|
|
}
|
|
|
|
private Object readResolve() {
|
|
return b;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut, java.lang.Comparable
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public int compareTo(Cut<Comparable<?>> cut) {
|
|
return cut == this ? 0 : 1;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
Cut<Comparable<?>> a(BoundType boundType, DiscreteDomain<Comparable<?>> discreteDomain) {
|
|
throw new AssertionError("this statement should be unreachable");
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
boolean a(Comparable<?> comparable) {
|
|
return false;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
Cut<Comparable<?>> b(BoundType boundType, DiscreteDomain<Comparable<?>> discreteDomain) {
|
|
throw new IllegalStateException();
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
Comparable<?> c() {
|
|
throw new IllegalStateException("range unbounded on this side");
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
BoundType d() {
|
|
throw new AssertionError("this statement should be unreachable");
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
BoundType e() {
|
|
throw new IllegalStateException();
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
public int hashCode() {
|
|
return System.identityHashCode(this);
|
|
}
|
|
|
|
public String toString() {
|
|
return "+∞";
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
void a(StringBuilder sb) {
|
|
throw new AssertionError();
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
void b(StringBuilder sb) {
|
|
sb.append("+∞)");
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
Comparable<?> c(DiscreteDomain<Comparable<?>> discreteDomain) {
|
|
throw new AssertionError();
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
Comparable<?> b(DiscreteDomain<Comparable<?>> discreteDomain) {
|
|
return discreteDomain.a();
|
|
}
|
|
}
|
|
|
|
private static final class AboveValue<C extends Comparable> extends Cut<C> {
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
AboveValue(C c) {
|
|
super(c);
|
|
Preconditions.a(c);
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
boolean a(C c) {
|
|
return Range.compareOrThrow(this.a, c) < 0;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
Cut<C> b(BoundType boundType, DiscreteDomain<C> discreteDomain) {
|
|
int i = AnonymousClass1.a[boundType.ordinal()];
|
|
if (i == 1) {
|
|
return this;
|
|
}
|
|
if (i != 2) {
|
|
throw new AssertionError();
|
|
}
|
|
C a = discreteDomain.a(this.a);
|
|
return a == null ? Cut.f() : Cut.c(a);
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
C c(DiscreteDomain<C> discreteDomain) {
|
|
return discreteDomain.a(this.a);
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut, java.lang.Comparable
|
|
public /* bridge */ /* synthetic */ int compareTo(Object obj) {
|
|
return super.compareTo((Cut) obj);
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
BoundType d() {
|
|
return BoundType.OPEN;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
BoundType e() {
|
|
return BoundType.CLOSED;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
public int hashCode() {
|
|
return ~this.a.hashCode();
|
|
}
|
|
|
|
public String toString() {
|
|
return "/" + this.a + "\\";
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
Cut<C> a(BoundType boundType, DiscreteDomain<C> discreteDomain) {
|
|
int i = AnonymousClass1.a[boundType.ordinal()];
|
|
if (i == 1) {
|
|
C a = discreteDomain.a(this.a);
|
|
return a == null ? Cut.g() : Cut.c(a);
|
|
}
|
|
if (i == 2) {
|
|
return this;
|
|
}
|
|
throw new AssertionError();
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
void b(StringBuilder sb) {
|
|
sb.append(this.a);
|
|
sb.append(']');
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
void a(StringBuilder sb) {
|
|
sb.append('(');
|
|
sb.append(this.a);
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
C b(DiscreteDomain<C> discreteDomain) {
|
|
return this.a;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
Cut<C> a(DiscreteDomain<C> discreteDomain) {
|
|
C c = c(discreteDomain);
|
|
return c != null ? Cut.c(c) : Cut.f();
|
|
}
|
|
}
|
|
|
|
private static final class BelowAll extends Cut<Comparable<?>> {
|
|
private static final BelowAll b = new BelowAll();
|
|
|
|
private BelowAll() {
|
|
super(null);
|
|
}
|
|
|
|
private Object readResolve() {
|
|
return b;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut, java.lang.Comparable
|
|
/* renamed from: a */
|
|
public int compareTo(Cut<Comparable<?>> cut) {
|
|
return cut == this ? 0 : -1;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
Cut<Comparable<?>> a(BoundType boundType, DiscreteDomain<Comparable<?>> discreteDomain) {
|
|
throw new IllegalStateException();
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
boolean a(Comparable<?> comparable) {
|
|
return true;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
Cut<Comparable<?>> b(BoundType boundType, DiscreteDomain<Comparable<?>> discreteDomain) {
|
|
throw new AssertionError("this statement should be unreachable");
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
Comparable<?> c() {
|
|
throw new IllegalStateException("range unbounded on this side");
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
BoundType d() {
|
|
throw new IllegalStateException();
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
BoundType e() {
|
|
throw new AssertionError("this statement should be unreachable");
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
public int hashCode() {
|
|
return System.identityHashCode(this);
|
|
}
|
|
|
|
public String toString() {
|
|
return "-∞";
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
void a(StringBuilder sb) {
|
|
sb.append("(-∞");
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
void b(StringBuilder sb) {
|
|
throw new AssertionError();
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
Comparable<?> c(DiscreteDomain<Comparable<?>> discreteDomain) {
|
|
return discreteDomain.b();
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
Cut<Comparable<?>> a(DiscreteDomain<Comparable<?>> discreteDomain) {
|
|
try {
|
|
return Cut.c(discreteDomain.b());
|
|
} catch (NoSuchElementException unused) {
|
|
return this;
|
|
}
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
Comparable<?> b(DiscreteDomain<Comparable<?>> discreteDomain) {
|
|
throw new AssertionError();
|
|
}
|
|
}
|
|
|
|
private static final class BelowValue<C extends Comparable> extends Cut<C> {
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
BelowValue(C c) {
|
|
super(c);
|
|
Preconditions.a(c);
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
boolean a(C c) {
|
|
return Range.compareOrThrow(this.a, c) <= 0;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
Cut<C> b(BoundType boundType, DiscreteDomain<C> discreteDomain) {
|
|
int i = AnonymousClass1.a[boundType.ordinal()];
|
|
if (i == 1) {
|
|
C b = discreteDomain.b(this.a);
|
|
return b == null ? Cut.f() : new AboveValue(b);
|
|
}
|
|
if (i == 2) {
|
|
return this;
|
|
}
|
|
throw new AssertionError();
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
C c(DiscreteDomain<C> discreteDomain) {
|
|
return this.a;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut, java.lang.Comparable
|
|
public /* bridge */ /* synthetic */ int compareTo(Object obj) {
|
|
return super.compareTo((Cut) obj);
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
BoundType d() {
|
|
return BoundType.CLOSED;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
BoundType e() {
|
|
return BoundType.OPEN;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
public int hashCode() {
|
|
return this.a.hashCode();
|
|
}
|
|
|
|
public String toString() {
|
|
return "\\" + this.a + "/";
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
Cut<C> a(BoundType boundType, DiscreteDomain<C> discreteDomain) {
|
|
int i = AnonymousClass1.a[boundType.ordinal()];
|
|
if (i == 1) {
|
|
return this;
|
|
}
|
|
if (i != 2) {
|
|
throw new AssertionError();
|
|
}
|
|
C b = discreteDomain.b(this.a);
|
|
return b == null ? Cut.g() : new AboveValue(b);
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
void b(StringBuilder sb) {
|
|
sb.append(this.a);
|
|
sb.append(')');
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
void a(StringBuilder sb) {
|
|
sb.append('[');
|
|
sb.append(this.a);
|
|
}
|
|
|
|
@Override // com.google.common.collect.Cut
|
|
C b(DiscreteDomain<C> discreteDomain) {
|
|
return discreteDomain.b(this.a);
|
|
}
|
|
}
|
|
|
|
Cut(C c) {
|
|
this.a = c;
|
|
}
|
|
|
|
static <C extends Comparable> Cut<C> b(C c) {
|
|
return new AboveValue(c);
|
|
}
|
|
|
|
static <C extends Comparable> Cut<C> f() {
|
|
return AboveAll.b;
|
|
}
|
|
|
|
static <C extends Comparable> Cut<C> g() {
|
|
return BelowAll.b;
|
|
}
|
|
|
|
@Override // java.lang.Comparable
|
|
/* renamed from: a */
|
|
public int compareTo(Cut<C> cut) {
|
|
if (cut == g()) {
|
|
return 1;
|
|
}
|
|
if (cut == f()) {
|
|
return -1;
|
|
}
|
|
int compareOrThrow = Range.compareOrThrow(this.a, cut.a);
|
|
return compareOrThrow != 0 ? compareOrThrow : Booleans.a(this instanceof AboveValue, cut instanceof AboveValue);
|
|
}
|
|
|
|
abstract Cut<C> a(BoundType boundType, DiscreteDomain<C> discreteDomain);
|
|
|
|
Cut<C> a(DiscreteDomain<C> discreteDomain) {
|
|
return this;
|
|
}
|
|
|
|
abstract void a(StringBuilder sb);
|
|
|
|
abstract boolean a(C c);
|
|
|
|
abstract Cut<C> b(BoundType boundType, DiscreteDomain<C> discreteDomain);
|
|
|
|
abstract C b(DiscreteDomain<C> discreteDomain);
|
|
|
|
abstract void b(StringBuilder sb);
|
|
|
|
C c() {
|
|
return this.a;
|
|
}
|
|
|
|
abstract C c(DiscreteDomain<C> discreteDomain);
|
|
|
|
abstract BoundType d();
|
|
|
|
abstract BoundType e();
|
|
|
|
public boolean equals(Object obj) {
|
|
if (!(obj instanceof Cut)) {
|
|
return false;
|
|
}
|
|
try {
|
|
return compareTo((Cut) obj) == 0;
|
|
} catch (ClassCastException unused) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public abstract int hashCode();
|
|
|
|
static <C extends Comparable> Cut<C> c(C c) {
|
|
return new BelowValue(c);
|
|
}
|
|
}
|