- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
234 lines
7.4 KiB
Java
234 lines
7.4 KiB
Java
package com.google.protobuf;
|
|
|
|
import com.google.protobuf.Internal;
|
|
import java.util.AbstractList;
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
import java.util.RandomAccess;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public final class FloatArrayList extends AbstractProtobufList implements Internal.FloatList, RandomAccess, PrimitiveNonBoxingCollection {
|
|
private static final FloatArrayList EMPTY_LIST;
|
|
private float[] array;
|
|
private int size;
|
|
|
|
public static FloatArrayList emptyList() {
|
|
return EMPTY_LIST;
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
|
public int size() {
|
|
return this.size;
|
|
}
|
|
|
|
static {
|
|
FloatArrayList floatArrayList = new FloatArrayList(new float[0], 0);
|
|
EMPTY_LIST = floatArrayList;
|
|
floatArrayList.makeImmutable();
|
|
}
|
|
|
|
public FloatArrayList() {
|
|
this(new float[10], 0);
|
|
}
|
|
|
|
private FloatArrayList(float[] fArr, int i) {
|
|
this.array = fArr;
|
|
this.size = i;
|
|
}
|
|
|
|
@Override // java.util.AbstractList
|
|
public void removeRange(int i, int i2) {
|
|
ensureIsMutable();
|
|
if (i2 < i) {
|
|
throw new IndexOutOfBoundsException("toIndex < fromIndex");
|
|
}
|
|
float[] fArr = this.array;
|
|
System.arraycopy(fArr, i2, fArr, i, this.size - i2);
|
|
this.size -= i2 - i;
|
|
((AbstractList) this).modCount++;
|
|
}
|
|
|
|
@Override // com.google.protobuf.AbstractProtobufList, java.util.AbstractList, java.util.Collection, java.util.List
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof FloatArrayList)) {
|
|
return super.equals(obj);
|
|
}
|
|
FloatArrayList floatArrayList = (FloatArrayList) obj;
|
|
if (this.size != floatArrayList.size) {
|
|
return false;
|
|
}
|
|
float[] fArr = floatArrayList.array;
|
|
for (int i = 0; i < this.size; i++) {
|
|
if (Float.floatToIntBits(this.array[i]) != Float.floatToIntBits(fArr[i])) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override // com.google.protobuf.AbstractProtobufList, java.util.AbstractList, java.util.Collection, java.util.List
|
|
public int hashCode() {
|
|
int i = 1;
|
|
for (int i2 = 0; i2 < this.size; i2++) {
|
|
i = (i * 31) + Float.floatToIntBits(this.array[i2]);
|
|
}
|
|
return i;
|
|
}
|
|
|
|
@Override // com.google.protobuf.Internal.ProtobufList, com.google.protobuf.Internal.BooleanList
|
|
/* renamed from: mutableCopyWithCapacity */
|
|
public Internal.ProtobufList<Float> mutableCopyWithCapacity2(int i) {
|
|
if (i < this.size) {
|
|
throw new IllegalArgumentException();
|
|
}
|
|
return new FloatArrayList(Arrays.copyOf(this.array, i), this.size);
|
|
}
|
|
|
|
@Override // java.util.AbstractList, java.util.List
|
|
public Float get(int i) {
|
|
return Float.valueOf(getFloat(i));
|
|
}
|
|
|
|
@Override // com.google.protobuf.Internal.FloatList
|
|
public float getFloat(int i) {
|
|
ensureIndexInRange(i);
|
|
return this.array[i];
|
|
}
|
|
|
|
@Override // java.util.AbstractList, java.util.List
|
|
public 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.array[i] == floatValue) {
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
|
public boolean contains(Object obj) {
|
|
return indexOf(obj) != -1;
|
|
}
|
|
|
|
@Override // com.google.protobuf.AbstractProtobufList, java.util.AbstractList, java.util.List
|
|
public Float set(int i, Float f) {
|
|
return Float.valueOf(setFloat(i, f.floatValue()));
|
|
}
|
|
|
|
@Override // com.google.protobuf.Internal.FloatList
|
|
public float setFloat(int i, float f) {
|
|
ensureIsMutable();
|
|
ensureIndexInRange(i);
|
|
float[] fArr = this.array;
|
|
float f2 = fArr[i];
|
|
fArr[i] = f;
|
|
return f2;
|
|
}
|
|
|
|
@Override // com.google.protobuf.AbstractProtobufList, java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List
|
|
public boolean add(Float f) {
|
|
addFloat(f.floatValue());
|
|
return true;
|
|
}
|
|
|
|
@Override // com.google.protobuf.AbstractProtobufList, java.util.AbstractList, java.util.List
|
|
public void add(int i, Float f) {
|
|
addFloat(i, f.floatValue());
|
|
}
|
|
|
|
@Override // com.google.protobuf.Internal.FloatList
|
|
public void addFloat(float f) {
|
|
ensureIsMutable();
|
|
int i = this.size;
|
|
float[] fArr = this.array;
|
|
if (i == fArr.length) {
|
|
float[] fArr2 = new float[((i * 3) / 2) + 1];
|
|
System.arraycopy(fArr, 0, fArr2, 0, i);
|
|
this.array = fArr2;
|
|
}
|
|
float[] fArr3 = this.array;
|
|
int i2 = this.size;
|
|
this.size = i2 + 1;
|
|
fArr3[i2] = f;
|
|
}
|
|
|
|
private void addFloat(int i, float f) {
|
|
int i2;
|
|
ensureIsMutable();
|
|
if (i < 0 || i > (i2 = this.size)) {
|
|
throw new IndexOutOfBoundsException(makeOutOfBoundsExceptionMessage(i));
|
|
}
|
|
float[] fArr = this.array;
|
|
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.array, i, fArr2, i + 1, this.size - i);
|
|
this.array = fArr2;
|
|
}
|
|
this.array[i] = f;
|
|
this.size++;
|
|
((AbstractList) this).modCount++;
|
|
}
|
|
|
|
@Override // com.google.protobuf.AbstractProtobufList, java.util.AbstractCollection, java.util.Collection, java.util.List
|
|
public boolean addAll(Collection<? extends Float> collection) {
|
|
ensureIsMutable();
|
|
Internal.checkNotNull(collection);
|
|
if (!(collection instanceof FloatArrayList)) {
|
|
return super.addAll(collection);
|
|
}
|
|
FloatArrayList floatArrayList = (FloatArrayList) collection;
|
|
int i = floatArrayList.size;
|
|
if (i == 0) {
|
|
return false;
|
|
}
|
|
int i2 = this.size;
|
|
if (Integer.MAX_VALUE - i2 < i) {
|
|
throw new OutOfMemoryError();
|
|
}
|
|
int i3 = i2 + i;
|
|
float[] fArr = this.array;
|
|
if (i3 > fArr.length) {
|
|
this.array = Arrays.copyOf(fArr, i3);
|
|
}
|
|
System.arraycopy(floatArrayList.array, 0, this.array, this.size, floatArrayList.size);
|
|
this.size = i3;
|
|
((AbstractList) this).modCount++;
|
|
return true;
|
|
}
|
|
|
|
@Override // com.google.protobuf.AbstractProtobufList, java.util.AbstractList, java.util.List
|
|
public Float remove(int i) {
|
|
ensureIsMutable();
|
|
ensureIndexInRange(i);
|
|
float[] fArr = this.array;
|
|
float f = fArr[i];
|
|
if (i < this.size - 1) {
|
|
System.arraycopy(fArr, i + 1, fArr, i, (r2 - i) - 1);
|
|
}
|
|
this.size--;
|
|
((AbstractList) this).modCount++;
|
|
return Float.valueOf(f);
|
|
}
|
|
|
|
private void ensureIndexInRange(int i) {
|
|
if (i < 0 || i >= this.size) {
|
|
throw new IndexOutOfBoundsException(makeOutOfBoundsExceptionMessage(i));
|
|
}
|
|
}
|
|
|
|
private String makeOutOfBoundsExceptionMessage(int i) {
|
|
return "Index:" + i + ", Size:" + this.size;
|
|
}
|
|
}
|