package com.google.common.collect; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableSortedSet; import java.lang.Comparable; import java.util.NoSuchElementException; /* loaded from: classes.dex */ public abstract class ContiguousSet extends ImmutableSortedSet { final DiscreteDomain domain; ContiguousSet(DiscreteDomain discreteDomain) { super(Ordering.c()); this.domain = discreteDomain; } @Deprecated public static ImmutableSortedSet.Builder builder() { throw new UnsupportedOperationException(); } public static ContiguousSet create(Range range, DiscreteDomain discreteDomain) { Preconditions.a(range); Preconditions.a(discreteDomain); try { Range intersection = !range.hasLowerBound() ? range.intersection(Range.atLeast(discreteDomain.b())) : range; if (!range.hasUpperBound()) { intersection = intersection.intersection(Range.atMost(discreteDomain.a())); } return intersection.isEmpty() || Range.compareOrThrow(range.lowerBound.c(discreteDomain), range.upperBound.b(discreteDomain)) > 0 ? new EmptyContiguousSet(discreteDomain) : new RegularContiguousSet(intersection, discreteDomain); } catch (NoSuchElementException e) { throw new IllegalArgumentException(e); } } @Override // com.google.common.collect.ImmutableSortedSet ImmutableSortedSet createDescendingSet() { return new DescendingImmutableSortedSet(this); } /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.common.collect.ImmutableSortedSet public abstract ContiguousSet headSetImpl(C c, boolean z); public abstract ContiguousSet intersection(ContiguousSet contiguousSet); public abstract Range range(); public abstract Range range(BoundType boundType, BoundType boundType2); /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.common.collect.ImmutableSortedSet public abstract ContiguousSet subSetImpl(C c, boolean z, C c2, boolean z2); /* JADX INFO: Access modifiers changed from: package-private */ @Override // com.google.common.collect.ImmutableSortedSet public abstract ContiguousSet tailSetImpl(C c, boolean z); @Override // java.util.AbstractCollection public String toString() { return range().toString(); } @Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet, java.util.SortedSet public ContiguousSet headSet(C c) { Preconditions.a(c); return headSetImpl((ContiguousSet) c, false); } @Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet, java.util.SortedSet public ContiguousSet subSet(C c, C c2) { Preconditions.a(c); Preconditions.a(c2); Preconditions.a(comparator().compare(c, c2) <= 0); return subSetImpl((boolean) c, true, (boolean) c2, false); } @Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet, java.util.SortedSet public ContiguousSet tailSet(C c) { Preconditions.a(c); return tailSetImpl((ContiguousSet) c, true); } @Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet public ContiguousSet headSet(C c, boolean z) { Preconditions.a(c); return headSetImpl((ContiguousSet) c, z); } @Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet public ContiguousSet tailSet(C c, boolean z) { Preconditions.a(c); return tailSetImpl((ContiguousSet) c, z); } @Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet public ContiguousSet subSet(C c, boolean z, C c2, boolean z2) { Preconditions.a(c); Preconditions.a(c2); Preconditions.a(comparator().compare(c, c2) <= 0); return subSetImpl((boolean) c, z, (boolean) c2, z2); } }