663 lines
28 KiB
Java
663 lines
28 KiB
Java
package com.google.common.collect;
|
|
|
|
import com.google.common.base.MoreObjects;
|
|
import com.google.common.base.Preconditions;
|
|
import com.google.common.base.Predicate;
|
|
import com.google.common.base.Predicates;
|
|
import com.google.common.collect.Maps;
|
|
import java.lang.Comparable;
|
|
import java.util.AbstractMap;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.Collections;
|
|
import java.util.Iterator;
|
|
import java.util.Map;
|
|
import java.util.NavigableMap;
|
|
import java.util.NoSuchElementException;
|
|
import java.util.Set;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class TreeRangeMap<K extends Comparable, V> implements RangeMap<K, V> {
|
|
private static final RangeMap EMPTY_SUB_RANGE_MAP = new RangeMap() { // from class: com.google.common.collect.TreeRangeMap.1
|
|
@Override // com.google.common.collect.RangeMap
|
|
public void clear() {
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public Object get(Comparable comparable) {
|
|
return null;
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public Map.Entry<Range, Object> getEntry(Comparable comparable) {
|
|
return null;
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public Range span() {
|
|
throw new NoSuchElementException();
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public void put(Range range, Object obj) {
|
|
Preconditions.checkNotNull(range);
|
|
String valueOf = String.valueOf(range);
|
|
StringBuilder sb = new StringBuilder(String.valueOf(valueOf).length() + 46);
|
|
sb.append("Cannot insert range ");
|
|
sb.append(valueOf);
|
|
sb.append(" into an empty subRangeMap");
|
|
throw new IllegalArgumentException(sb.toString());
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public void putCoalescing(Range range, Object obj) {
|
|
Preconditions.checkNotNull(range);
|
|
String valueOf = String.valueOf(range);
|
|
StringBuilder sb = new StringBuilder(String.valueOf(valueOf).length() + 46);
|
|
sb.append("Cannot insert range ");
|
|
sb.append(valueOf);
|
|
sb.append(" into an empty subRangeMap");
|
|
throw new IllegalArgumentException(sb.toString());
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public void putAll(RangeMap rangeMap) {
|
|
if (!rangeMap.asMapOfRanges().isEmpty()) {
|
|
throw new IllegalArgumentException("Cannot putAll(nonEmptyRangeMap) into an empty subRangeMap");
|
|
}
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public void remove(Range range) {
|
|
Preconditions.checkNotNull(range);
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public Map<Range, Object> asMapOfRanges() {
|
|
return Collections.emptyMap();
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public Map<Range, Object> asDescendingMapOfRanges() {
|
|
return Collections.emptyMap();
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public RangeMap subRangeMap(Range range) {
|
|
Preconditions.checkNotNull(range);
|
|
return this;
|
|
}
|
|
};
|
|
private final NavigableMap<Cut<K>, RangeMapEntry<K, V>> entriesByLowerBound = Maps.newTreeMap();
|
|
|
|
public static <K extends Comparable, V> TreeRangeMap<K, V> create() {
|
|
return new TreeRangeMap<>();
|
|
}
|
|
|
|
private TreeRangeMap() {
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public static final class RangeMapEntry<K extends Comparable, V> extends AbstractMapEntry<Range<K>, V> {
|
|
private final Range<K> range;
|
|
private final V value;
|
|
|
|
RangeMapEntry(Cut<K> cut, Cut<K> cut2, V v) {
|
|
this(Range.create(cut, cut2), v);
|
|
}
|
|
|
|
RangeMapEntry(Range<K> range, V v) {
|
|
this.range = range;
|
|
this.value = v;
|
|
}
|
|
|
|
public final boolean contains(K k) {
|
|
return this.range.contains(k);
|
|
}
|
|
|
|
final Cut<K> getLowerBound() {
|
|
return this.range.lowerBound;
|
|
}
|
|
|
|
final Cut<K> getUpperBound() {
|
|
return this.range.upperBound;
|
|
}
|
|
|
|
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
|
|
public final V getValue() {
|
|
return this.value;
|
|
}
|
|
|
|
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
|
|
public final Range<K> getKey() {
|
|
return this.range;
|
|
}
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public final V get(K k) {
|
|
Map.Entry<Range<K>, V> entry = getEntry(k);
|
|
if (entry == null) {
|
|
return null;
|
|
}
|
|
return entry.getValue();
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public final Map.Entry<Range<K>, V> getEntry(K k) {
|
|
Map.Entry<Cut<K>, RangeMapEntry<K, V>> floorEntry = this.entriesByLowerBound.floorEntry(Cut.belowValue(k));
|
|
if (floorEntry == null || !floorEntry.getValue().contains(k)) {
|
|
return null;
|
|
}
|
|
return floorEntry.getValue();
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public final void put(Range<K> range, V v) {
|
|
if (range.isEmpty()) {
|
|
return;
|
|
}
|
|
Preconditions.checkNotNull(v);
|
|
remove(range);
|
|
this.entriesByLowerBound.put(range.lowerBound, new RangeMapEntry(range, v));
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // com.google.common.collect.RangeMap
|
|
public final void putCoalescing(Range<K> range, V v) {
|
|
if (this.entriesByLowerBound.isEmpty()) {
|
|
put(range, v);
|
|
} else {
|
|
put(coalescedRange(range, Preconditions.checkNotNull(v)), v);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public Range<K> coalescedRange(Range<K> range, V v) {
|
|
return coalesce(coalesce(range, v, this.entriesByLowerBound.lowerEntry(range.lowerBound)), v, this.entriesByLowerBound.floorEntry(range.upperBound));
|
|
}
|
|
|
|
private static <K extends Comparable, V> Range<K> coalesce(Range<K> range, V v, Map.Entry<Cut<K>, RangeMapEntry<K, V>> entry) {
|
|
return (entry != null && entry.getValue().getKey().isConnected(range) && entry.getValue().getValue().equals(v)) ? range.span(entry.getValue().getKey()) : range;
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public final void putAll(RangeMap<K, V> rangeMap) {
|
|
for (Map.Entry<Range<K>, V> entry : rangeMap.asMapOfRanges().entrySet()) {
|
|
put(entry.getKey(), entry.getValue());
|
|
}
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public final void clear() {
|
|
this.entriesByLowerBound.clear();
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public final Range<K> span() {
|
|
Map.Entry<Cut<K>, RangeMapEntry<K, V>> firstEntry = this.entriesByLowerBound.firstEntry();
|
|
Map.Entry<Cut<K>, RangeMapEntry<K, V>> lastEntry = this.entriesByLowerBound.lastEntry();
|
|
if (firstEntry == null) {
|
|
throw new NoSuchElementException();
|
|
}
|
|
return Range.create(firstEntry.getValue().getKey().lowerBound, lastEntry.getValue().getKey().upperBound);
|
|
}
|
|
|
|
private void putRangeMapEntry(Cut<K> cut, Cut<K> cut2, V v) {
|
|
this.entriesByLowerBound.put(cut, new RangeMapEntry(cut, cut2, v));
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public final void remove(Range<K> range) {
|
|
if (range.isEmpty()) {
|
|
return;
|
|
}
|
|
Map.Entry<Cut<K>, RangeMapEntry<K, V>> lowerEntry = this.entriesByLowerBound.lowerEntry(range.lowerBound);
|
|
if (lowerEntry != null) {
|
|
RangeMapEntry<K, V> value = lowerEntry.getValue();
|
|
if (value.getUpperBound().compareTo(range.lowerBound) > 0) {
|
|
if (value.getUpperBound().compareTo(range.upperBound) > 0) {
|
|
putRangeMapEntry(range.upperBound, value.getUpperBound(), lowerEntry.getValue().getValue());
|
|
}
|
|
putRangeMapEntry(value.getLowerBound(), range.lowerBound, lowerEntry.getValue().getValue());
|
|
}
|
|
}
|
|
Map.Entry<Cut<K>, RangeMapEntry<K, V>> lowerEntry2 = this.entriesByLowerBound.lowerEntry(range.upperBound);
|
|
if (lowerEntry2 != null) {
|
|
RangeMapEntry<K, V> value2 = lowerEntry2.getValue();
|
|
if (value2.getUpperBound().compareTo(range.upperBound) > 0) {
|
|
putRangeMapEntry(range.upperBound, value2.getUpperBound(), lowerEntry2.getValue().getValue());
|
|
}
|
|
}
|
|
this.entriesByLowerBound.subMap(range.lowerBound, range.upperBound).clear();
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public final Map<Range<K>, V> asMapOfRanges() {
|
|
return new AsMapOfRanges(this, this.entriesByLowerBound.values());
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public final Map<Range<K>, V> asDescendingMapOfRanges() {
|
|
return new AsMapOfRanges(this, this.entriesByLowerBound.descendingMap().values());
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public final class AsMapOfRanges extends Maps.IteratorBasedAbstractMap<Range<K>, V> {
|
|
final Iterable<Map.Entry<Range<K>, V>> entryIterable;
|
|
final TreeRangeMap this$0;
|
|
|
|
AsMapOfRanges(TreeRangeMap treeRangeMap, Iterable<RangeMapEntry<K, V>> iterable) {
|
|
this.this$0 = treeRangeMap;
|
|
this.entryIterable = iterable;
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public final boolean containsKey(Object obj) {
|
|
return get(obj) != null;
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public final V get(Object obj) {
|
|
if (!(obj instanceof Range)) {
|
|
return null;
|
|
}
|
|
Range range = (Range) obj;
|
|
RangeMapEntry rangeMapEntry = (RangeMapEntry) this.this$0.entriesByLowerBound.get(range.lowerBound);
|
|
if (rangeMapEntry == null || !rangeMapEntry.getKey().equals(range)) {
|
|
return null;
|
|
}
|
|
return (V) rangeMapEntry.getValue();
|
|
}
|
|
|
|
@Override // com.google.common.collect.Maps.IteratorBasedAbstractMap, java.util.AbstractMap, java.util.Map
|
|
public final int size() {
|
|
return this.this$0.entriesByLowerBound.size();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
@Override // com.google.common.collect.Maps.IteratorBasedAbstractMap
|
|
public final Iterator<Map.Entry<Range<K>, V>> entryIterator() {
|
|
return this.entryIterable.iterator();
|
|
}
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public final RangeMap<K, V> subRangeMap(Range<K> range) {
|
|
return range.equals(Range.all()) ? this : new SubRangeMap(this, range);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public class SubRangeMap implements RangeMap<K, V> {
|
|
private final Range<K> subRange;
|
|
final TreeRangeMap this$0;
|
|
|
|
SubRangeMap(TreeRangeMap treeRangeMap, Range<K> range) {
|
|
this.this$0 = treeRangeMap;
|
|
this.subRange = range;
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public V get(K k) {
|
|
if (this.subRange.contains(k)) {
|
|
return (V) this.this$0.get(k);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public Map.Entry<Range<K>, V> getEntry(K k) {
|
|
Map.Entry<Range<K>, V> entry;
|
|
if (!this.subRange.contains(k) || (entry = this.this$0.getEntry(k)) == null) {
|
|
return null;
|
|
}
|
|
return Maps.immutableEntry(entry.getKey().intersection(this.subRange), entry.getValue());
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public Range<K> span() {
|
|
Cut<K> cut;
|
|
Cut<K> upperBound;
|
|
Map.Entry floorEntry = this.this$0.entriesByLowerBound.floorEntry(this.subRange.lowerBound);
|
|
if (floorEntry == null || ((RangeMapEntry) floorEntry.getValue()).getUpperBound().compareTo((Cut) this.subRange.lowerBound) <= 0) {
|
|
cut = (Cut) this.this$0.entriesByLowerBound.ceilingKey(this.subRange.lowerBound);
|
|
if (cut == null || cut.compareTo(this.subRange.upperBound) >= 0) {
|
|
throw new NoSuchElementException();
|
|
}
|
|
} else {
|
|
cut = this.subRange.lowerBound;
|
|
}
|
|
Map.Entry lowerEntry = this.this$0.entriesByLowerBound.lowerEntry(this.subRange.upperBound);
|
|
if (lowerEntry == null) {
|
|
throw new NoSuchElementException();
|
|
}
|
|
if (((RangeMapEntry) lowerEntry.getValue()).getUpperBound().compareTo((Cut) this.subRange.upperBound) >= 0) {
|
|
upperBound = this.subRange.upperBound;
|
|
} else {
|
|
upperBound = ((RangeMapEntry) lowerEntry.getValue()).getUpperBound();
|
|
}
|
|
return Range.create(cut, upperBound);
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public void put(Range<K> range, V v) {
|
|
Preconditions.checkArgument(this.subRange.encloses(range), "Cannot put range %s into a subRangeMap(%s)", range, this.subRange);
|
|
this.this$0.put(range, v);
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public void putCoalescing(Range<K> range, V v) {
|
|
if (this.this$0.entriesByLowerBound.isEmpty() || !this.subRange.encloses(range)) {
|
|
put(range, v);
|
|
} else {
|
|
put(this.this$0.coalescedRange(range, Preconditions.checkNotNull(v)).intersection(this.subRange), v);
|
|
}
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public void putAll(RangeMap<K, V> rangeMap) {
|
|
if (rangeMap.asMapOfRanges().isEmpty()) {
|
|
return;
|
|
}
|
|
Range<K> span = rangeMap.span();
|
|
Preconditions.checkArgument(this.subRange.encloses(span), "Cannot putAll rangeMap with span %s into a subRangeMap(%s)", span, this.subRange);
|
|
this.this$0.putAll(rangeMap);
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public void clear() {
|
|
this.this$0.remove(this.subRange);
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public void remove(Range<K> range) {
|
|
if (range.isConnected(this.subRange)) {
|
|
this.this$0.remove(range.intersection(this.subRange));
|
|
}
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public RangeMap<K, V> subRangeMap(Range<K> range) {
|
|
if (!range.isConnected(this.subRange)) {
|
|
return this.this$0.emptySubRangeMap();
|
|
}
|
|
return this.this$0.subRangeMap(range.intersection(this.subRange));
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public Map<Range<K>, V> asMapOfRanges() {
|
|
return new SubRangeMapAsMap(this);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* renamed from: com.google.common.collect.TreeRangeMap$SubRangeMap$1, reason: invalid class name */
|
|
/* loaded from: classes2.dex */
|
|
public class AnonymousClass1 extends SubRangeMapAsMap {
|
|
final SubRangeMap this$1;
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
AnonymousClass1(SubRangeMap subRangeMap) {
|
|
super(subRangeMap);
|
|
this.this$1 = subRangeMap;
|
|
}
|
|
|
|
@Override // com.google.common.collect.TreeRangeMap.SubRangeMap.SubRangeMapAsMap
|
|
Iterator<Map.Entry<Range<K>, V>> entryIterator() {
|
|
if (this.this$1.subRange.isEmpty()) {
|
|
return Iterators.emptyIterator();
|
|
}
|
|
return new AbstractIterator<Map.Entry<Range<K>, V>>(this, this.this$1.this$0.entriesByLowerBound.headMap(this.this$1.subRange.upperBound, false).descendingMap().values().iterator()) { // from class: com.google.common.collect.TreeRangeMap.SubRangeMap.1.1
|
|
final AnonymousClass1 this$2;
|
|
final Iterator val$backingItr;
|
|
|
|
{
|
|
this.this$2 = this;
|
|
this.val$backingItr = r2;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
@Override // com.google.common.collect.AbstractIterator
|
|
public Map.Entry<Range<K>, V> computeNext() {
|
|
if (this.val$backingItr.hasNext()) {
|
|
RangeMapEntry rangeMapEntry = (RangeMapEntry) this.val$backingItr.next();
|
|
if (rangeMapEntry.getUpperBound().compareTo((Cut) this.this$2.this$1.subRange.lowerBound) > 0) {
|
|
return Maps.immutableEntry(rangeMapEntry.getKey().intersection(this.this$2.this$1.subRange), rangeMapEntry.getValue());
|
|
}
|
|
return (Map.Entry) endOfData();
|
|
}
|
|
return (Map.Entry) endOfData();
|
|
}
|
|
};
|
|
}
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public Map<Range<K>, V> asDescendingMapOfRanges() {
|
|
return new AnonymousClass1(this);
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public boolean equals(Object obj) {
|
|
if (obj instanceof RangeMap) {
|
|
return asMapOfRanges().equals(((RangeMap) obj).asMapOfRanges());
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public int hashCode() {
|
|
return asMapOfRanges().hashCode();
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public String toString() {
|
|
return asMapOfRanges().toString();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public class SubRangeMapAsMap extends AbstractMap<Range<K>, V> {
|
|
final SubRangeMap this$1;
|
|
|
|
SubRangeMapAsMap(SubRangeMap subRangeMap) {
|
|
this.this$1 = subRangeMap;
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public boolean containsKey(Object obj) {
|
|
return get(obj) != null;
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public V get(Object obj) {
|
|
RangeMapEntry rangeMapEntry;
|
|
if (obj instanceof Range) {
|
|
try {
|
|
Range range = (Range) obj;
|
|
if (this.this$1.subRange.encloses(range) && !range.isEmpty()) {
|
|
if (range.lowerBound.compareTo((Cut) this.this$1.subRange.lowerBound) == 0) {
|
|
Map.Entry floorEntry = this.this$1.this$0.entriesByLowerBound.floorEntry(range.lowerBound);
|
|
rangeMapEntry = floorEntry != null ? (RangeMapEntry) floorEntry.getValue() : null;
|
|
} else {
|
|
rangeMapEntry = (RangeMapEntry) this.this$1.this$0.entriesByLowerBound.get(range.lowerBound);
|
|
}
|
|
if (rangeMapEntry != null && rangeMapEntry.getKey().isConnected(this.this$1.subRange) && rangeMapEntry.getKey().intersection(this.this$1.subRange).equals(range)) {
|
|
return (V) rangeMapEntry.getValue();
|
|
}
|
|
}
|
|
} catch (ClassCastException unused) {
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public V remove(Object obj) {
|
|
V v = get(obj);
|
|
if (v == null) {
|
|
return null;
|
|
}
|
|
this.this$1.this$0.remove((Range) obj);
|
|
return v;
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public void clear() {
|
|
this.this$1.clear();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public boolean removeEntryIf(Predicate<? super Map.Entry<Range<K>, V>> predicate) {
|
|
ArrayList newArrayList = Lists.newArrayList();
|
|
Iterator it = entrySet().iterator();
|
|
while (it.hasNext()) {
|
|
Map.Entry entry = (Map.Entry) it.next();
|
|
if (predicate.apply(entry)) {
|
|
newArrayList.add(entry.getKey());
|
|
}
|
|
}
|
|
Iterator it2 = newArrayList.iterator();
|
|
while (it2.hasNext()) {
|
|
this.this$1.this$0.remove((Range) it2.next());
|
|
}
|
|
return !newArrayList.isEmpty();
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public Set<Range<K>> keySet() {
|
|
return new Maps.KeySet<Range<K>, V>(this, this) { // from class: com.google.common.collect.TreeRangeMap.SubRangeMap.SubRangeMapAsMap.1
|
|
final SubRangeMapAsMap this$2;
|
|
|
|
{
|
|
this.this$2 = this;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Maps.KeySet, java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public boolean remove(Object obj) {
|
|
return this.this$2.remove(obj) != null;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Sets.ImprovedAbstractSet, java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public boolean retainAll(Collection<?> collection) {
|
|
return this.this$2.removeEntryIf(Predicates.compose(Predicates.not(Predicates.in(collection)), Maps.keyFunction()));
|
|
}
|
|
};
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public Set<Map.Entry<Range<K>, V>> entrySet() {
|
|
return new Maps.EntrySet<Range<K>, V>(this) { // from class: com.google.common.collect.TreeRangeMap.SubRangeMap.SubRangeMapAsMap.2
|
|
final SubRangeMapAsMap this$2;
|
|
|
|
{
|
|
this.this$2 = this;
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
|
|
public Iterator<Map.Entry<Range<K>, V>> iterator() {
|
|
return this.this$2.entryIterator();
|
|
}
|
|
|
|
@Override // com.google.common.collect.Maps.EntrySet, com.google.common.collect.Sets.ImprovedAbstractSet, java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public boolean retainAll(Collection<?> collection) {
|
|
return this.this$2.removeEntryIf(Predicates.not(Predicates.in(collection)));
|
|
}
|
|
|
|
@Override // com.google.common.collect.Maps.EntrySet, java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public int size() {
|
|
return Iterators.size(iterator());
|
|
}
|
|
|
|
@Override // com.google.common.collect.Maps.EntrySet, java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public boolean isEmpty() {
|
|
return !iterator().hasNext();
|
|
}
|
|
|
|
@Override // com.google.common.collect.Maps.EntrySet
|
|
Map<Range<K>, V> map() {
|
|
return this.this$2;
|
|
}
|
|
};
|
|
}
|
|
|
|
Iterator<Map.Entry<Range<K>, V>> entryIterator() {
|
|
if (this.this$1.subRange.isEmpty()) {
|
|
return Iterators.emptyIterator();
|
|
}
|
|
return new AbstractIterator<Map.Entry<Range<K>, V>>(this, this.this$1.this$0.entriesByLowerBound.tailMap((Cut) MoreObjects.firstNonNull(this.this$1.this$0.entriesByLowerBound.floorKey(this.this$1.subRange.lowerBound), this.this$1.subRange.lowerBound), true).values().iterator()) { // from class: com.google.common.collect.TreeRangeMap.SubRangeMap.SubRangeMapAsMap.3
|
|
final SubRangeMapAsMap this$2;
|
|
final Iterator val$backingItr;
|
|
|
|
{
|
|
this.this$2 = this;
|
|
this.val$backingItr = r2;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
@Override // com.google.common.collect.AbstractIterator
|
|
public Map.Entry<Range<K>, V> computeNext() {
|
|
while (this.val$backingItr.hasNext()) {
|
|
RangeMapEntry rangeMapEntry = (RangeMapEntry) this.val$backingItr.next();
|
|
if (rangeMapEntry.getLowerBound().compareTo((Cut) this.this$2.this$1.subRange.upperBound) < 0) {
|
|
if (rangeMapEntry.getUpperBound().compareTo((Cut) this.this$2.this$1.subRange.lowerBound) > 0) {
|
|
return Maps.immutableEntry(rangeMapEntry.getKey().intersection(this.this$2.this$1.subRange), rangeMapEntry.getValue());
|
|
}
|
|
} else {
|
|
return (Map.Entry) endOfData();
|
|
}
|
|
}
|
|
return (Map.Entry) endOfData();
|
|
}
|
|
};
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public Collection<V> values() {
|
|
return new Maps.Values<Range<K>, V>(this, this) { // from class: com.google.common.collect.TreeRangeMap.SubRangeMap.SubRangeMapAsMap.4
|
|
final SubRangeMapAsMap this$2;
|
|
|
|
{
|
|
this.this$2 = this;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Maps.Values, java.util.AbstractCollection, java.util.Collection
|
|
public boolean removeAll(Collection<?> collection) {
|
|
return this.this$2.removeEntryIf(Predicates.compose(Predicates.in(collection), Maps.valueFunction()));
|
|
}
|
|
|
|
@Override // com.google.common.collect.Maps.Values, java.util.AbstractCollection, java.util.Collection
|
|
public boolean retainAll(Collection<?> collection) {
|
|
return this.this$2.removeEntryIf(Predicates.compose(Predicates.not(Predicates.in(collection)), Maps.valueFunction()));
|
|
}
|
|
};
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public final boolean equals(Object obj) {
|
|
if (obj instanceof RangeMap) {
|
|
return asMapOfRanges().equals(((RangeMap) obj).asMapOfRanges());
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public final int hashCode() {
|
|
return asMapOfRanges().hashCode();
|
|
}
|
|
|
|
@Override // com.google.common.collect.RangeMap
|
|
public final String toString() {
|
|
return this.entriesByLowerBound.values().toString();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public RangeMap<K, V> emptySubRangeMap() {
|
|
return EMPTY_SUB_RANGE_MAP;
|
|
}
|
|
}
|