You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

159 lines
4.3 KiB

package p037m;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
/* renamed from: m.e */
/* loaded from: classes.dex */
public class C1450e<K, V> {
/* renamed from: a */
public final LinkedHashMap<K, V> f3170a;
/* renamed from: b */
public int f3171b;
/* renamed from: c */
public int f3172c;
/* renamed from: d */
public int f3173d;
/* renamed from: e */
public int f3174e;
/* renamed from: f */
public int f3175f;
/* renamed from: g */
public int f3176g;
/* renamed from: h */
public int f3177h;
public C1450e(int i) {
if (i <= 0) {
throw new IllegalArgumentException("maxSize <= 0");
}
this.f3172c = i;
this.f3170a = new LinkedHashMap<>(0, 0.75f, true);
}
/* renamed from: a */
public V m1357a(K k) {
return null;
}
/* renamed from: b */
public void m1356b(boolean z, K k, V v, V v2) {
}
/* renamed from: c */
public final V m1355c(K k) {
V put;
if (k != null) {
synchronized (this) {
V v = this.f3170a.get(k);
if (v != null) {
this.f3176g++;
return v;
}
this.f3177h++;
V m1357a = m1357a(k);
if (m1357a == null) {
return null;
}
synchronized (this) {
this.f3174e++;
put = this.f3170a.put(k, m1357a);
if (put != null) {
this.f3170a.put(k, put);
} else {
this.f3171b += m1353e(k, m1357a);
}
}
if (put != null) {
m1356b(false, k, m1357a, put);
return put;
}
m1351g(this.f3172c);
return m1357a;
}
}
throw new NullPointerException("key == null");
}
/* renamed from: d */
public final V m1354d(K k, V v) {
V put;
if (k == null || v == null) {
throw new NullPointerException("key == null || value == null");
}
synchronized (this) {
this.f3173d++;
this.f3171b += m1353e(k, v);
put = this.f3170a.put(k, v);
if (put != null) {
this.f3171b -= m1353e(k, put);
}
}
if (put != null) {
m1356b(false, k, put, v);
}
m1351g(this.f3172c);
return put;
}
/* renamed from: e */
public final int m1353e(K k, V v) {
int m1352f = m1352f(k, v);
if (m1352f >= 0) {
return m1352f;
}
throw new IllegalStateException("Negative size: " + k + "=" + v);
}
/* renamed from: f */
public int m1352f(K k, V v) {
return 1;
}
/* JADX WARN: Code restructure failed: missing block: B:20:0x0070, code lost:
throw new java.lang.IllegalStateException(getClass().getName() + ".sizeOf() is reporting inconsistent results!");
*/
/* renamed from: g */
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public void m1351g(int i) {
K key;
V value;
while (true) {
synchronized (this) {
if (this.f3171b >= 0 && (!this.f3170a.isEmpty() || this.f3171b == 0)) {
if (this.f3171b <= i || this.f3170a.isEmpty()) {
break;
}
Map.Entry<K, V> next = this.f3170a.entrySet().iterator().next();
key = next.getKey();
value = next.getValue();
this.f3170a.remove(key);
this.f3171b -= m1353e(key, value);
this.f3175f++;
} else {
break;
}
}
m1356b(true, key, value, null);
}
}
public final synchronized String toString() {
int i;
int i2;
i = this.f3176g;
i2 = this.f3177h + i;
return String.format(Locale.US, "LruCache[maxSize=%d,hits=%d,misses=%d,hitRate=%d%%]", Integer.valueOf(this.f3172c), Integer.valueOf(this.f3176g), Integer.valueOf(this.f3177h), Integer.valueOf(i2 != 0 ? (i * 100) / i2 : 0));
}
}