110 lines
2.5 KiB
Java
110 lines
2.5 KiB
Java
package o;
|
|
|
|
import java.util.Iterator;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.Map;
|
|
|
|
/* renamed from: o.Wlo, reason: case insensitive filesystem */
|
|
/* loaded from: classes.dex */
|
|
public class C1139Wlo<T, Y> {
|
|
private long a;
|
|
private long b;
|
|
private final long d;
|
|
private final Map<T, IeS<Y>> e = new LinkedHashMap(100, 0.75f, true);
|
|
|
|
public int c(Y y) {
|
|
return 1;
|
|
}
|
|
|
|
protected void c(T t, Y y) {
|
|
}
|
|
|
|
public C1139Wlo(long j) {
|
|
this.d = j;
|
|
this.b = j;
|
|
}
|
|
|
|
public final long d() {
|
|
long j;
|
|
synchronized (this) {
|
|
j = this.b;
|
|
}
|
|
return j;
|
|
}
|
|
|
|
public final Y b(T t) {
|
|
Y y;
|
|
synchronized (this) {
|
|
IeS<Y> ieS = this.e.get(t);
|
|
y = ieS != null ? ieS.a : null;
|
|
}
|
|
return y;
|
|
}
|
|
|
|
public final Y a(T t, Y y) {
|
|
synchronized (this) {
|
|
int c = c(y);
|
|
long j = c;
|
|
if (j >= this.b) {
|
|
c(t, y);
|
|
return null;
|
|
}
|
|
if (y != null) {
|
|
this.a += j;
|
|
}
|
|
IeS<Y> put = this.e.put(t, y == null ? null : new IeS<>(y, c));
|
|
if (put != null) {
|
|
this.a -= put.e;
|
|
if (!put.a.equals(y)) {
|
|
c(t, put.a);
|
|
}
|
|
}
|
|
a(this.b);
|
|
return put != null ? put.a : null;
|
|
}
|
|
}
|
|
|
|
public final Y d(T t) {
|
|
synchronized (this) {
|
|
IeS<Y> remove = this.e.remove(t);
|
|
if (remove == null) {
|
|
return null;
|
|
}
|
|
this.a -= remove.e;
|
|
return remove.a;
|
|
}
|
|
}
|
|
|
|
public final void e() {
|
|
a(0L);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
public final void a(long j) {
|
|
synchronized (this) {
|
|
while (this.a > j) {
|
|
Iterator<Map.Entry<T, IeS<Y>>> it = this.e.entrySet().iterator();
|
|
Map.Entry<T, IeS<Y>> next = it.next();
|
|
IeS<Y> value = next.getValue();
|
|
this.a -= value.e;
|
|
T key = next.getKey();
|
|
it.remove();
|
|
c(key, value.a);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* renamed from: o.Wlo$IeS */
|
|
/* loaded from: classes.dex */
|
|
public static final class IeS<Y> {
|
|
final Y a;
|
|
final int e;
|
|
|
|
IeS(Y y, int i) {
|
|
this.a = y;
|
|
this.e = i;
|
|
}
|
|
}
|
|
}
|