130 lines
3.5 KiB
Java
130 lines
3.5 KiB
Java
package org.greenrobot.greendao.identityscope;
|
|
|
|
import java.lang.ref.Reference;
|
|
import java.lang.ref.WeakReference;
|
|
import java.util.Iterator;
|
|
import java.util.concurrent.locks.ReentrantLock;
|
|
import org.greenrobot.greendao.internal.LongHashMap;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class IdentityScopeLong<T> implements IdentityScope<Long, T> {
|
|
private final LongHashMap<Reference<T>> a = new LongHashMap<>();
|
|
private final ReentrantLock b = new ReentrantLock();
|
|
|
|
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
|
/* renamed from: b, reason: merged with bridge method [inline-methods] */
|
|
public T a(Long l) {
|
|
return b(l.longValue());
|
|
}
|
|
|
|
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
|
/* renamed from: c, reason: merged with bridge method [inline-methods] */
|
|
public void remove(Long l) {
|
|
this.b.lock();
|
|
try {
|
|
this.a.b(l.longValue());
|
|
} finally {
|
|
this.b.unlock();
|
|
}
|
|
}
|
|
|
|
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
|
public void clear() {
|
|
this.b.lock();
|
|
try {
|
|
this.a.a();
|
|
} finally {
|
|
this.b.unlock();
|
|
}
|
|
}
|
|
|
|
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
|
public void lock() {
|
|
this.b.lock();
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
|
public /* bridge */ /* synthetic */ void put(Long l, Object obj) {
|
|
a2(l, (Long) obj);
|
|
}
|
|
|
|
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
|
public void unlock() {
|
|
this.b.unlock();
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
|
public /* bridge */ /* synthetic */ void a(Long l, Object obj) {
|
|
b(l, (Long) obj);
|
|
}
|
|
|
|
public T b(long j) {
|
|
Reference<T> a = this.a.a(j);
|
|
if (a != null) {
|
|
return a.get();
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
|
/* renamed from: a, reason: avoid collision after fix types in other method and merged with bridge method [inline-methods] */
|
|
public T get(Long l) {
|
|
return a(l.longValue());
|
|
}
|
|
|
|
public T a(long j) {
|
|
this.b.lock();
|
|
try {
|
|
Reference<T> a = this.a.a(j);
|
|
if (a != null) {
|
|
return a.get();
|
|
}
|
|
return null;
|
|
} finally {
|
|
this.b.unlock();
|
|
}
|
|
}
|
|
|
|
public void b(Long l, T t) {
|
|
b(l.longValue(), (long) t);
|
|
}
|
|
|
|
public void b(long j, T t) {
|
|
this.a.a(j, new WeakReference(t));
|
|
}
|
|
|
|
/* renamed from: a, reason: avoid collision after fix types in other method */
|
|
public void a2(Long l, T t) {
|
|
a(l.longValue(), (long) t);
|
|
}
|
|
|
|
public void a(long j, T t) {
|
|
this.b.lock();
|
|
try {
|
|
this.a.a(j, new WeakReference(t));
|
|
} finally {
|
|
this.b.unlock();
|
|
}
|
|
}
|
|
|
|
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
|
public void a(Iterable<Long> iterable) {
|
|
this.b.lock();
|
|
try {
|
|
Iterator<Long> it = iterable.iterator();
|
|
while (it.hasNext()) {
|
|
this.a.b(it.next().longValue());
|
|
}
|
|
} finally {
|
|
this.b.unlock();
|
|
}
|
|
}
|
|
|
|
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
|
public void a(int i) {
|
|
this.a.a(i);
|
|
}
|
|
}
|