Initial commit
This commit is contained in:
550
sources/com/google/common/collect/ImmutableRangeSet.java
Normal file
550
sources/com/google/common/collect/ImmutableRangeSet.java
Normal file
@@ -0,0 +1,550 @@
|
||||
package com.google.common.collect;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.SortedLists;
|
||||
import com.google.common.primitives.Ints;
|
||||
import java.io.Serializable;
|
||||
import java.lang.Comparable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ImmutableRangeSet<C extends Comparable> extends AbstractRangeSet<C> implements Serializable {
|
||||
private transient ImmutableRangeSet<C> complement;
|
||||
private final transient ImmutableList<Range<C>> ranges;
|
||||
private static final ImmutableRangeSet<Comparable<?>> EMPTY = new ImmutableRangeSet<>(ImmutableList.of());
|
||||
private static final ImmutableRangeSet<Comparable<?>> ALL = new ImmutableRangeSet<>(ImmutableList.of(Range.all()));
|
||||
|
||||
private final class AsSet extends ImmutableSortedSet<C> {
|
||||
private final DiscreteDomain<C> a;
|
||||
private transient Integer b;
|
||||
|
||||
AsSet(DiscreteDomain<C> discreteDomain) {
|
||||
super(Ordering.c());
|
||||
this.a = discreteDomain;
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
|
||||
public boolean contains(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
return ImmutableRangeSet.this.contains((Comparable) obj);
|
||||
} catch (ClassCastException unused) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.ImmutableSortedSet
|
||||
ImmutableSortedSet<C> createDescendingSet() {
|
||||
return new DescendingImmutableSortedSet(this);
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
@Override // com.google.common.collect.ImmutableSortedSet
|
||||
int indexOf(Object obj) {
|
||||
if (!contains(obj)) {
|
||||
return -1;
|
||||
}
|
||||
Comparable comparable = (Comparable) obj;
|
||||
long j = 0;
|
||||
UnmodifiableIterator it = ImmutableRangeSet.this.ranges.iterator();
|
||||
while (it.hasNext()) {
|
||||
if (((Range) it.next()).contains(comparable)) {
|
||||
return Ints.b(j + ContiguousSet.create(r3, this.a).indexOf(comparable));
|
||||
}
|
||||
j += ContiguousSet.create(r3, this.a).size();
|
||||
}
|
||||
throw new AssertionError("impossible");
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.ImmutableCollection
|
||||
boolean isPartialView() {
|
||||
return ImmutableRangeSet.this.ranges.isPartialView();
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
|
||||
public int size() {
|
||||
Integer num = this.b;
|
||||
if (num == null) {
|
||||
long j = 0;
|
||||
UnmodifiableIterator it = ImmutableRangeSet.this.ranges.iterator();
|
||||
while (it.hasNext()) {
|
||||
j += ContiguousSet.create((Range) it.next(), this.a).size();
|
||||
if (j >= 2147483647L) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
num = Integer.valueOf(Ints.b(j));
|
||||
this.b = num;
|
||||
}
|
||||
return num.intValue();
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection
|
||||
public String toString() {
|
||||
return ImmutableRangeSet.this.ranges.toString();
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.ImmutableSortedSet, com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection
|
||||
Object writeReplace() {
|
||||
return new AsSetSerializedForm(ImmutableRangeSet.this.ranges, this.a);
|
||||
}
|
||||
|
||||
ImmutableSortedSet<C> a(Range<C> range) {
|
||||
return ImmutableRangeSet.this.m10subRangeSet((Range) range).asSet(this.a);
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.ImmutableSortedSet, java.util.NavigableSet
|
||||
public UnmodifiableIterator<C> descendingIterator() {
|
||||
return new AbstractIterator<C>() { // from class: com.google.common.collect.ImmutableRangeSet.AsSet.2
|
||||
final Iterator<Range<C>> c;
|
||||
Iterator<C> d = Iterators.a();
|
||||
|
||||
{
|
||||
this.c = ImmutableRangeSet.this.ranges.reverse().iterator();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // com.google.common.collect.AbstractIterator
|
||||
public C a() {
|
||||
while (!this.d.hasNext()) {
|
||||
if (!this.c.hasNext()) {
|
||||
return (C) b();
|
||||
}
|
||||
this.d = ContiguousSet.create(this.c.next(), AsSet.this.a).descendingIterator();
|
||||
}
|
||||
return this.d.next();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
@Override // com.google.common.collect.ImmutableSortedSet
|
||||
public ImmutableSortedSet<C> headSetImpl(C c, boolean z) {
|
||||
return a(Range.upTo(c, BoundType.forBoolean(z)));
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.ImmutableSortedSet, com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
|
||||
public UnmodifiableIterator<C> iterator() {
|
||||
return new AbstractIterator<C>() { // from class: com.google.common.collect.ImmutableRangeSet.AsSet.1
|
||||
final Iterator<Range<C>> c;
|
||||
Iterator<C> d = Iterators.a();
|
||||
|
||||
{
|
||||
this.c = ImmutableRangeSet.this.ranges.iterator();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // com.google.common.collect.AbstractIterator
|
||||
public C a() {
|
||||
while (!this.d.hasNext()) {
|
||||
if (!this.c.hasNext()) {
|
||||
return (C) b();
|
||||
}
|
||||
this.d = ContiguousSet.create(this.c.next(), AsSet.this.a).iterator();
|
||||
}
|
||||
return this.d.next();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
@Override // com.google.common.collect.ImmutableSortedSet
|
||||
public ImmutableSortedSet<C> subSetImpl(C c, boolean z, C c2, boolean z2) {
|
||||
return (z || z2 || Range.compareOrThrow(c, c2) != 0) ? a(Range.range(c, BoundType.forBoolean(z), c2, BoundType.forBoolean(z2))) : ImmutableSortedSet.of();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
@Override // com.google.common.collect.ImmutableSortedSet
|
||||
public ImmutableSortedSet<C> tailSetImpl(C c, boolean z) {
|
||||
return a(Range.downTo(c, BoundType.forBoolean(z)));
|
||||
}
|
||||
}
|
||||
|
||||
private static class AsSetSerializedForm<C extends Comparable> implements Serializable {
|
||||
private final ImmutableList<Range<C>> a;
|
||||
private final DiscreteDomain<C> b;
|
||||
|
||||
AsSetSerializedForm(ImmutableList<Range<C>> immutableList, DiscreteDomain<C> discreteDomain) {
|
||||
this.a = immutableList;
|
||||
this.b = discreteDomain;
|
||||
}
|
||||
|
||||
Object readResolve() {
|
||||
return new ImmutableRangeSet(this.a).asSet(this.b);
|
||||
}
|
||||
}
|
||||
|
||||
private final class ComplementRanges extends ImmutableList<Range<C>> {
|
||||
private final boolean a;
|
||||
private final boolean b;
|
||||
private final int c;
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
ComplementRanges() {
|
||||
this.a = ((Range) ImmutableRangeSet.this.ranges.get(0)).hasLowerBound();
|
||||
this.b = ((Range) Iterables.b(ImmutableRangeSet.this.ranges)).hasUpperBound();
|
||||
int size = ImmutableRangeSet.this.ranges.size() - 1;
|
||||
size = this.a ? size + 1 : size;
|
||||
this.c = this.b ? size + 1 : size;
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.ImmutableCollection
|
||||
boolean isPartialView() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
||||
public int size() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
@Override // java.util.List
|
||||
public Range<C> get(int i) {
|
||||
Preconditions.a(i, this.c);
|
||||
return Range.create(this.a ? i == 0 ? Cut.g() : ((Range) ImmutableRangeSet.this.ranges.get(i - 1)).upperBound : ((Range) ImmutableRangeSet.this.ranges.get(i)).upperBound, (this.b && i == this.c + (-1)) ? Cut.f() : ((Range) ImmutableRangeSet.this.ranges.get(i + (!this.a ? 1 : 0))).lowerBound);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class SerializedForm<C extends Comparable> implements Serializable {
|
||||
private final ImmutableList<Range<C>> a;
|
||||
|
||||
SerializedForm(ImmutableList<Range<C>> immutableList) {
|
||||
this.a = immutableList;
|
||||
}
|
||||
|
||||
Object readResolve() {
|
||||
return this.a.isEmpty() ? ImmutableRangeSet.of() : this.a.equals(ImmutableList.of(Range.all())) ? ImmutableRangeSet.all() : new ImmutableRangeSet(this.a);
|
||||
}
|
||||
}
|
||||
|
||||
ImmutableRangeSet(ImmutableList<Range<C>> immutableList) {
|
||||
this.ranges = immutableList;
|
||||
}
|
||||
|
||||
static <C extends Comparable> ImmutableRangeSet<C> all() {
|
||||
return ALL;
|
||||
}
|
||||
|
||||
public static <C extends Comparable<?>> Builder<C> builder() {
|
||||
return new Builder<>();
|
||||
}
|
||||
|
||||
public static <C extends Comparable> ImmutableRangeSet<C> copyOf(RangeSet<C> rangeSet) {
|
||||
Preconditions.a(rangeSet);
|
||||
if (rangeSet.isEmpty()) {
|
||||
return of();
|
||||
}
|
||||
if (rangeSet.encloses(Range.all())) {
|
||||
return all();
|
||||
}
|
||||
if (rangeSet instanceof ImmutableRangeSet) {
|
||||
ImmutableRangeSet<C> immutableRangeSet = (ImmutableRangeSet) rangeSet;
|
||||
if (!immutableRangeSet.isPartialView()) {
|
||||
return immutableRangeSet;
|
||||
}
|
||||
}
|
||||
return new ImmutableRangeSet<>(ImmutableList.copyOf((Collection) rangeSet.asRanges()));
|
||||
}
|
||||
|
||||
private ImmutableList<Range<C>> intersectRanges(final Range<C> range) {
|
||||
if (this.ranges.isEmpty() || range.isEmpty()) {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
if (range.encloses(span())) {
|
||||
return this.ranges;
|
||||
}
|
||||
final int a = range.hasLowerBound() ? SortedLists.a(this.ranges, (Function<? super E, Cut<C>>) Range.upperBoundFn(), range.lowerBound, SortedLists.KeyPresentBehavior.FIRST_AFTER, SortedLists.KeyAbsentBehavior.NEXT_HIGHER) : 0;
|
||||
final int a2 = (range.hasUpperBound() ? SortedLists.a(this.ranges, (Function<? super E, Cut<C>>) Range.lowerBoundFn(), range.upperBound, SortedLists.KeyPresentBehavior.FIRST_PRESENT, SortedLists.KeyAbsentBehavior.NEXT_HIGHER) : this.ranges.size()) - a;
|
||||
return a2 == 0 ? ImmutableList.of() : (ImmutableList<Range<C>>) new ImmutableList<Range<C>>() { // from class: com.google.common.collect.ImmutableRangeSet.1
|
||||
@Override // com.google.common.collect.ImmutableCollection
|
||||
boolean isPartialView() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
||||
public int size() {
|
||||
return a2;
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
@Override // java.util.List
|
||||
public Range<C> get(int i) {
|
||||
Preconditions.a(i, a2);
|
||||
return (i == 0 || i == a2 + (-1)) ? ((Range) ImmutableRangeSet.this.ranges.get(i + a)).intersection(range) : (Range) ImmutableRangeSet.this.ranges.get(i + a);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static <C extends Comparable> ImmutableRangeSet<C> of() {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
public static <C extends Comparable<?>> ImmutableRangeSet<C> unionOf(Iterable<Range<C>> iterable) {
|
||||
return copyOf(TreeRangeSet.create(iterable));
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.AbstractRangeSet
|
||||
@Deprecated
|
||||
public void add(Range<C> range) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.AbstractRangeSet
|
||||
@Deprecated
|
||||
public void addAll(RangeSet<C> rangeSet) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public ImmutableSortedSet<C> asSet(DiscreteDomain<C> discreteDomain) {
|
||||
Preconditions.a(discreteDomain);
|
||||
if (isEmpty()) {
|
||||
return ImmutableSortedSet.of();
|
||||
}
|
||||
Range<C> canonical = span().canonical(discreteDomain);
|
||||
if (!canonical.hasLowerBound()) {
|
||||
throw new IllegalArgumentException("Neither the DiscreteDomain nor this range set are bounded below");
|
||||
}
|
||||
if (!canonical.hasUpperBound()) {
|
||||
try {
|
||||
discreteDomain.a();
|
||||
} catch (NoSuchElementException unused) {
|
||||
throw new IllegalArgumentException("Neither the DiscreteDomain nor this range set are bounded above");
|
||||
}
|
||||
}
|
||||
return new AsSet(discreteDomain);
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.AbstractRangeSet
|
||||
public /* bridge */ /* synthetic */ void clear() {
|
||||
super.clear();
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
@Override // com.google.common.collect.AbstractRangeSet
|
||||
public /* bridge */ /* synthetic */ boolean contains(Comparable comparable) {
|
||||
return super.contains(comparable);
|
||||
}
|
||||
|
||||
public ImmutableRangeSet<C> difference(RangeSet<C> rangeSet) {
|
||||
TreeRangeSet create = TreeRangeSet.create(this);
|
||||
create.removeAll(rangeSet);
|
||||
return copyOf(create);
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.AbstractRangeSet, com.google.common.collect.RangeSet
|
||||
public boolean encloses(Range<C> range) {
|
||||
int a = SortedLists.a(this.ranges, Range.lowerBoundFn(), range.lowerBound, Ordering.c(), SortedLists.KeyPresentBehavior.ANY_PRESENT, SortedLists.KeyAbsentBehavior.NEXT_LOWER);
|
||||
return a != -1 && this.ranges.get(a).encloses(range);
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.AbstractRangeSet
|
||||
public /* bridge */ /* synthetic */ boolean enclosesAll(RangeSet rangeSet) {
|
||||
return super.enclosesAll(rangeSet);
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.AbstractRangeSet
|
||||
public /* bridge */ /* synthetic */ boolean equals(Object obj) {
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
public ImmutableRangeSet<C> intersection(RangeSet<C> rangeSet) {
|
||||
TreeRangeSet create = TreeRangeSet.create(this);
|
||||
create.removeAll(rangeSet.complement());
|
||||
return copyOf(create);
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.AbstractRangeSet
|
||||
public boolean intersects(Range<C> range) {
|
||||
int a = SortedLists.a(this.ranges, Range.lowerBoundFn(), range.lowerBound, Ordering.c(), SortedLists.KeyPresentBehavior.ANY_PRESENT, SortedLists.KeyAbsentBehavior.NEXT_HIGHER);
|
||||
if (a < this.ranges.size() && this.ranges.get(a).isConnected(range) && !this.ranges.get(a).intersection(range).isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
if (a > 0) {
|
||||
int i = a - 1;
|
||||
if (this.ranges.get(i).isConnected(range) && !this.ranges.get(i).intersection(range).isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.AbstractRangeSet, com.google.common.collect.RangeSet
|
||||
public boolean isEmpty() {
|
||||
return this.ranges.isEmpty();
|
||||
}
|
||||
|
||||
boolean isPartialView() {
|
||||
return this.ranges.isPartialView();
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.AbstractRangeSet
|
||||
public Range<C> rangeContaining(C c) {
|
||||
int a = SortedLists.a(this.ranges, Range.lowerBoundFn(), Cut.c(c), Ordering.c(), SortedLists.KeyPresentBehavior.ANY_PRESENT, SortedLists.KeyAbsentBehavior.NEXT_LOWER);
|
||||
if (a == -1) {
|
||||
return null;
|
||||
}
|
||||
Range<C> range = this.ranges.get(a);
|
||||
if (range.contains(c)) {
|
||||
return range;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.AbstractRangeSet
|
||||
@Deprecated
|
||||
public void remove(Range<C> range) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.AbstractRangeSet, com.google.common.collect.RangeSet
|
||||
@Deprecated
|
||||
public void removeAll(RangeSet<C> rangeSet) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Range<C> span() {
|
||||
if (this.ranges.isEmpty()) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
return Range.create(this.ranges.get(0).lowerBound, this.ranges.get(r1.size() - 1).upperBound);
|
||||
}
|
||||
|
||||
public ImmutableRangeSet<C> union(RangeSet<C> rangeSet) {
|
||||
return unionOf(Iterables.a((Iterable) asRanges(), (Iterable) rangeSet.asRanges()));
|
||||
}
|
||||
|
||||
Object writeReplace() {
|
||||
return new SerializedForm(this.ranges);
|
||||
}
|
||||
|
||||
public static class Builder<C extends Comparable<?>> {
|
||||
private final List<Range<C>> a = Lists.a();
|
||||
|
||||
public Builder<C> a(Range<C> range) {
|
||||
Preconditions.a(!range.isEmpty(), "range must not be empty, but was %s", range);
|
||||
this.a.add(range);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder<C> a(Iterable<Range<C>> iterable) {
|
||||
Iterator<Range<C>> it = iterable.iterator();
|
||||
while (it.hasNext()) {
|
||||
a(it.next());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public ImmutableRangeSet<C> a() {
|
||||
ImmutableList.Builder builder = new ImmutableList.Builder(this.a.size());
|
||||
Collections.sort(this.a, Range.rangeLexOrdering());
|
||||
PeekingIterator f = Iterators.f(this.a.iterator());
|
||||
while (f.hasNext()) {
|
||||
Range range = (Range) f.next();
|
||||
while (f.hasNext()) {
|
||||
Range<C> range2 = (Range) f.peek();
|
||||
if (range.isConnected(range2)) {
|
||||
Preconditions.a(range.intersection(range2).isEmpty(), "Overlapping ranges not permitted but found %s overlapping %s", range, range2);
|
||||
range = range.span((Range) f.next());
|
||||
}
|
||||
}
|
||||
builder.a((ImmutableList.Builder) range);
|
||||
}
|
||||
ImmutableList a = builder.a();
|
||||
if (a.isEmpty()) {
|
||||
return ImmutableRangeSet.of();
|
||||
}
|
||||
if (a.size() == 1 && ((Range) Iterables.c(a)).equals(Range.all())) {
|
||||
return ImmutableRangeSet.all();
|
||||
}
|
||||
return new ImmutableRangeSet<>(a);
|
||||
}
|
||||
}
|
||||
|
||||
public static <C extends Comparable> ImmutableRangeSet<C> of(Range<C> range) {
|
||||
Preconditions.a(range);
|
||||
return range.isEmpty() ? of() : range.equals(Range.all()) ? all() : new ImmutableRangeSet<>(ImmutableList.of(range));
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.AbstractRangeSet
|
||||
@Deprecated
|
||||
public void addAll(Iterable<Range<C>> iterable) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/* renamed from: asDescendingSetOfRanges, reason: merged with bridge method [inline-methods] */
|
||||
public ImmutableSet<Range<C>> m9asDescendingSetOfRanges() {
|
||||
return this.ranges.isEmpty() ? ImmutableSet.of() : new RegularImmutableSortedSet(this.ranges.reverse(), Range.rangeLexOrdering().b());
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.RangeSet
|
||||
public ImmutableSet<Range<C>> asRanges() {
|
||||
return this.ranges.isEmpty() ? ImmutableSet.of() : new RegularImmutableSortedSet(this.ranges, Range.rangeLexOrdering());
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.RangeSet
|
||||
public ImmutableRangeSet<C> complement() {
|
||||
ImmutableRangeSet<C> immutableRangeSet = this.complement;
|
||||
if (immutableRangeSet != null) {
|
||||
return immutableRangeSet;
|
||||
}
|
||||
if (this.ranges.isEmpty()) {
|
||||
ImmutableRangeSet<C> all = all();
|
||||
this.complement = all;
|
||||
return all;
|
||||
}
|
||||
if (this.ranges.size() == 1 && this.ranges.get(0).equals(Range.all())) {
|
||||
ImmutableRangeSet<C> of = of();
|
||||
this.complement = of;
|
||||
return of;
|
||||
}
|
||||
ImmutableRangeSet<C> immutableRangeSet2 = new ImmutableRangeSet<>(new ComplementRanges(), this);
|
||||
this.complement = immutableRangeSet2;
|
||||
return immutableRangeSet2;
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.AbstractRangeSet
|
||||
public /* bridge */ /* synthetic */ boolean enclosesAll(Iterable iterable) {
|
||||
return super.enclosesAll(iterable);
|
||||
}
|
||||
|
||||
@Override // com.google.common.collect.AbstractRangeSet
|
||||
@Deprecated
|
||||
public void removeAll(Iterable<Range<C>> iterable) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/* renamed from: subRangeSet, reason: merged with bridge method [inline-methods] */
|
||||
public ImmutableRangeSet<C> m10subRangeSet(Range<C> range) {
|
||||
if (!isEmpty()) {
|
||||
Range<C> span = span();
|
||||
if (range.encloses(span)) {
|
||||
return this;
|
||||
}
|
||||
if (range.isConnected(span)) {
|
||||
return new ImmutableRangeSet<>(intersectRanges(range));
|
||||
}
|
||||
}
|
||||
return of();
|
||||
}
|
||||
|
||||
private ImmutableRangeSet(ImmutableList<Range<C>> immutableList, ImmutableRangeSet<C> immutableRangeSet) {
|
||||
this.ranges = immutableList;
|
||||
this.complement = immutableRangeSet;
|
||||
}
|
||||
|
||||
public static <C extends Comparable<?>> ImmutableRangeSet<C> copyOf(Iterable<Range<C>> iterable) {
|
||||
Builder builder = new Builder();
|
||||
builder.a(iterable);
|
||||
return builder.a();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user