package com.google.common.collect; import com.google.common.base.Objects; import com.google.common.base.Preconditions; import java.io.Serializable; import java.util.Comparator; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public final class GeneralRange implements Serializable { private final Comparator comparator; private final boolean hasLowerBound; private final boolean hasUpperBound; private final BoundType lowerBoundType; private final T lowerEndpoint; private transient GeneralRange reverse; private final BoundType upperBoundType; private final T upperEndpoint; static GeneralRange from(Range range) { return new GeneralRange<>(Ordering.natural(), range.hasLowerBound(), range.hasLowerBound() ? range.lowerEndpoint() : null, range.hasLowerBound() ? range.lowerBoundType() : BoundType.OPEN, range.hasUpperBound(), range.hasUpperBound() ? range.upperEndpoint() : null, range.hasUpperBound() ? range.upperBoundType() : BoundType.OPEN); } /* JADX INFO: Access modifiers changed from: package-private */ public static GeneralRange all(Comparator comparator) { return new GeneralRange<>(comparator, false, null, BoundType.OPEN, false, null, BoundType.OPEN); } /* JADX INFO: Access modifiers changed from: package-private */ public static GeneralRange downTo(Comparator comparator, T t, BoundType boundType) { return new GeneralRange<>(comparator, true, t, boundType, false, null, BoundType.OPEN); } /* JADX INFO: Access modifiers changed from: package-private */ public static GeneralRange upTo(Comparator comparator, T t, BoundType boundType) { return new GeneralRange<>(comparator, false, null, BoundType.OPEN, true, t, boundType); } static GeneralRange range(Comparator comparator, T t, BoundType boundType, T t2, BoundType boundType2) { return new GeneralRange<>(comparator, true, t, boundType, true, t2, boundType2); } /* JADX WARN: Multi-variable type inference failed */ private GeneralRange(Comparator comparator, boolean z, T t, BoundType boundType, boolean z2, T t2, BoundType boundType2) { this.comparator = (Comparator) Preconditions.checkNotNull(comparator); this.hasLowerBound = z; this.hasUpperBound = z2; this.lowerEndpoint = t; this.lowerBoundType = (BoundType) Preconditions.checkNotNull(boundType); this.upperEndpoint = t2; this.upperBoundType = (BoundType) Preconditions.checkNotNull(boundType2); if (z) { comparator.compare(t, t); } if (z2) { comparator.compare(t2, t2); } if (z && z2) { int compare = comparator.compare(t, t2); Preconditions.checkArgument(compare <= 0, "lowerEndpoint (%s) > upperEndpoint (%s)", t, t2); if (compare == 0) { Preconditions.checkArgument((boundType != BoundType.OPEN) | (boundType2 != BoundType.OPEN)); } } } final boolean isEmpty() { return (hasUpperBound() && tooLow(getUpperEndpoint())) || (hasLowerBound() && tooHigh(getLowerEndpoint())); } /* JADX INFO: Access modifiers changed from: package-private */ public final boolean tooLow(T t) { if (!hasLowerBound()) { return false; } int compare = this.comparator.compare(t, getLowerEndpoint()); return ((compare == 0) & (getLowerBoundType() == BoundType.OPEN)) | (compare < 0); } /* JADX INFO: Access modifiers changed from: package-private */ public final boolean tooHigh(T t) { if (!hasUpperBound()) { return false; } int compare = this.comparator.compare(t, getUpperEndpoint()); return ((compare == 0) & (getUpperBoundType() == BoundType.OPEN)) | (compare > 0); } /* JADX INFO: Access modifiers changed from: package-private */ public final boolean contains(T t) { return (tooLow(t) || tooHigh(t)) ? false : true; } /* JADX INFO: Access modifiers changed from: package-private */ /* JADX WARN: Code restructure failed: missing block: B:37:0x003f, code lost: if (r12.getLowerBoundType() == com.google.common.collect.BoundType.OPEN) goto L12; */ /* JADX WARN: Removed duplicated region for block: B:23:0x0065 */ /* JADX WARN: Removed duplicated region for block: B:7:0x005a */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final com.google.common.collect.GeneralRange intersect(com.google.common.collect.GeneralRange r12) { /* r11 = this; com.google.common.base.Preconditions.checkNotNull(r12) java.util.Comparator r0 = r11.comparator java.util.Comparator r1 = r12.comparator boolean r0 = r0.equals(r1) com.google.common.base.Preconditions.checkArgument(r0) boolean r0 = r11.hasLowerBound java.lang.Object r1 = r11.getLowerEndpoint() com.google.common.collect.BoundType r2 = r11.getLowerBoundType() boolean r3 = r11.hasLowerBound() if (r3 != 0) goto L21 boolean r0 = r12.hasLowerBound goto L41 L21: boolean r3 = r12.hasLowerBound() if (r3 == 0) goto L49 java.util.Comparator r3 = r11.comparator java.lang.Object r4 = r11.getLowerEndpoint() java.lang.Object r5 = r12.getLowerEndpoint() int r3 = r3.compare(r4, r5) if (r3 < 0) goto L41 if (r3 != 0) goto L49 com.google.common.collect.BoundType r3 = r12.getLowerBoundType() com.google.common.collect.BoundType r4 = com.google.common.collect.BoundType.OPEN if (r3 != r4) goto L49 L41: java.lang.Object r1 = r12.getLowerEndpoint() com.google.common.collect.BoundType r2 = r12.getLowerBoundType() L49: r5 = r0 boolean r0 = r11.hasUpperBound java.lang.Object r3 = r11.getUpperEndpoint() com.google.common.collect.BoundType r4 = r11.getUpperBoundType() boolean r6 = r11.hasUpperBound() if (r6 != 0) goto L65 boolean r0 = r12.hasUpperBound java.lang.Object r3 = r12.getUpperEndpoint() com.google.common.collect.BoundType r4 = r12.getUpperBoundType() goto L8d L65: boolean r6 = r12.hasUpperBound() if (r6 == 0) goto L8d java.util.Comparator r6 = r11.comparator java.lang.Object r7 = r11.getUpperEndpoint() java.lang.Object r8 = r12.getUpperEndpoint() int r6 = r6.compare(r7, r8) if (r6 > 0) goto L85 if (r6 != 0) goto L8d com.google.common.collect.BoundType r6 = r12.getUpperBoundType() com.google.common.collect.BoundType r7 = com.google.common.collect.BoundType.OPEN if (r6 != r7) goto L8d L85: java.lang.Object r3 = r12.getUpperEndpoint() com.google.common.collect.BoundType r4 = r12.getUpperBoundType() L8d: r8 = r0 r9 = r3 if (r5 == 0) goto Lad if (r8 == 0) goto Lad java.util.Comparator r12 = r11.comparator int r12 = r12.compare(r1, r9) if (r12 > 0) goto La5 if (r12 != 0) goto Lad com.google.common.collect.BoundType r12 = com.google.common.collect.BoundType.OPEN if (r2 != r12) goto Lad com.google.common.collect.BoundType r12 = com.google.common.collect.BoundType.OPEN if (r4 != r12) goto Lad La5: com.google.common.collect.BoundType r12 = com.google.common.collect.BoundType.OPEN com.google.common.collect.BoundType r0 = com.google.common.collect.BoundType.CLOSED r7 = r12 r10 = r0 r6 = r9 goto Lb0 Lad: r6 = r1 r7 = r2 r10 = r4 Lb0: com.google.common.collect.GeneralRange r12 = new com.google.common.collect.GeneralRange java.util.Comparator r4 = r11.comparator r3 = r12 r3.(r4, r5, r6, r7, r8, r9, r10) return r12 */ throw new UnsupportedOperationException("Method not decompiled: com.google.common.collect.GeneralRange.intersect(com.google.common.collect.GeneralRange):com.google.common.collect.GeneralRange"); } public final boolean equals(Object obj) { if (!(obj instanceof GeneralRange)) { return false; } GeneralRange generalRange = (GeneralRange) obj; return this.comparator.equals(generalRange.comparator) && this.hasLowerBound == generalRange.hasLowerBound && this.hasUpperBound == generalRange.hasUpperBound && getLowerBoundType().equals(generalRange.getLowerBoundType()) && getUpperBoundType().equals(generalRange.getUpperBoundType()) && Objects.equal(getLowerEndpoint(), generalRange.getLowerEndpoint()) && Objects.equal(getUpperEndpoint(), generalRange.getUpperEndpoint()); } public final int hashCode() { return Objects.hashCode(this.comparator, getLowerEndpoint(), getLowerBoundType(), getUpperEndpoint(), getUpperBoundType()); } final GeneralRange reverse() { GeneralRange generalRange = this.reverse; if (generalRange != null) { return generalRange; } GeneralRange generalRange2 = new GeneralRange<>(Ordering.from(this.comparator).reverse(), this.hasUpperBound, getUpperEndpoint(), getUpperBoundType(), this.hasLowerBound, getLowerEndpoint(), getLowerBoundType()); generalRange2.reverse = this; this.reverse = generalRange2; return generalRange2; } public final String toString() { String valueOf = String.valueOf(this.comparator); char c = this.lowerBoundType == BoundType.CLOSED ? '[' : '('; String valueOf2 = String.valueOf(this.hasLowerBound ? this.lowerEndpoint : "-∞"); String valueOf3 = String.valueOf(this.hasUpperBound ? this.upperEndpoint : "∞"); char c2 = this.upperBoundType == BoundType.CLOSED ? ']' : ')'; StringBuilder sb = new StringBuilder(String.valueOf(valueOf).length() + 4 + String.valueOf(valueOf2).length() + String.valueOf(valueOf3).length()); sb.append(valueOf); sb.append(":"); sb.append(c); sb.append(valueOf2); sb.append(','); sb.append(valueOf3); sb.append(c2); return sb.toString(); } /* JADX INFO: Access modifiers changed from: package-private */ public final boolean hasUpperBound() { return this.hasUpperBound; } /* JADX INFO: Access modifiers changed from: package-private */ public final boolean hasLowerBound() { return this.hasLowerBound; } /* JADX INFO: Access modifiers changed from: package-private */ public final T getUpperEndpoint() { return this.upperEndpoint; } /* JADX INFO: Access modifiers changed from: package-private */ public final BoundType getUpperBoundType() { return this.upperBoundType; } /* JADX INFO: Access modifiers changed from: package-private */ public final T getLowerEndpoint() { return this.lowerEndpoint; } /* JADX INFO: Access modifiers changed from: package-private */ public final BoundType getLowerBoundType() { return this.lowerBoundType; } /* JADX INFO: Access modifiers changed from: package-private */ public final Comparator comparator() { return this.comparator; } }