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

89 lines
2.1 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package o;
/* loaded from: classes.dex */
public final class RDy {
/* loaded from: classes.dex */
public interface Sts<T> {
T d();
boolean d(T t);
}
/* loaded from: classes.dex */
public static class RVV<T> implements Sts<T> {
private int a;
private final Object[] e;
public RVV(int i) {
if (i <= 0) {
throw new IllegalArgumentException("The max pool size must be > 0");
}
this.e = new Object[i];
}
@Override // o.RDy.Sts
public T d() {
int i = this.a;
if (i <= 0) {
return null;
}
int i2 = i - 1;
Object[] objArr = this.e;
T t = (T) objArr[i2];
objArr[i2] = null;
this.a = i2;
return t;
}
@Override // o.RDy.Sts
public boolean d(T t) {
int i = 0;
while (true) {
int i2 = this.a;
if (i >= i2) {
Object[] objArr = this.e;
if (i2 >= objArr.length) {
return false;
}
objArr[i2] = t;
this.a = i2 + 1;
return true;
}
if (this.e[i] == t) {
throw new IllegalStateException("Already in the pool!");
}
i++;
}
}
}
/* loaded from: classes.dex */
public static class LWm<T> extends RVV<T> {
private final Object b;
public LWm(int i) {
super(i);
this.b = new Object();
}
@Override // o.RDy.RVV, o.RDy.Sts
public final T d() {
T t;
synchronized (this.b) {
t = (T) super.d();
}
return t;
}
@Override // o.RDy.RVV, o.RDy.Sts
public final boolean d(T t) {
boolean d;
synchronized (this.b) {
d = super.d(t);
}
return d;
}
}
}