1899 lines
72 KiB
Java
1899 lines
72 KiB
Java
package com.google.common.collect;
|
|
|
|
import com.google.common.base.Equivalence;
|
|
import com.google.common.base.Preconditions;
|
|
import com.google.common.collect.MapMakerInternalMap.InternalEntry;
|
|
import com.google.common.collect.MapMakerInternalMap.Segment;
|
|
import com.google.common.primitives.Ints;
|
|
import io.reactivex.internal.disposables.ArrayCompositeDisposable;
|
|
import java.io.IOException;
|
|
import java.io.ObjectInputStream;
|
|
import java.io.ObjectOutputStream;
|
|
import java.io.Serializable;
|
|
import java.lang.ref.Reference;
|
|
import java.lang.ref.ReferenceQueue;
|
|
import java.lang.ref.WeakReference;
|
|
import java.util.AbstractCollection;
|
|
import java.util.AbstractMap;
|
|
import java.util.AbstractSet;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.Iterator;
|
|
import java.util.Map;
|
|
import java.util.NoSuchElementException;
|
|
import java.util.Set;
|
|
import java.util.concurrent.ConcurrentMap;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
import java.util.concurrent.atomic.AtomicReferenceArray;
|
|
import java.util.concurrent.locks.ReentrantLock;
|
|
|
|
/* loaded from: classes.dex */
|
|
class MapMakerInternalMap<K, V, E extends InternalEntry<K, V, E>, S extends Segment<K, V, E, S>> extends AbstractMap<K, V> implements ConcurrentMap<K, V>, Serializable {
|
|
static final WeakValueReference<Object, Object, DummyInternalEntry> j = new WeakValueReference<Object, Object, DummyInternalEntry>() { // from class: com.google.common.collect.MapMakerInternalMap.1
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // com.google.common.collect.MapMakerInternalMap.WeakValueReference
|
|
public DummyInternalEntry a() {
|
|
return null;
|
|
}
|
|
|
|
/* renamed from: a, reason: avoid collision after fix types in other method */
|
|
public WeakValueReference<Object, Object, DummyInternalEntry> a2(ReferenceQueue<Object> referenceQueue, DummyInternalEntry dummyInternalEntry) {
|
|
return this;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.WeakValueReference
|
|
public /* bridge */ /* synthetic */ WeakValueReference<Object, Object, DummyInternalEntry> a(ReferenceQueue<Object> referenceQueue, DummyInternalEntry dummyInternalEntry) {
|
|
a2(referenceQueue, dummyInternalEntry);
|
|
return this;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.WeakValueReference
|
|
public void clear() {
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.WeakValueReference
|
|
public Object get() {
|
|
return null;
|
|
}
|
|
};
|
|
final transient int a;
|
|
final transient int b;
|
|
final transient Segment<K, V, E, S>[] c;
|
|
final int d;
|
|
final Equivalence<Object> e;
|
|
final transient InternalEntryHelper<K, V, E, S> f;
|
|
transient Set<K> g;
|
|
transient Collection<V> h;
|
|
transient Set<Map.Entry<K, V>> i;
|
|
|
|
static abstract class AbstractStrongKeyEntry<K, V, E extends InternalEntry<K, V, E>> implements InternalEntry<K, V, E> {
|
|
final K a;
|
|
final int b;
|
|
final E c;
|
|
|
|
AbstractStrongKeyEntry(K k, int i, E e) {
|
|
this.a = k;
|
|
this.b = i;
|
|
this.c = e;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntry
|
|
public int a() {
|
|
return this.b;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntry
|
|
public K getKey() {
|
|
return this.a;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntry
|
|
public E getNext() {
|
|
return this.c;
|
|
}
|
|
}
|
|
|
|
static abstract class AbstractWeakKeyEntry<K, V, E extends InternalEntry<K, V, E>> extends WeakReference<K> implements InternalEntry<K, V, E> {
|
|
final int a;
|
|
final E b;
|
|
|
|
AbstractWeakKeyEntry(ReferenceQueue<K> referenceQueue, K k, int i, E e) {
|
|
super(k, referenceQueue);
|
|
this.a = i;
|
|
this.b = e;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntry
|
|
public int a() {
|
|
return this.a;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntry
|
|
public K getKey() {
|
|
return get();
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntry
|
|
public E getNext() {
|
|
return this.b;
|
|
}
|
|
}
|
|
|
|
static final class DummyInternalEntry implements InternalEntry<Object, Object, DummyInternalEntry> {
|
|
private DummyInternalEntry() {
|
|
throw new AssertionError();
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntry
|
|
public int a() {
|
|
throw new AssertionError();
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntry
|
|
public Object getKey() {
|
|
throw new AssertionError();
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntry
|
|
public /* bridge */ /* synthetic */ DummyInternalEntry getNext() {
|
|
getNext();
|
|
throw null;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntry
|
|
public Object getValue() {
|
|
throw new AssertionError();
|
|
}
|
|
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntry
|
|
public DummyInternalEntry getNext() {
|
|
throw new AssertionError();
|
|
}
|
|
}
|
|
|
|
final class EntryIterator extends MapMakerInternalMap<K, V, E, S>.HashIterator<Map.Entry<K, V>> {
|
|
EntryIterator(MapMakerInternalMap mapMakerInternalMap) {
|
|
super();
|
|
}
|
|
|
|
@Override // java.util.Iterator
|
|
public Map.Entry<K, V> next() {
|
|
return b();
|
|
}
|
|
}
|
|
|
|
final class EntrySet extends SafeToArraySet<Map.Entry<K, V>> {
|
|
EntrySet() {
|
|
super();
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public void clear() {
|
|
MapMakerInternalMap.this.clear();
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public boolean contains(Object obj) {
|
|
Map.Entry entry;
|
|
Object key;
|
|
Object obj2;
|
|
return (obj instanceof Map.Entry) && (key = (entry = (Map.Entry) obj).getKey()) != null && (obj2 = MapMakerInternalMap.this.get(key)) != null && MapMakerInternalMap.this.a().b(entry.getValue(), obj2);
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public boolean isEmpty() {
|
|
return MapMakerInternalMap.this.isEmpty();
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
|
|
public Iterator<Map.Entry<K, V>> iterator() {
|
|
return new EntryIterator(MapMakerInternalMap.this);
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public boolean remove(Object obj) {
|
|
Map.Entry entry;
|
|
Object key;
|
|
return (obj instanceof Map.Entry) && (key = (entry = (Map.Entry) obj).getKey()) != null && MapMakerInternalMap.this.remove(key, entry.getValue());
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public int size() {
|
|
return MapMakerInternalMap.this.size();
|
|
}
|
|
}
|
|
|
|
interface InternalEntry<K, V, E extends InternalEntry<K, V, E>> {
|
|
int a();
|
|
|
|
K getKey();
|
|
|
|
E getNext();
|
|
|
|
V getValue();
|
|
}
|
|
|
|
interface InternalEntryHelper<K, V, E extends InternalEntry<K, V, E>, S extends Segment<K, V, E, S>> {
|
|
E a(S s, E e, E e2);
|
|
|
|
E a(S s, K k, int i, E e);
|
|
|
|
S a(MapMakerInternalMap<K, V, E, S> mapMakerInternalMap, int i, int i2);
|
|
|
|
Strength a();
|
|
|
|
void a(S s, E e, V v);
|
|
|
|
Strength b();
|
|
}
|
|
|
|
final class KeyIterator extends MapMakerInternalMap<K, V, E, S>.HashIterator<K> {
|
|
KeyIterator(MapMakerInternalMap mapMakerInternalMap) {
|
|
super();
|
|
}
|
|
|
|
@Override // java.util.Iterator
|
|
public K next() {
|
|
return b().getKey();
|
|
}
|
|
}
|
|
|
|
final class KeySet extends SafeToArraySet<K> {
|
|
KeySet() {
|
|
super();
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public void clear() {
|
|
MapMakerInternalMap.this.clear();
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public boolean contains(Object obj) {
|
|
return MapMakerInternalMap.this.containsKey(obj);
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public boolean isEmpty() {
|
|
return MapMakerInternalMap.this.isEmpty();
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
|
|
public Iterator<K> iterator() {
|
|
return new KeyIterator(MapMakerInternalMap.this);
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public boolean remove(Object obj) {
|
|
return MapMakerInternalMap.this.remove(obj) != null;
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public int size() {
|
|
return MapMakerInternalMap.this.size();
|
|
}
|
|
}
|
|
|
|
private static abstract class SafeToArraySet<E> extends AbstractSet<E> {
|
|
private SafeToArraySet() {
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public Object[] toArray() {
|
|
return MapMakerInternalMap.b(this).toArray();
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public <E> E[] toArray(E[] eArr) {
|
|
return (E[]) MapMakerInternalMap.b(this).toArray(eArr);
|
|
}
|
|
}
|
|
|
|
static abstract class Segment<K, V, E extends InternalEntry<K, V, E>, S extends Segment<K, V, E, S>> extends ReentrantLock {
|
|
final MapMakerInternalMap<K, V, E, S> a;
|
|
volatile int b;
|
|
int c;
|
|
int d;
|
|
volatile AtomicReferenceArray<E> e;
|
|
final int f;
|
|
final AtomicInteger g = new AtomicInteger();
|
|
|
|
Segment(MapMakerInternalMap<K, V, E, S> mapMakerInternalMap, int i, int i2) {
|
|
this.a = mapMakerInternalMap;
|
|
this.f = i2;
|
|
a(b(i));
|
|
}
|
|
|
|
void a(E e, V v) {
|
|
this.a.f.a((InternalEntryHelper<K, V, E, S>) i(), (S) e, (E) v);
|
|
}
|
|
|
|
AtomicReferenceArray<E> b(int i) {
|
|
return new AtomicReferenceArray<>(i);
|
|
}
|
|
|
|
void c() {
|
|
}
|
|
|
|
void c(ReferenceQueue<V> referenceQueue) {
|
|
int i = 0;
|
|
do {
|
|
Reference<? extends V> poll = referenceQueue.poll();
|
|
if (poll == null) {
|
|
return;
|
|
}
|
|
this.a.a((WeakValueReference) poll);
|
|
i++;
|
|
} while (i != 16);
|
|
}
|
|
|
|
E d(Object obj, int i) {
|
|
return c(obj, i);
|
|
}
|
|
|
|
void d() {
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
V e(Object obj, int i) {
|
|
lock();
|
|
try {
|
|
f();
|
|
AtomicReferenceArray<E> atomicReferenceArray = this.e;
|
|
int length = (atomicReferenceArray.length() - 1) & i;
|
|
InternalEntry internalEntry = (InternalEntry) atomicReferenceArray.get(length);
|
|
for (InternalEntry internalEntry2 = internalEntry; internalEntry2 != null; internalEntry2 = internalEntry2.getNext()) {
|
|
Object key = internalEntry2.getKey();
|
|
if (internalEntry2.a() == i && key != null && this.a.e.b(obj, key)) {
|
|
V v = (V) internalEntry2.getValue();
|
|
if (v == null && !b(internalEntry2)) {
|
|
return null;
|
|
}
|
|
this.c++;
|
|
InternalEntry b = b(internalEntry, internalEntry2);
|
|
int i2 = this.b - 1;
|
|
atomicReferenceArray.set(length, b);
|
|
this.b = i2;
|
|
return v;
|
|
}
|
|
}
|
|
return null;
|
|
} finally {
|
|
unlock();
|
|
}
|
|
}
|
|
|
|
void f() {
|
|
h();
|
|
}
|
|
|
|
void g() {
|
|
h();
|
|
}
|
|
|
|
void h() {
|
|
if (tryLock()) {
|
|
try {
|
|
d();
|
|
this.g.set(0);
|
|
} finally {
|
|
unlock();
|
|
}
|
|
}
|
|
}
|
|
|
|
abstract S i();
|
|
|
|
void j() {
|
|
if (tryLock()) {
|
|
try {
|
|
d();
|
|
} finally {
|
|
unlock();
|
|
}
|
|
}
|
|
}
|
|
|
|
E a(E e, E e2) {
|
|
return this.a.f.a((InternalEntryHelper<K, V, E, S>) i(), (InternalEntry) e, (InternalEntry) e2);
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
void b(ReferenceQueue<K> referenceQueue) {
|
|
int i = 0;
|
|
do {
|
|
Reference<? extends K> poll = referenceQueue.poll();
|
|
if (poll == null) {
|
|
return;
|
|
}
|
|
this.a.b((MapMakerInternalMap<K, V, E, S>) poll);
|
|
i++;
|
|
} while (i != 16);
|
|
}
|
|
|
|
void a(AtomicReferenceArray<E> atomicReferenceArray) {
|
|
this.d = (atomicReferenceArray.length() * 3) / 4;
|
|
int i = this.d;
|
|
if (i == this.f) {
|
|
this.d = i + 1;
|
|
}
|
|
this.e = atomicReferenceArray;
|
|
}
|
|
|
|
E c(Object obj, int i) {
|
|
if (this.b == 0) {
|
|
return null;
|
|
}
|
|
for (E a = a(i); a != null; a = (E) a.getNext()) {
|
|
if (a.a() == i) {
|
|
Object key = a.getKey();
|
|
if (key == null) {
|
|
j();
|
|
} else if (this.a.e.b(obj, key)) {
|
|
return a;
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
V b(Object obj, int i) {
|
|
try {
|
|
E d = d(obj, i);
|
|
if (d == null) {
|
|
return null;
|
|
}
|
|
V v = (V) d.getValue();
|
|
if (v == null) {
|
|
j();
|
|
}
|
|
return v;
|
|
} finally {
|
|
e();
|
|
}
|
|
}
|
|
|
|
<T> void a(ReferenceQueue<T> referenceQueue) {
|
|
while (referenceQueue.poll() != null) {
|
|
}
|
|
}
|
|
|
|
E a(int i) {
|
|
return this.e.get(i & (r0.length() - 1));
|
|
}
|
|
|
|
boolean a(Object obj, int i) {
|
|
try {
|
|
boolean z = false;
|
|
if (this.b == 0) {
|
|
return false;
|
|
}
|
|
E d = d(obj, i);
|
|
if (d != null) {
|
|
if (d.getValue() != null) {
|
|
z = true;
|
|
}
|
|
}
|
|
return z;
|
|
} finally {
|
|
e();
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
void b() {
|
|
AtomicReferenceArray<E> atomicReferenceArray = this.e;
|
|
int length = atomicReferenceArray.length();
|
|
if (length >= 1073741824) {
|
|
return;
|
|
}
|
|
int i = this.b;
|
|
ArrayCompositeDisposable arrayCompositeDisposable = (AtomicReferenceArray<E>) b(length << 1);
|
|
this.d = (arrayCompositeDisposable.length() * 3) / 4;
|
|
int length2 = arrayCompositeDisposable.length() - 1;
|
|
for (int i2 = 0; i2 < length; i2++) {
|
|
E e = atomicReferenceArray.get(i2);
|
|
if (e != null) {
|
|
InternalEntry next = e.getNext();
|
|
int a = e.a() & length2;
|
|
if (next == null) {
|
|
arrayCompositeDisposable.set(a, e);
|
|
} else {
|
|
InternalEntry internalEntry = e;
|
|
while (next != null) {
|
|
int a2 = next.a() & length2;
|
|
if (a2 != a) {
|
|
internalEntry = next;
|
|
a = a2;
|
|
}
|
|
next = next.getNext();
|
|
}
|
|
arrayCompositeDisposable.set(a, internalEntry);
|
|
while (e != internalEntry) {
|
|
int a3 = e.a() & length2;
|
|
InternalEntry a4 = a(e, (InternalEntry) arrayCompositeDisposable.get(a3));
|
|
if (a4 != null) {
|
|
arrayCompositeDisposable.set(a3, a4);
|
|
} else {
|
|
i--;
|
|
}
|
|
e = e.getNext();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.e = arrayCompositeDisposable;
|
|
this.b = i;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
V a(K k, int i, V v, boolean z) {
|
|
lock();
|
|
try {
|
|
f();
|
|
int i2 = this.b + 1;
|
|
if (i2 > this.d) {
|
|
b();
|
|
i2 = this.b + 1;
|
|
}
|
|
AtomicReferenceArray<E> atomicReferenceArray = this.e;
|
|
int length = (atomicReferenceArray.length() - 1) & i;
|
|
InternalEntry internalEntry = (InternalEntry) atomicReferenceArray.get(length);
|
|
for (InternalEntry internalEntry2 = internalEntry; internalEntry2 != null; internalEntry2 = internalEntry2.getNext()) {
|
|
Object key = internalEntry2.getKey();
|
|
if (internalEntry2.a() == i && key != null && this.a.e.b(k, key)) {
|
|
V v2 = (V) internalEntry2.getValue();
|
|
if (v2 == null) {
|
|
this.c++;
|
|
a((Segment<K, V, E, S>) internalEntry2, (InternalEntry) v);
|
|
this.b = this.b;
|
|
return null;
|
|
}
|
|
if (z) {
|
|
return v2;
|
|
}
|
|
this.c++;
|
|
a((Segment<K, V, E, S>) internalEntry2, (InternalEntry) v);
|
|
return v2;
|
|
}
|
|
}
|
|
this.c++;
|
|
InternalEntry a = this.a.f.a(i(), k, i, internalEntry);
|
|
a((Segment<K, V, E, S>) a, (InternalEntry) v);
|
|
atomicReferenceArray.set(length, a);
|
|
this.b = i2;
|
|
return null;
|
|
} finally {
|
|
unlock();
|
|
}
|
|
}
|
|
|
|
void e() {
|
|
if ((this.g.incrementAndGet() & 63) == 0) {
|
|
g();
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
V b(K k, int i, V v) {
|
|
lock();
|
|
try {
|
|
f();
|
|
AtomicReferenceArray<E> atomicReferenceArray = this.e;
|
|
int length = (atomicReferenceArray.length() - 1) & i;
|
|
InternalEntry internalEntry = (InternalEntry) atomicReferenceArray.get(length);
|
|
for (InternalEntry internalEntry2 = internalEntry; internalEntry2 != null; internalEntry2 = internalEntry2.getNext()) {
|
|
Object key = internalEntry2.getKey();
|
|
if (internalEntry2.a() == i && key != null && this.a.e.b(k, key)) {
|
|
V v2 = (V) internalEntry2.getValue();
|
|
if (v2 == null) {
|
|
if (b(internalEntry2)) {
|
|
this.c++;
|
|
InternalEntry b = b(internalEntry, internalEntry2);
|
|
int i2 = this.b - 1;
|
|
atomicReferenceArray.set(length, b);
|
|
this.b = i2;
|
|
}
|
|
return null;
|
|
}
|
|
this.c++;
|
|
a((Segment<K, V, E, S>) internalEntry2, (InternalEntry) v);
|
|
return v2;
|
|
}
|
|
}
|
|
return null;
|
|
} finally {
|
|
unlock();
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
boolean a(K k, int i, V v, V v2) {
|
|
lock();
|
|
try {
|
|
f();
|
|
AtomicReferenceArray<E> atomicReferenceArray = this.e;
|
|
int length = (atomicReferenceArray.length() - 1) & i;
|
|
InternalEntry internalEntry = (InternalEntry) atomicReferenceArray.get(length);
|
|
for (InternalEntry internalEntry2 = internalEntry; internalEntry2 != null; internalEntry2 = internalEntry2.getNext()) {
|
|
Object key = internalEntry2.getKey();
|
|
if (internalEntry2.a() == i && key != null && this.a.e.b(k, key)) {
|
|
Object value = internalEntry2.getValue();
|
|
if (value == null) {
|
|
if (b(internalEntry2)) {
|
|
this.c++;
|
|
InternalEntry b = b(internalEntry, internalEntry2);
|
|
int i2 = this.b - 1;
|
|
atomicReferenceArray.set(length, b);
|
|
this.b = i2;
|
|
}
|
|
return false;
|
|
}
|
|
if (!this.a.a().b(v, value)) {
|
|
return false;
|
|
}
|
|
this.c++;
|
|
a((Segment<K, V, E, S>) internalEntry2, (InternalEntry) v2);
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
} finally {
|
|
unlock();
|
|
}
|
|
}
|
|
|
|
E b(E e, E e2) {
|
|
int i = this.b;
|
|
E e3 = (E) e2.getNext();
|
|
while (e != e2) {
|
|
E a = a((InternalEntry) e, (InternalEntry) e3);
|
|
if (a != null) {
|
|
e3 = a;
|
|
} else {
|
|
i--;
|
|
}
|
|
e = (E) e.getNext();
|
|
}
|
|
this.b = i;
|
|
return e3;
|
|
}
|
|
|
|
static <K, V, E extends InternalEntry<K, V, E>> boolean b(E e) {
|
|
return e.getValue() == null;
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:13:0x003d, code lost:
|
|
|
|
if (r8.a.a().b(r11, r4.getValue()) == false) goto L14;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:14:0x003f, code lost:
|
|
|
|
r5 = true;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:15:0x0047, code lost:
|
|
|
|
r8.c++;
|
|
r9 = b(r3, r4);
|
|
r10 = r8.b - 1;
|
|
r0.set(r1, r9);
|
|
r8.b = r10;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:17:0x005b, code lost:
|
|
|
|
return r5;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:21:0x0045, code lost:
|
|
|
|
if (b(r4) == false) goto L19;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:23:0x005f, code lost:
|
|
|
|
return false;
|
|
*/
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
|
*/
|
|
boolean a(java.lang.Object r9, int r10, java.lang.Object r11) {
|
|
/*
|
|
r8 = this;
|
|
r8.lock()
|
|
r8.f() // Catch: java.lang.Throwable -> L69
|
|
java.util.concurrent.atomic.AtomicReferenceArray<E extends com.google.common.collect.MapMakerInternalMap$InternalEntry<K, V, E>> r0 = r8.e // Catch: java.lang.Throwable -> L69
|
|
int r1 = r0.length() // Catch: java.lang.Throwable -> L69
|
|
r2 = 1
|
|
int r1 = r1 - r2
|
|
r1 = r1 & r10
|
|
java.lang.Object r3 = r0.get(r1) // Catch: java.lang.Throwable -> L69
|
|
com.google.common.collect.MapMakerInternalMap$InternalEntry r3 = (com.google.common.collect.MapMakerInternalMap.InternalEntry) r3 // Catch: java.lang.Throwable -> L69
|
|
r4 = r3
|
|
L16:
|
|
r5 = 0
|
|
if (r4 == 0) goto L65
|
|
java.lang.Object r6 = r4.getKey() // Catch: java.lang.Throwable -> L69
|
|
int r7 = r4.a() // Catch: java.lang.Throwable -> L69
|
|
if (r7 != r10) goto L60
|
|
if (r6 == 0) goto L60
|
|
com.google.common.collect.MapMakerInternalMap<K, V, E extends com.google.common.collect.MapMakerInternalMap$InternalEntry<K, V, E>, S extends com.google.common.collect.MapMakerInternalMap$Segment<K, V, E, S>> r7 = r8.a // Catch: java.lang.Throwable -> L69
|
|
com.google.common.base.Equivalence<java.lang.Object> r7 = r7.e // Catch: java.lang.Throwable -> L69
|
|
boolean r6 = r7.b(r9, r6) // Catch: java.lang.Throwable -> L69
|
|
if (r6 == 0) goto L60
|
|
java.lang.Object r9 = r4.getValue() // Catch: java.lang.Throwable -> L69
|
|
com.google.common.collect.MapMakerInternalMap<K, V, E extends com.google.common.collect.MapMakerInternalMap$InternalEntry<K, V, E>, S extends com.google.common.collect.MapMakerInternalMap$Segment<K, V, E, S>> r10 = r8.a // Catch: java.lang.Throwable -> L69
|
|
com.google.common.base.Equivalence r10 = r10.a() // Catch: java.lang.Throwable -> L69
|
|
boolean r9 = r10.b(r11, r9) // Catch: java.lang.Throwable -> L69
|
|
if (r9 == 0) goto L41
|
|
r5 = 1
|
|
goto L47
|
|
L41:
|
|
boolean r9 = b(r4) // Catch: java.lang.Throwable -> L69
|
|
if (r9 == 0) goto L5c
|
|
L47:
|
|
int r9 = r8.c // Catch: java.lang.Throwable -> L69
|
|
int r9 = r9 + r2
|
|
r8.c = r9 // Catch: java.lang.Throwable -> L69
|
|
com.google.common.collect.MapMakerInternalMap$InternalEntry r9 = r8.b(r3, r4) // Catch: java.lang.Throwable -> L69
|
|
int r10 = r8.b // Catch: java.lang.Throwable -> L69
|
|
int r10 = r10 - r2
|
|
r0.set(r1, r9) // Catch: java.lang.Throwable -> L69
|
|
r8.b = r10 // Catch: java.lang.Throwable -> L69
|
|
r8.unlock()
|
|
return r5
|
|
L5c:
|
|
r8.unlock()
|
|
return r5
|
|
L60:
|
|
com.google.common.collect.MapMakerInternalMap$InternalEntry r4 = r4.getNext() // Catch: java.lang.Throwable -> L69
|
|
goto L16
|
|
L65:
|
|
r8.unlock()
|
|
return r5
|
|
L69:
|
|
r9 = move-exception
|
|
r8.unlock()
|
|
throw r9
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.google.common.collect.MapMakerInternalMap.Segment.a(java.lang.Object, int, java.lang.Object):boolean");
|
|
}
|
|
|
|
void a() {
|
|
if (this.b != 0) {
|
|
lock();
|
|
try {
|
|
AtomicReferenceArray<E> atomicReferenceArray = this.e;
|
|
for (int i = 0; i < atomicReferenceArray.length(); i++) {
|
|
atomicReferenceArray.set(i, null);
|
|
}
|
|
c();
|
|
this.g.set(0);
|
|
this.c++;
|
|
this.b = 0;
|
|
} finally {
|
|
unlock();
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
boolean a(E e, int i) {
|
|
lock();
|
|
try {
|
|
AtomicReferenceArray<E> atomicReferenceArray = this.e;
|
|
int length = i & (atomicReferenceArray.length() - 1);
|
|
InternalEntry internalEntry = (InternalEntry) atomicReferenceArray.get(length);
|
|
for (InternalEntry internalEntry2 = internalEntry; internalEntry2 != null; internalEntry2 = internalEntry2.getNext()) {
|
|
if (internalEntry2 == e) {
|
|
this.c++;
|
|
InternalEntry b = b(internalEntry, internalEntry2);
|
|
int i2 = this.b - 1;
|
|
atomicReferenceArray.set(length, b);
|
|
this.b = i2;
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
} finally {
|
|
unlock();
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
boolean a(K k, int i, WeakValueReference<K, V, E> weakValueReference) {
|
|
lock();
|
|
try {
|
|
AtomicReferenceArray<E> atomicReferenceArray = this.e;
|
|
int length = (atomicReferenceArray.length() - 1) & i;
|
|
InternalEntry internalEntry = (InternalEntry) atomicReferenceArray.get(length);
|
|
for (InternalEntry internalEntry2 = internalEntry; internalEntry2 != null; internalEntry2 = internalEntry2.getNext()) {
|
|
Object key = internalEntry2.getKey();
|
|
if (internalEntry2.a() == i && key != null && this.a.e.b(k, key)) {
|
|
if (((WeakValueEntry) internalEntry2).b() != weakValueReference) {
|
|
return false;
|
|
}
|
|
this.c++;
|
|
InternalEntry b = b(internalEntry, internalEntry2);
|
|
int i2 = this.b - 1;
|
|
atomicReferenceArray.set(length, b);
|
|
this.b = i2;
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
} finally {
|
|
unlock();
|
|
}
|
|
}
|
|
|
|
V a(E e) {
|
|
if (e.getKey() == null) {
|
|
j();
|
|
return null;
|
|
}
|
|
V v = (V) e.getValue();
|
|
if (v != null) {
|
|
return v;
|
|
}
|
|
j();
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private static final class SerializationProxy<K, V> extends AbstractSerializationProxy<K, V> {
|
|
SerializationProxy(Strength strength, Strength strength2, Equivalence<Object> equivalence, Equivalence<Object> equivalence2, int i, ConcurrentMap<K, V> concurrentMap) {
|
|
super(strength, strength2, equivalence, equivalence2, i, concurrentMap);
|
|
}
|
|
|
|
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
|
|
objectInputStream.defaultReadObject();
|
|
this.e = b(objectInputStream).f();
|
|
a(objectInputStream);
|
|
}
|
|
|
|
private Object readResolve() {
|
|
return this.e;
|
|
}
|
|
|
|
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
|
|
objectOutputStream.defaultWriteObject();
|
|
a(objectOutputStream);
|
|
}
|
|
}
|
|
|
|
enum Strength {
|
|
STRONG { // from class: com.google.common.collect.MapMakerInternalMap.Strength.1
|
|
@Override // com.google.common.collect.MapMakerInternalMap.Strength
|
|
Equivalence<Object> c() {
|
|
return Equivalence.a();
|
|
}
|
|
},
|
|
WEAK { // from class: com.google.common.collect.MapMakerInternalMap.Strength.2
|
|
@Override // com.google.common.collect.MapMakerInternalMap.Strength
|
|
Equivalence<Object> c() {
|
|
return Equivalence.b();
|
|
}
|
|
};
|
|
|
|
abstract Equivalence<Object> c();
|
|
}
|
|
|
|
static final class StrongKeyStrongValueEntry<K, V> extends AbstractStrongKeyEntry<K, V, StrongKeyStrongValueEntry<K, V>> implements StrongValueEntry<K, V, StrongKeyStrongValueEntry<K, V>> {
|
|
private volatile V d;
|
|
|
|
static final class Helper<K, V> implements InternalEntryHelper<K, V, StrongKeyStrongValueEntry<K, V>, StrongKeyStrongValueSegment<K, V>> {
|
|
private static final Helper<?, ?> a = new Helper<>();
|
|
|
|
Helper() {
|
|
}
|
|
|
|
static <K, V> Helper<K, V> c() {
|
|
return (Helper<K, V>) a;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public Strength b() {
|
|
return Strength.STRONG;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public /* bridge */ /* synthetic */ InternalEntry a(Segment segment, Object obj, int i, InternalEntry internalEntry) {
|
|
return a((StrongKeyStrongValueSegment<StrongKeyStrongValueSegment<K, V>, V>) segment, (StrongKeyStrongValueSegment<K, V>) obj, i, (StrongKeyStrongValueEntry<StrongKeyStrongValueSegment<K, V>, V>) internalEntry);
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public /* bridge */ /* synthetic */ void a(Segment segment, InternalEntry internalEntry, Object obj) {
|
|
a((StrongKeyStrongValueSegment<K, StrongKeyStrongValueEntry<K, V>>) segment, (StrongKeyStrongValueEntry<K, StrongKeyStrongValueEntry<K, V>>) internalEntry, (StrongKeyStrongValueEntry<K, V>) obj);
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public Strength a() {
|
|
return Strength.STRONG;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public StrongKeyStrongValueSegment<K, V> a(MapMakerInternalMap<K, V, StrongKeyStrongValueEntry<K, V>, StrongKeyStrongValueSegment<K, V>> mapMakerInternalMap, int i, int i2) {
|
|
return new StrongKeyStrongValueSegment<>(mapMakerInternalMap, i, i2);
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public StrongKeyStrongValueEntry<K, V> a(StrongKeyStrongValueSegment<K, V> strongKeyStrongValueSegment, StrongKeyStrongValueEntry<K, V> strongKeyStrongValueEntry, StrongKeyStrongValueEntry<K, V> strongKeyStrongValueEntry2) {
|
|
return strongKeyStrongValueEntry.a((StrongKeyStrongValueEntry) strongKeyStrongValueEntry2);
|
|
}
|
|
|
|
public void a(StrongKeyStrongValueSegment<K, V> strongKeyStrongValueSegment, StrongKeyStrongValueEntry<K, V> strongKeyStrongValueEntry, V v) {
|
|
strongKeyStrongValueEntry.a((StrongKeyStrongValueEntry<K, V>) v);
|
|
}
|
|
|
|
public StrongKeyStrongValueEntry<K, V> a(StrongKeyStrongValueSegment<K, V> strongKeyStrongValueSegment, K k, int i, StrongKeyStrongValueEntry<K, V> strongKeyStrongValueEntry) {
|
|
return new StrongKeyStrongValueEntry<>(k, i, strongKeyStrongValueEntry);
|
|
}
|
|
}
|
|
|
|
StrongKeyStrongValueEntry(K k, int i, StrongKeyStrongValueEntry<K, V> strongKeyStrongValueEntry) {
|
|
super(k, i, strongKeyStrongValueEntry);
|
|
this.d = null;
|
|
}
|
|
|
|
void a(V v) {
|
|
this.d = v;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntry
|
|
public V getValue() {
|
|
return this.d;
|
|
}
|
|
|
|
StrongKeyStrongValueEntry<K, V> a(StrongKeyStrongValueEntry<K, V> strongKeyStrongValueEntry) {
|
|
StrongKeyStrongValueEntry<K, V> strongKeyStrongValueEntry2 = new StrongKeyStrongValueEntry<>(this.a, this.b, strongKeyStrongValueEntry);
|
|
strongKeyStrongValueEntry2.d = this.d;
|
|
return strongKeyStrongValueEntry2;
|
|
}
|
|
}
|
|
|
|
static final class StrongKeyStrongValueSegment<K, V> extends Segment<K, V, StrongKeyStrongValueEntry<K, V>, StrongKeyStrongValueSegment<K, V>> {
|
|
StrongKeyStrongValueSegment(MapMakerInternalMap<K, V, StrongKeyStrongValueEntry<K, V>, StrongKeyStrongValueSegment<K, V>> mapMakerInternalMap, int i, int i2) {
|
|
super(mapMakerInternalMap, i, i2);
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.Segment
|
|
/* bridge */ /* synthetic */ Segment i() {
|
|
i();
|
|
return this;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.Segment
|
|
StrongKeyStrongValueSegment<K, V> i() {
|
|
return this;
|
|
}
|
|
}
|
|
|
|
static final class StrongKeyWeakValueSegment<K, V> extends Segment<K, V, StrongKeyWeakValueEntry<K, V>, StrongKeyWeakValueSegment<K, V>> {
|
|
private final ReferenceQueue<V> h;
|
|
|
|
StrongKeyWeakValueSegment(MapMakerInternalMap<K, V, StrongKeyWeakValueEntry<K, V>, StrongKeyWeakValueSegment<K, V>> mapMakerInternalMap, int i, int i2) {
|
|
super(mapMakerInternalMap, i, i2);
|
|
this.h = new ReferenceQueue<>();
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.Segment
|
|
void c() {
|
|
a(this.h);
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.Segment
|
|
void d() {
|
|
c(this.h);
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.Segment
|
|
/* bridge */ /* synthetic */ Segment i() {
|
|
i();
|
|
return this;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.Segment
|
|
StrongKeyWeakValueSegment<K, V> i() {
|
|
return this;
|
|
}
|
|
}
|
|
|
|
interface StrongValueEntry<K, V, E extends InternalEntry<K, V, E>> extends InternalEntry<K, V, E> {
|
|
}
|
|
|
|
final class ValueIterator extends MapMakerInternalMap<K, V, E, S>.HashIterator<V> {
|
|
ValueIterator(MapMakerInternalMap mapMakerInternalMap) {
|
|
super();
|
|
}
|
|
|
|
@Override // java.util.Iterator
|
|
public V next() {
|
|
return b().getValue();
|
|
}
|
|
}
|
|
|
|
final class Values extends AbstractCollection<V> {
|
|
Values() {
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection
|
|
public void clear() {
|
|
MapMakerInternalMap.this.clear();
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection
|
|
public boolean contains(Object obj) {
|
|
return MapMakerInternalMap.this.containsValue(obj);
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection
|
|
public boolean isEmpty() {
|
|
return MapMakerInternalMap.this.isEmpty();
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable
|
|
public Iterator<V> iterator() {
|
|
return new ValueIterator(MapMakerInternalMap.this);
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection
|
|
public int size() {
|
|
return MapMakerInternalMap.this.size();
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection
|
|
public Object[] toArray() {
|
|
return MapMakerInternalMap.b(this).toArray();
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection
|
|
public <E> E[] toArray(E[] eArr) {
|
|
return (E[]) MapMakerInternalMap.b(this).toArray(eArr);
|
|
}
|
|
}
|
|
|
|
static final class WeakKeyStrongValueEntry<K, V> extends AbstractWeakKeyEntry<K, V, WeakKeyStrongValueEntry<K, V>> implements StrongValueEntry<K, V, WeakKeyStrongValueEntry<K, V>> {
|
|
private volatile V c;
|
|
|
|
static final class Helper<K, V> implements InternalEntryHelper<K, V, WeakKeyStrongValueEntry<K, V>, WeakKeyStrongValueSegment<K, V>> {
|
|
private static final Helper<?, ?> a = new Helper<>();
|
|
|
|
Helper() {
|
|
}
|
|
|
|
static <K, V> Helper<K, V> c() {
|
|
return (Helper<K, V>) a;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public Strength b() {
|
|
return Strength.STRONG;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public /* bridge */ /* synthetic */ InternalEntry a(Segment segment, Object obj, int i, InternalEntry internalEntry) {
|
|
return a((WeakKeyStrongValueSegment<WeakKeyStrongValueSegment<K, V>, V>) segment, (WeakKeyStrongValueSegment<K, V>) obj, i, (WeakKeyStrongValueEntry<WeakKeyStrongValueSegment<K, V>, V>) internalEntry);
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public /* bridge */ /* synthetic */ void a(Segment segment, InternalEntry internalEntry, Object obj) {
|
|
a((WeakKeyStrongValueSegment<K, WeakKeyStrongValueEntry<K, V>>) segment, (WeakKeyStrongValueEntry<K, WeakKeyStrongValueEntry<K, V>>) internalEntry, (WeakKeyStrongValueEntry<K, V>) obj);
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public Strength a() {
|
|
return Strength.WEAK;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public WeakKeyStrongValueSegment<K, V> a(MapMakerInternalMap<K, V, WeakKeyStrongValueEntry<K, V>, WeakKeyStrongValueSegment<K, V>> mapMakerInternalMap, int i, int i2) {
|
|
return new WeakKeyStrongValueSegment<>(mapMakerInternalMap, i, i2);
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public WeakKeyStrongValueEntry<K, V> a(WeakKeyStrongValueSegment<K, V> weakKeyStrongValueSegment, WeakKeyStrongValueEntry<K, V> weakKeyStrongValueEntry, WeakKeyStrongValueEntry<K, V> weakKeyStrongValueEntry2) {
|
|
if (weakKeyStrongValueEntry.getKey() == null) {
|
|
return null;
|
|
}
|
|
return weakKeyStrongValueEntry.a(((WeakKeyStrongValueSegment) weakKeyStrongValueSegment).h, weakKeyStrongValueEntry2);
|
|
}
|
|
|
|
public void a(WeakKeyStrongValueSegment<K, V> weakKeyStrongValueSegment, WeakKeyStrongValueEntry<K, V> weakKeyStrongValueEntry, V v) {
|
|
weakKeyStrongValueEntry.a(v);
|
|
}
|
|
|
|
public WeakKeyStrongValueEntry<K, V> a(WeakKeyStrongValueSegment<K, V> weakKeyStrongValueSegment, K k, int i, WeakKeyStrongValueEntry<K, V> weakKeyStrongValueEntry) {
|
|
return new WeakKeyStrongValueEntry<>(((WeakKeyStrongValueSegment) weakKeyStrongValueSegment).h, k, i, weakKeyStrongValueEntry);
|
|
}
|
|
}
|
|
|
|
WeakKeyStrongValueEntry(ReferenceQueue<K> referenceQueue, K k, int i, WeakKeyStrongValueEntry<K, V> weakKeyStrongValueEntry) {
|
|
super(referenceQueue, k, i, weakKeyStrongValueEntry);
|
|
this.c = null;
|
|
}
|
|
|
|
void a(V v) {
|
|
this.c = v;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntry
|
|
public V getValue() {
|
|
return this.c;
|
|
}
|
|
|
|
WeakKeyStrongValueEntry<K, V> a(ReferenceQueue<K> referenceQueue, WeakKeyStrongValueEntry<K, V> weakKeyStrongValueEntry) {
|
|
WeakKeyStrongValueEntry<K, V> weakKeyStrongValueEntry2 = new WeakKeyStrongValueEntry<>(referenceQueue, getKey(), this.a, weakKeyStrongValueEntry);
|
|
weakKeyStrongValueEntry2.a(this.c);
|
|
return weakKeyStrongValueEntry2;
|
|
}
|
|
}
|
|
|
|
static final class WeakKeyStrongValueSegment<K, V> extends Segment<K, V, WeakKeyStrongValueEntry<K, V>, WeakKeyStrongValueSegment<K, V>> {
|
|
private final ReferenceQueue<K> h;
|
|
|
|
WeakKeyStrongValueSegment(MapMakerInternalMap<K, V, WeakKeyStrongValueEntry<K, V>, WeakKeyStrongValueSegment<K, V>> mapMakerInternalMap, int i, int i2) {
|
|
super(mapMakerInternalMap, i, i2);
|
|
this.h = new ReferenceQueue<>();
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.Segment
|
|
void c() {
|
|
a(this.h);
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.Segment
|
|
void d() {
|
|
b(this.h);
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.Segment
|
|
/* bridge */ /* synthetic */ Segment i() {
|
|
i();
|
|
return this;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.Segment
|
|
WeakKeyStrongValueSegment<K, V> i() {
|
|
return this;
|
|
}
|
|
}
|
|
|
|
static final class WeakKeyWeakValueSegment<K, V> extends Segment<K, V, WeakKeyWeakValueEntry<K, V>, WeakKeyWeakValueSegment<K, V>> {
|
|
private final ReferenceQueue<K> h;
|
|
private final ReferenceQueue<V> i;
|
|
|
|
WeakKeyWeakValueSegment(MapMakerInternalMap<K, V, WeakKeyWeakValueEntry<K, V>, WeakKeyWeakValueSegment<K, V>> mapMakerInternalMap, int i, int i2) {
|
|
super(mapMakerInternalMap, i, i2);
|
|
this.h = new ReferenceQueue<>();
|
|
this.i = new ReferenceQueue<>();
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.Segment
|
|
void c() {
|
|
a(this.h);
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.Segment
|
|
void d() {
|
|
b(this.h);
|
|
c(this.i);
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.Segment
|
|
/* bridge */ /* synthetic */ Segment i() {
|
|
i();
|
|
return this;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.Segment
|
|
WeakKeyWeakValueSegment<K, V> i() {
|
|
return this;
|
|
}
|
|
}
|
|
|
|
interface WeakValueEntry<K, V, E extends InternalEntry<K, V, E>> extends InternalEntry<K, V, E> {
|
|
WeakValueReference<K, V, E> b();
|
|
}
|
|
|
|
interface WeakValueReference<K, V, E extends InternalEntry<K, V, E>> {
|
|
E a();
|
|
|
|
WeakValueReference<K, V, E> a(ReferenceQueue<V> referenceQueue, E e);
|
|
|
|
void clear();
|
|
|
|
V get();
|
|
}
|
|
|
|
static final class WeakValueReferenceImpl<K, V, E extends InternalEntry<K, V, E>> extends WeakReference<V> implements WeakValueReference<K, V, E> {
|
|
final E a;
|
|
|
|
WeakValueReferenceImpl(ReferenceQueue<V> referenceQueue, V v, E e) {
|
|
super(v, referenceQueue);
|
|
this.a = e;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.WeakValueReference
|
|
public E a() {
|
|
return this.a;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.WeakValueReference
|
|
public WeakValueReference<K, V, E> a(ReferenceQueue<V> referenceQueue, E e) {
|
|
return new WeakValueReferenceImpl(referenceQueue, get(), e);
|
|
}
|
|
}
|
|
|
|
final class WriteThroughEntry extends AbstractMapEntry<K, V> {
|
|
final K a;
|
|
V b;
|
|
|
|
WriteThroughEntry(K k, V v) {
|
|
this.a = k;
|
|
this.b = v;
|
|
}
|
|
|
|
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
|
|
public boolean equals(Object obj) {
|
|
if (!(obj instanceof Map.Entry)) {
|
|
return false;
|
|
}
|
|
Map.Entry entry = (Map.Entry) obj;
|
|
return this.a.equals(entry.getKey()) && this.b.equals(entry.getValue());
|
|
}
|
|
|
|
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
|
|
public K getKey() {
|
|
return this.a;
|
|
}
|
|
|
|
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
|
|
public V getValue() {
|
|
return this.b;
|
|
}
|
|
|
|
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
|
|
public int hashCode() {
|
|
return this.a.hashCode() ^ this.b.hashCode();
|
|
}
|
|
|
|
@Override // com.google.common.collect.AbstractMapEntry, java.util.Map.Entry
|
|
public V setValue(V v) {
|
|
V v2 = (V) MapMakerInternalMap.this.put(this.a, v);
|
|
this.b = v;
|
|
return v2;
|
|
}
|
|
}
|
|
|
|
private MapMakerInternalMap(MapMaker mapMaker, InternalEntryHelper<K, V, E, S> internalEntryHelper) {
|
|
this.d = Math.min(mapMaker.a(), 65536);
|
|
this.e = mapMaker.c();
|
|
this.f = internalEntryHelper;
|
|
int min = Math.min(mapMaker.b(), 1073741824);
|
|
int i = 0;
|
|
int i2 = 1;
|
|
int i3 = 1;
|
|
int i4 = 0;
|
|
while (i3 < this.d) {
|
|
i4++;
|
|
i3 <<= 1;
|
|
}
|
|
this.b = 32 - i4;
|
|
this.a = i3 - 1;
|
|
this.c = a(i3);
|
|
int i5 = min / i3;
|
|
while (i2 < (i3 * i5 < min ? i5 + 1 : i5)) {
|
|
i2 <<= 1;
|
|
}
|
|
while (true) {
|
|
Segment<K, V, E, S>[] segmentArr = this.c;
|
|
if (i >= segmentArr.length) {
|
|
return;
|
|
}
|
|
segmentArr[i] = a(i2, -1);
|
|
i++;
|
|
}
|
|
}
|
|
|
|
static <K, V, E extends InternalEntry<K, V, E>> WeakValueReference<K, V, E> b() {
|
|
return (WeakValueReference<K, V, E>) j;
|
|
}
|
|
|
|
static int c(int i) {
|
|
int i2 = i + ((i << 15) ^ (-12931));
|
|
int i3 = i2 ^ (i2 >>> 10);
|
|
int i4 = i3 + (i3 << 3);
|
|
int i5 = i4 ^ (i4 >>> 6);
|
|
int i6 = i5 + (i5 << 2) + (i5 << 14);
|
|
return i6 ^ (i6 >>> 16);
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public void clear() {
|
|
for (Segment<K, V, E, S> segment : this.c) {
|
|
segment.a();
|
|
}
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public boolean containsKey(Object obj) {
|
|
if (obj == null) {
|
|
return false;
|
|
}
|
|
int a = a(obj);
|
|
return b(a).a(obj, a);
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public boolean containsValue(Object obj) {
|
|
if (obj == null) {
|
|
return false;
|
|
}
|
|
Segment<K, V, E, S>[] segmentArr = this.c;
|
|
long j2 = -1;
|
|
int i = 0;
|
|
while (i < 3) {
|
|
long j3 = 0;
|
|
for (StrongKeyStrongValueSegment strongKeyStrongValueSegment : segmentArr) {
|
|
int i2 = strongKeyStrongValueSegment.b;
|
|
AtomicReferenceArray<E> atomicReferenceArray = strongKeyStrongValueSegment.e;
|
|
for (int i3 = 0; i3 < atomicReferenceArray.length(); i3++) {
|
|
for (E e = atomicReferenceArray.get(i3); e != null; e = e.getNext()) {
|
|
Object a = strongKeyStrongValueSegment.a((StrongKeyStrongValueSegment) e);
|
|
if (a != null && a().b(obj, a)) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
j3 += strongKeyStrongValueSegment.c;
|
|
}
|
|
if (j3 == j2) {
|
|
return false;
|
|
}
|
|
i++;
|
|
j2 = j3;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public Set<Map.Entry<K, V>> entrySet() {
|
|
Set<Map.Entry<K, V>> set = this.i;
|
|
if (set != null) {
|
|
return set;
|
|
}
|
|
EntrySet entrySet = new EntrySet();
|
|
this.i = entrySet;
|
|
return entrySet;
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public V get(Object obj) {
|
|
if (obj == null) {
|
|
return null;
|
|
}
|
|
int a = a(obj);
|
|
return b(a).b(obj, a);
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public boolean isEmpty() {
|
|
Segment<K, V, E, S>[] segmentArr = this.c;
|
|
long j2 = 0;
|
|
for (int i = 0; i < segmentArr.length; i++) {
|
|
if (segmentArr[i].b != 0) {
|
|
return false;
|
|
}
|
|
j2 += segmentArr[i].c;
|
|
}
|
|
if (j2 == 0) {
|
|
return true;
|
|
}
|
|
for (int i2 = 0; i2 < segmentArr.length; i2++) {
|
|
if (segmentArr[i2].b != 0) {
|
|
return false;
|
|
}
|
|
j2 -= segmentArr[i2].c;
|
|
}
|
|
return j2 == 0;
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public Set<K> keySet() {
|
|
Set<K> set = this.g;
|
|
if (set != null) {
|
|
return set;
|
|
}
|
|
KeySet keySet = new KeySet();
|
|
this.g = keySet;
|
|
return keySet;
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public V put(K k, V v) {
|
|
Preconditions.a(k);
|
|
Preconditions.a(v);
|
|
int a = a(k);
|
|
return b(a).a((Segment<K, V, E, S>) k, a, (int) v, false);
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public void putAll(Map<? extends K, ? extends V> map) {
|
|
for (Map.Entry<? extends K, ? extends V> entry : map.entrySet()) {
|
|
put(entry.getKey(), entry.getValue());
|
|
}
|
|
}
|
|
|
|
@Override // java.util.Map, java.util.concurrent.ConcurrentMap
|
|
public V putIfAbsent(K k, V v) {
|
|
Preconditions.a(k);
|
|
Preconditions.a(v);
|
|
int a = a(k);
|
|
return b(a).a((Segment<K, V, E, S>) k, a, (int) v, true);
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public V remove(Object obj) {
|
|
if (obj == null) {
|
|
return null;
|
|
}
|
|
int a = a(obj);
|
|
return b(a).e(obj, a);
|
|
}
|
|
|
|
@Override // java.util.Map, java.util.concurrent.ConcurrentMap
|
|
public boolean replace(K k, V v, V v2) {
|
|
Preconditions.a(k);
|
|
Preconditions.a(v2);
|
|
if (v == null) {
|
|
return false;
|
|
}
|
|
int a = a(k);
|
|
return b(a).a((Segment<K, V, E, S>) k, a, v, v2);
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public int size() {
|
|
long j2 = 0;
|
|
for (int i = 0; i < this.c.length; i++) {
|
|
j2 += r0[i].b;
|
|
}
|
|
return Ints.b(j2);
|
|
}
|
|
|
|
@Override // java.util.AbstractMap, java.util.Map
|
|
public Collection<V> values() {
|
|
Collection<V> collection = this.h;
|
|
if (collection != null) {
|
|
return collection;
|
|
}
|
|
Values values = new Values();
|
|
this.h = values;
|
|
return values;
|
|
}
|
|
|
|
Object writeReplace() {
|
|
return new SerializationProxy(this.f.a(), this.f.b(), this.e, this.f.b().c(), this.d, this);
|
|
}
|
|
|
|
static abstract class AbstractSerializationProxy<K, V> extends ForwardingConcurrentMap<K, V> implements Serializable {
|
|
final Strength a;
|
|
final Strength b;
|
|
final Equivalence<Object> c;
|
|
final int d;
|
|
transient ConcurrentMap<K, V> e;
|
|
|
|
AbstractSerializationProxy(Strength strength, Strength strength2, Equivalence<Object> equivalence, Equivalence<Object> equivalence2, int i, ConcurrentMap<K, V> concurrentMap) {
|
|
this.a = strength;
|
|
this.b = strength2;
|
|
this.c = equivalence;
|
|
this.d = i;
|
|
this.e = concurrentMap;
|
|
}
|
|
|
|
void a(ObjectOutputStream objectOutputStream) throws IOException {
|
|
objectOutputStream.writeInt(this.e.size());
|
|
for (Map.Entry<K, V> entry : this.e.entrySet()) {
|
|
objectOutputStream.writeObject(entry.getKey());
|
|
objectOutputStream.writeObject(entry.getValue());
|
|
}
|
|
objectOutputStream.writeObject(null);
|
|
}
|
|
|
|
MapMaker b(ObjectInputStream objectInputStream) throws IOException {
|
|
int readInt = objectInputStream.readInt();
|
|
MapMaker mapMaker = new MapMaker();
|
|
mapMaker.b(readInt);
|
|
mapMaker.a(this.a);
|
|
mapMaker.b(this.b);
|
|
mapMaker.a(this.c);
|
|
mapMaker.a(this.d);
|
|
return mapMaker;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
@Override // com.google.common.collect.ForwardingMap, com.google.common.collect.ForwardingObject
|
|
public ConcurrentMap<K, V> delegate() {
|
|
return this.e;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
void a(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
|
|
while (true) {
|
|
Object readObject = objectInputStream.readObject();
|
|
if (readObject == null) {
|
|
return;
|
|
}
|
|
this.e.put(readObject, objectInputStream.readObject());
|
|
}
|
|
}
|
|
}
|
|
|
|
static <K, V> MapMakerInternalMap<K, V, ? extends InternalEntry<K, V, ?>, ?> a(MapMaker mapMaker) {
|
|
if (mapMaker.d() == Strength.STRONG && mapMaker.e() == Strength.STRONG) {
|
|
return new MapMakerInternalMap<>(mapMaker, StrongKeyStrongValueEntry.Helper.c());
|
|
}
|
|
if (mapMaker.d() == Strength.STRONG && mapMaker.e() == Strength.WEAK) {
|
|
return new MapMakerInternalMap<>(mapMaker, StrongKeyWeakValueEntry.Helper.c());
|
|
}
|
|
if (mapMaker.d() == Strength.WEAK && mapMaker.e() == Strength.STRONG) {
|
|
return new MapMakerInternalMap<>(mapMaker, WeakKeyStrongValueEntry.Helper.c());
|
|
}
|
|
if (mapMaker.d() == Strength.WEAK && mapMaker.e() == Strength.WEAK) {
|
|
return new MapMakerInternalMap<>(mapMaker, WeakKeyWeakValueEntry.Helper.c());
|
|
}
|
|
throw new AssertionError();
|
|
}
|
|
|
|
void b(E e) {
|
|
int a = e.a();
|
|
b(a).a((Segment<K, V, E, S>) e, a);
|
|
}
|
|
|
|
static final class StrongKeyWeakValueEntry<K, V> extends AbstractStrongKeyEntry<K, V, StrongKeyWeakValueEntry<K, V>> implements WeakValueEntry<K, V, StrongKeyWeakValueEntry<K, V>> {
|
|
private volatile WeakValueReference<K, V, StrongKeyWeakValueEntry<K, V>> d;
|
|
|
|
static final class Helper<K, V> implements InternalEntryHelper<K, V, StrongKeyWeakValueEntry<K, V>, StrongKeyWeakValueSegment<K, V>> {
|
|
private static final Helper<?, ?> a = new Helper<>();
|
|
|
|
Helper() {
|
|
}
|
|
|
|
static <K, V> Helper<K, V> c() {
|
|
return (Helper<K, V>) a;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public Strength b() {
|
|
return Strength.WEAK;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public /* bridge */ /* synthetic */ InternalEntry a(Segment segment, Object obj, int i, InternalEntry internalEntry) {
|
|
return a((StrongKeyWeakValueSegment<StrongKeyWeakValueSegment<K, V>, V>) segment, (StrongKeyWeakValueSegment<K, V>) obj, i, (StrongKeyWeakValueEntry<StrongKeyWeakValueSegment<K, V>, V>) internalEntry);
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public /* bridge */ /* synthetic */ void a(Segment segment, InternalEntry internalEntry, Object obj) {
|
|
a((StrongKeyWeakValueSegment<K, StrongKeyWeakValueEntry<K, V>>) segment, (StrongKeyWeakValueEntry<K, StrongKeyWeakValueEntry<K, V>>) internalEntry, (StrongKeyWeakValueEntry<K, V>) obj);
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public Strength a() {
|
|
return Strength.STRONG;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public StrongKeyWeakValueSegment<K, V> a(MapMakerInternalMap<K, V, StrongKeyWeakValueEntry<K, V>, StrongKeyWeakValueSegment<K, V>> mapMakerInternalMap, int i, int i2) {
|
|
return new StrongKeyWeakValueSegment<>(mapMakerInternalMap, i, i2);
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public StrongKeyWeakValueEntry<K, V> a(StrongKeyWeakValueSegment<K, V> strongKeyWeakValueSegment, StrongKeyWeakValueEntry<K, V> strongKeyWeakValueEntry, StrongKeyWeakValueEntry<K, V> strongKeyWeakValueEntry2) {
|
|
if (Segment.b(strongKeyWeakValueEntry)) {
|
|
return null;
|
|
}
|
|
return strongKeyWeakValueEntry.a(((StrongKeyWeakValueSegment) strongKeyWeakValueSegment).h, strongKeyWeakValueEntry2);
|
|
}
|
|
|
|
public void a(StrongKeyWeakValueSegment<K, V> strongKeyWeakValueSegment, StrongKeyWeakValueEntry<K, V> strongKeyWeakValueEntry, V v) {
|
|
strongKeyWeakValueEntry.a((StrongKeyWeakValueEntry<K, V>) v, (ReferenceQueue<StrongKeyWeakValueEntry<K, V>>) ((StrongKeyWeakValueSegment) strongKeyWeakValueSegment).h);
|
|
}
|
|
|
|
public StrongKeyWeakValueEntry<K, V> a(StrongKeyWeakValueSegment<K, V> strongKeyWeakValueSegment, K k, int i, StrongKeyWeakValueEntry<K, V> strongKeyWeakValueEntry) {
|
|
return new StrongKeyWeakValueEntry<>(k, i, strongKeyWeakValueEntry);
|
|
}
|
|
}
|
|
|
|
StrongKeyWeakValueEntry(K k, int i, StrongKeyWeakValueEntry<K, V> strongKeyWeakValueEntry) {
|
|
super(k, i, strongKeyWeakValueEntry);
|
|
this.d = MapMakerInternalMap.b();
|
|
}
|
|
|
|
void a(V v, ReferenceQueue<V> referenceQueue) {
|
|
WeakValueReference<K, V, StrongKeyWeakValueEntry<K, V>> weakValueReference = this.d;
|
|
this.d = new WeakValueReferenceImpl(referenceQueue, v, this);
|
|
weakValueReference.clear();
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.WeakValueEntry
|
|
public WeakValueReference<K, V, StrongKeyWeakValueEntry<K, V>> b() {
|
|
return this.d;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntry
|
|
public V getValue() {
|
|
return this.d.get();
|
|
}
|
|
|
|
StrongKeyWeakValueEntry<K, V> a(ReferenceQueue<V> referenceQueue, StrongKeyWeakValueEntry<K, V> strongKeyWeakValueEntry) {
|
|
StrongKeyWeakValueEntry<K, V> strongKeyWeakValueEntry2 = new StrongKeyWeakValueEntry<>(this.a, this.b, strongKeyWeakValueEntry);
|
|
strongKeyWeakValueEntry2.d = this.d.a(referenceQueue, strongKeyWeakValueEntry2);
|
|
return strongKeyWeakValueEntry2;
|
|
}
|
|
}
|
|
|
|
static final class WeakKeyWeakValueEntry<K, V> extends AbstractWeakKeyEntry<K, V, WeakKeyWeakValueEntry<K, V>> implements WeakValueEntry<K, V, WeakKeyWeakValueEntry<K, V>> {
|
|
private volatile WeakValueReference<K, V, WeakKeyWeakValueEntry<K, V>> c;
|
|
|
|
static final class Helper<K, V> implements InternalEntryHelper<K, V, WeakKeyWeakValueEntry<K, V>, WeakKeyWeakValueSegment<K, V>> {
|
|
private static final Helper<?, ?> a = new Helper<>();
|
|
|
|
Helper() {
|
|
}
|
|
|
|
static <K, V> Helper<K, V> c() {
|
|
return (Helper<K, V>) a;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public Strength b() {
|
|
return Strength.WEAK;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public /* bridge */ /* synthetic */ InternalEntry a(Segment segment, Object obj, int i, InternalEntry internalEntry) {
|
|
return a((WeakKeyWeakValueSegment<WeakKeyWeakValueSegment<K, V>, V>) segment, (WeakKeyWeakValueSegment<K, V>) obj, i, (WeakKeyWeakValueEntry<WeakKeyWeakValueSegment<K, V>, V>) internalEntry);
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public /* bridge */ /* synthetic */ void a(Segment segment, InternalEntry internalEntry, Object obj) {
|
|
a((WeakKeyWeakValueSegment<K, WeakKeyWeakValueEntry<K, V>>) segment, (WeakKeyWeakValueEntry<K, WeakKeyWeakValueEntry<K, V>>) internalEntry, (WeakKeyWeakValueEntry<K, V>) obj);
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public Strength a() {
|
|
return Strength.WEAK;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public WeakKeyWeakValueSegment<K, V> a(MapMakerInternalMap<K, V, WeakKeyWeakValueEntry<K, V>, WeakKeyWeakValueSegment<K, V>> mapMakerInternalMap, int i, int i2) {
|
|
return new WeakKeyWeakValueSegment<>(mapMakerInternalMap, i, i2);
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntryHelper
|
|
public WeakKeyWeakValueEntry<K, V> a(WeakKeyWeakValueSegment<K, V> weakKeyWeakValueSegment, WeakKeyWeakValueEntry<K, V> weakKeyWeakValueEntry, WeakKeyWeakValueEntry<K, V> weakKeyWeakValueEntry2) {
|
|
if (weakKeyWeakValueEntry.getKey() == null || Segment.b(weakKeyWeakValueEntry)) {
|
|
return null;
|
|
}
|
|
return weakKeyWeakValueEntry.a(((WeakKeyWeakValueSegment) weakKeyWeakValueSegment).h, ((WeakKeyWeakValueSegment) weakKeyWeakValueSegment).i, weakKeyWeakValueEntry2);
|
|
}
|
|
|
|
public void a(WeakKeyWeakValueSegment<K, V> weakKeyWeakValueSegment, WeakKeyWeakValueEntry<K, V> weakKeyWeakValueEntry, V v) {
|
|
weakKeyWeakValueEntry.a(v, ((WeakKeyWeakValueSegment) weakKeyWeakValueSegment).i);
|
|
}
|
|
|
|
public WeakKeyWeakValueEntry<K, V> a(WeakKeyWeakValueSegment<K, V> weakKeyWeakValueSegment, K k, int i, WeakKeyWeakValueEntry<K, V> weakKeyWeakValueEntry) {
|
|
return new WeakKeyWeakValueEntry<>(((WeakKeyWeakValueSegment) weakKeyWeakValueSegment).h, k, i, weakKeyWeakValueEntry);
|
|
}
|
|
}
|
|
|
|
WeakKeyWeakValueEntry(ReferenceQueue<K> referenceQueue, K k, int i, WeakKeyWeakValueEntry<K, V> weakKeyWeakValueEntry) {
|
|
super(referenceQueue, k, i, weakKeyWeakValueEntry);
|
|
this.c = MapMakerInternalMap.b();
|
|
}
|
|
|
|
WeakKeyWeakValueEntry<K, V> a(ReferenceQueue<K> referenceQueue, ReferenceQueue<V> referenceQueue2, WeakKeyWeakValueEntry<K, V> weakKeyWeakValueEntry) {
|
|
WeakKeyWeakValueEntry<K, V> weakKeyWeakValueEntry2 = new WeakKeyWeakValueEntry<>(referenceQueue, getKey(), this.a, weakKeyWeakValueEntry);
|
|
weakKeyWeakValueEntry2.c = this.c.a(referenceQueue2, weakKeyWeakValueEntry2);
|
|
return weakKeyWeakValueEntry2;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.WeakValueEntry
|
|
public WeakValueReference<K, V, WeakKeyWeakValueEntry<K, V>> b() {
|
|
return this.c;
|
|
}
|
|
|
|
@Override // com.google.common.collect.MapMakerInternalMap.InternalEntry
|
|
public V getValue() {
|
|
return this.c.get();
|
|
}
|
|
|
|
void a(V v, ReferenceQueue<V> referenceQueue) {
|
|
WeakValueReference<K, V, WeakKeyWeakValueEntry<K, V>> weakValueReference = this.c;
|
|
this.c = new WeakValueReferenceImpl(referenceQueue, v, this);
|
|
weakValueReference.clear();
|
|
}
|
|
}
|
|
|
|
@Override // java.util.Map, java.util.concurrent.ConcurrentMap
|
|
public boolean remove(Object obj, Object obj2) {
|
|
if (obj == null || obj2 == null) {
|
|
return false;
|
|
}
|
|
int a = a(obj);
|
|
return b(a).a(obj, a, obj2);
|
|
}
|
|
|
|
Segment<K, V, E, S> b(int i) {
|
|
return this.c[(i >>> this.b) & this.a];
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static <E> ArrayList<E> b(Collection<E> collection) {
|
|
ArrayList<E> arrayList = new ArrayList<>(collection.size());
|
|
Iterators.a(arrayList, collection.iterator());
|
|
return arrayList;
|
|
}
|
|
|
|
@Override // java.util.Map, java.util.concurrent.ConcurrentMap
|
|
public V replace(K k, V v) {
|
|
Preconditions.a(k);
|
|
Preconditions.a(v);
|
|
int a = a(k);
|
|
return b(a).b(k, a, v);
|
|
}
|
|
|
|
abstract class HashIterator<T> implements Iterator<T> {
|
|
int a;
|
|
int b = -1;
|
|
Segment<K, V, E, S> c;
|
|
AtomicReferenceArray<E> d;
|
|
E e;
|
|
MapMakerInternalMap<K, V, E, S>.WriteThroughEntry f;
|
|
MapMakerInternalMap<K, V, E, S>.WriteThroughEntry g;
|
|
|
|
HashIterator() {
|
|
this.a = MapMakerInternalMap.this.c.length - 1;
|
|
a();
|
|
}
|
|
|
|
final void a() {
|
|
this.f = null;
|
|
if (c() || d()) {
|
|
return;
|
|
}
|
|
while (true) {
|
|
int i = this.a;
|
|
if (i < 0) {
|
|
return;
|
|
}
|
|
Segment<K, V, E, S>[] segmentArr = MapMakerInternalMap.this.c;
|
|
this.a = i - 1;
|
|
this.c = segmentArr[i];
|
|
if (this.c.b != 0) {
|
|
this.d = this.c.e;
|
|
this.b = this.d.length() - 1;
|
|
if (d()) {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
MapMakerInternalMap<K, V, E, S>.WriteThroughEntry b() {
|
|
MapMakerInternalMap<K, V, E, S>.WriteThroughEntry writeThroughEntry = this.f;
|
|
if (writeThroughEntry == null) {
|
|
throw new NoSuchElementException();
|
|
}
|
|
this.g = writeThroughEntry;
|
|
a();
|
|
return this.g;
|
|
}
|
|
|
|
boolean c() {
|
|
E e = this.e;
|
|
if (e == null) {
|
|
return false;
|
|
}
|
|
while (true) {
|
|
this.e = (E) e.getNext();
|
|
E e2 = this.e;
|
|
if (e2 == null) {
|
|
return false;
|
|
}
|
|
if (a(e2)) {
|
|
return true;
|
|
}
|
|
e = this.e;
|
|
}
|
|
}
|
|
|
|
boolean d() {
|
|
while (true) {
|
|
int i = this.b;
|
|
if (i < 0) {
|
|
return false;
|
|
}
|
|
AtomicReferenceArray<E> atomicReferenceArray = this.d;
|
|
this.b = i - 1;
|
|
E e = atomicReferenceArray.get(i);
|
|
this.e = e;
|
|
if (e != null && (a(this.e) || c())) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // java.util.Iterator
|
|
public boolean hasNext() {
|
|
return this.f != null;
|
|
}
|
|
|
|
@Override // java.util.Iterator
|
|
public void remove() {
|
|
CollectPreconditions.a(this.g != null);
|
|
MapMakerInternalMap.this.remove(this.g.getKey());
|
|
this.g = null;
|
|
}
|
|
|
|
boolean a(E e) {
|
|
boolean z;
|
|
try {
|
|
Object key = e.getKey();
|
|
Object a = MapMakerInternalMap.this.a((MapMakerInternalMap) e);
|
|
if (a != null) {
|
|
this.f = new WriteThroughEntry(key, a);
|
|
z = true;
|
|
} else {
|
|
z = false;
|
|
}
|
|
return z;
|
|
} finally {
|
|
this.c.e();
|
|
}
|
|
}
|
|
}
|
|
|
|
int a(Object obj) {
|
|
return c(this.e.b(obj));
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
void a(WeakValueReference<K, V, E> weakValueReference) {
|
|
E a = weakValueReference.a();
|
|
int a2 = a.a();
|
|
b(a2).a((Segment<K, V, E, S>) a.getKey(), a2, (WeakValueReference<Segment<K, V, E, S>, V, E>) weakValueReference);
|
|
}
|
|
|
|
Segment<K, V, E, S> a(int i, int i2) {
|
|
return this.f.a(this, i, i2);
|
|
}
|
|
|
|
V a(E e) {
|
|
V v;
|
|
if (e.getKey() == null || (v = (V) e.getValue()) == null) {
|
|
return null;
|
|
}
|
|
return v;
|
|
}
|
|
|
|
final Segment<K, V, E, S>[] a(int i) {
|
|
return new Segment[i];
|
|
}
|
|
|
|
Equivalence<Object> a() {
|
|
return this.f.b().c();
|
|
}
|
|
}
|