what-the-bank/sources/o/aBE.java

268 lines
7.5 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import android.util.Log;
import com.airbnb.deeplinkdispatch.UrlTreeKt;
import java.util.HashMap;
import java.util.Map;
import java.util.NavigableMap;
import java.util.TreeMap;
/* loaded from: classes.dex */
public final class aBE implements Opg {
private int a;
private final C17583xwV<RVV, Object> b;
private final Map<Class<?>, Ksz<?>> c;
private final int d;
private final LWm e;
private final Map<Class<?>, NavigableMap<Integer, Integer>> h;
public aBE() {
this.b = new C17583xwV<>();
this.e = new LWm();
this.h = new HashMap();
this.c = new HashMap();
this.d = 4194304;
}
public aBE(int i) {
this.b = new C17583xwV<>();
this.e = new LWm();
this.h = new HashMap();
this.c = new HashMap();
this.d = i;
}
@Override // o.Opg
public final <T> void b(T t) {
synchronized (this) {
Class<?> cls = t.getClass();
Ksz<T> c = c(cls);
int a = c.a(t);
int d = c.d() * a;
if (d <= this.d / 2) {
LWm lWm = this.e;
Object obj = (ETY) lWm.d.poll();
if (obj == null) {
obj = lWm.d();
}
RVV rvv = (RVV) obj;
rvv.b = a;
rvv.c = cls;
this.b.a(rvv, t);
NavigableMap<Integer, Integer> b = b(cls);
Integer num = (Integer) b.get(Integer.valueOf(rvv.b));
b.put(Integer.valueOf(rvv.b), Integer.valueOf(num != null ? 1 + num.intValue() : 1));
this.a += d;
d(this.d);
}
}
}
/* JADX WARN: Multi-variable type inference failed */
@Override // o.Opg
public final <T> T e(int i, Class<T> cls) {
RVV rvv;
T t;
int i2;
synchronized (this) {
Integer ceilingKey = b((Class<?>) cls).ceilingKey(Integer.valueOf(i));
if (ceilingKey != null && ((i2 = this.a) == 0 || this.d / i2 >= 2 || ceilingKey.intValue() <= (i << 3))) {
LWm lWm = this.e;
int intValue = ceilingKey.intValue();
Object obj = (ETY) lWm.d.poll();
if (obj == null) {
obj = lWm.d();
}
rvv = (RVV) obj;
rvv.b = intValue;
rvv.c = cls;
} else {
LWm lWm2 = this.e;
Object obj2 = (ETY) lWm2.d.poll();
if (obj2 == null) {
obj2 = lWm2.d();
}
rvv = (RVV) obj2;
rvv.b = i;
rvv.c = cls;
}
t = (T) d(rvv, cls);
}
return t;
}
private <T> T d(RVV rvv, Class<T> cls) {
Ksz<T> c = c(cls);
T t = (T) this.b.a(rvv);
if (t != null) {
this.a -= c.a(t) * c.d();
a(c.a(t), cls);
}
if (t != null) {
return t;
}
if (Log.isLoggable(c.c(), 2)) {
c.c();
int i = rvv.b;
}
return c.e(rvv.b);
}
@Override // o.Opg
public final void a() {
synchronized (this) {
d(0);
}
}
@Override // o.Opg
public final void a(int i) {
synchronized (this) {
try {
if (i >= 40) {
synchronized (this) {
d(0);
}
} else if (i >= 20 || i == 15) {
d(this.d / 2);
}
} catch (Throwable th) {
throw th;
}
}
}
private void d(int i) {
while (this.a > i) {
Object d = this.b.d();
if (d == null) {
throw new NullPointerException("Argument must not be null");
}
Ksz c = c(d.getClass());
this.a -= c.a(d) * c.d();
a(c.a(d), d.getClass());
if (Log.isLoggable(c.c(), 2)) {
c.c();
c.a(d);
}
}
}
private void a(int i, Class<?> cls) {
NavigableMap<Integer, Integer> b = b(cls);
Integer num = (Integer) b.get(Integer.valueOf(i));
if (num == null) {
StringBuilder sb = new StringBuilder("Tried to decrement empty size, size: ");
sb.append(i);
sb.append(", this: ");
sb.append(this);
throw new NullPointerException(sb.toString());
}
if (num.intValue() == 1) {
b.remove(Integer.valueOf(i));
} else {
b.put(Integer.valueOf(i), Integer.valueOf(num.intValue() - 1));
}
}
private NavigableMap<Integer, Integer> b(Class<?> cls) {
NavigableMap<Integer, Integer> navigableMap = this.h.get(cls);
if (navigableMap != null) {
return navigableMap;
}
TreeMap treeMap = new TreeMap();
this.h.put(cls, treeMap);
return treeMap;
}
private <T> Ksz<T> c(Class<T> cls) {
Ksz<T> ksz = (Ksz) this.c.get(cls);
if (ksz == null) {
if (cls.equals(int[].class)) {
ksz = new C0346Eos();
} else if (cls.equals(byte[].class)) {
ksz = new LFO();
} else {
StringBuilder sb = new StringBuilder("No array pool found for: ");
sb.append(cls.getSimpleName());
throw new IllegalArgumentException(sb.toString());
}
this.c.put(cls, ksz);
}
return ksz;
}
/* loaded from: classes.dex */
static final class LWm extends Acs<RVV> {
LWm() {
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // o.Acs
public final /* synthetic */ RVV d() {
return new RVV(this);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static final class RVV implements ETY {
int b;
Class<?> c;
private final LWm e;
RVV(LWm lWm) {
this.e = lWm;
}
public final boolean equals(Object obj) {
if (!(obj instanceof RVV)) {
return false;
}
RVV rvv = (RVV) obj;
return this.b == rvv.b && this.c == rvv.c;
}
public final String toString() {
StringBuilder sb = new StringBuilder("Key{size=");
sb.append(this.b);
sb.append("array=");
sb.append(this.c);
sb.append(UrlTreeKt.componentParamSuffixChar);
return sb.toString();
}
@Override // o.ETY
public final void e() {
LWm lWm = this.e;
if (lWm.d.size() < 20) {
lWm.d.offer(this);
}
}
public final int hashCode() {
int i = this.b;
Class<?> cls = this.c;
return (i * 31) + (cls != null ? cls.hashCode() : 0);
}
}
/* JADX WARN: Multi-variable type inference failed */
@Override // o.Opg
public final <T> T a(Class<T> cls) {
T t;
synchronized (this) {
LWm lWm = this.e;
Object obj = (ETY) lWm.d.poll();
if (obj == null) {
obj = lWm.d();
}
RVV rvv = (RVV) obj;
rvv.b = 8;
rvv.c = cls;
t = (T) d(rvv, cls);
}
return t;
}
}