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

218 lines
6.4 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package o;
import java.util.AbstractList;
import java.util.Arrays;
import java.util.Collection;
import java.util.RandomAccess;
import o.MTP;
/* loaded from: classes2.dex */
final class HFd extends AbstractC15969jyR<Float> implements InterfaceC0165AnQ, RandomAccess, VAu {
private float[] a;
private int d;
@Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.List
public final /* synthetic */ void add(int i, Object obj) {
int i2;
float floatValue = ((Float) obj).floatValue();
d();
if (i >= 0 && i <= (i2 = this.d)) {
float[] fArr = this.a;
if (i2 < fArr.length) {
System.arraycopy(fArr, i, fArr, i + 1, i2 - i);
} else {
float[] fArr2 = new float[((i2 * 3) / 2) + 1];
System.arraycopy(fArr, 0, fArr2, 0, i);
System.arraycopy(this.a, i, fArr2, i + 1, this.d - i);
this.a = fArr2;
}
this.a[i] = floatValue;
this.d++;
((AbstractList) this).modCount++;
return;
}
StringBuilder sb = new StringBuilder("Index:");
sb.append(i);
sb.append(", Size:");
sb.append(this.d);
throw new IndexOutOfBoundsException(sb.toString());
}
@Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List
public final /* synthetic */ boolean add(Object obj) {
d(((Float) obj).floatValue());
return true;
}
@Override // o.MTP.RVV
public final /* synthetic */ MTP.RVV b(int i) {
if (i < this.d) {
throw new IllegalArgumentException();
}
return new HFd(Arrays.copyOf(this.a, i), this.d);
}
@Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.List
public final /* synthetic */ Object set(int i, Object obj) {
float floatValue = ((Float) obj).floatValue();
d();
d(i);
float[] fArr = this.a;
float f = fArr[i];
fArr[i] = floatValue;
return Float.valueOf(f);
}
static {
new HFd(new float[0], 0).a();
}
HFd() {
this(new float[10], 0);
}
private HFd(float[] fArr, int i) {
this.a = fArr;
this.d = i;
}
@Override // java.util.AbstractList
protected final void removeRange(int i, int i2) {
d();
if (i2 < i) {
throw new IndexOutOfBoundsException("toIndex < fromIndex");
}
float[] fArr = this.a;
System.arraycopy(fArr, i2, fArr, i, this.d - i2);
this.d -= i2 - i;
((AbstractList) this).modCount++;
}
@Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.Collection, java.util.List
public final boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof HFd)) {
return super.equals(obj);
}
HFd hFd = (HFd) obj;
if (this.d != hFd.d) {
return false;
}
float[] fArr = hFd.a;
for (int i = 0; i < this.d; i++) {
if (Float.floatToIntBits(this.a[i]) != Float.floatToIntBits(fArr[i])) {
return false;
}
}
return true;
}
@Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.Collection, java.util.List
public final int hashCode() {
int i = 1;
for (int i2 = 0; i2 < this.d; i2++) {
i = (i * 31) + Float.floatToIntBits(this.a[i2]);
}
return i;
}
@Override // java.util.AbstractList, java.util.List
public final int indexOf(Object obj) {
if (!(obj instanceof Float)) {
return -1;
}
float floatValue = ((Float) obj).floatValue();
int size = size();
for (int i = 0; i < size; i++) {
if (this.a[i] == floatValue) {
return i;
}
}
return -1;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public final boolean contains(Object obj) {
return indexOf(obj) != -1;
}
public final void d(float f) {
d();
int i = this.d;
float[] fArr = this.a;
if (i == fArr.length) {
float[] fArr2 = new float[((i * 3) / 2) + 1];
System.arraycopy(fArr, 0, fArr2, 0, i);
this.a = fArr2;
}
float[] fArr3 = this.a;
int i2 = this.d;
this.d = i2 + 1;
fArr3[i2] = f;
}
@Override // o.AbstractC15969jyR, java.util.AbstractCollection, java.util.Collection, java.util.List
public final boolean addAll(Collection<? extends Float> collection) {
d();
MTP.d(collection);
if (!(collection instanceof HFd)) {
return super.addAll(collection);
}
HFd hFd = (HFd) collection;
int i = hFd.d;
if (i == 0) {
return false;
}
int i2 = this.d;
if (Integer.MAX_VALUE - i2 < i) {
throw new OutOfMemoryError();
}
int i3 = i2 + i;
float[] fArr = this.a;
if (i3 > fArr.length) {
this.a = Arrays.copyOf(fArr, i3);
}
System.arraycopy(hFd.a, 0, this.a, this.d, hFd.d);
this.d = i3;
((AbstractList) this).modCount++;
return true;
}
private void d(int i) {
if (i < 0 || i >= this.d) {
StringBuilder sb = new StringBuilder("Index:");
sb.append(i);
sb.append(", Size:");
sb.append(this.d);
throw new IndexOutOfBoundsException(sb.toString());
}
}
@Override // java.util.AbstractList, java.util.List
public final /* synthetic */ Object get(int i) {
d(i);
return Float.valueOf(this.a[i]);
}
@Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.List
public final /* synthetic */ Object remove(int i) {
d();
d(i);
float[] fArr = this.a;
float f = fArr[i];
if (i < this.d - 1) {
System.arraycopy(fArr, i + 1, fArr, i, (r2 - i) - 1);
}
this.d--;
((AbstractList) this).modCount++;
return Float.valueOf(f);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public final int size() {
return this.d;
}
}