Initial commit
This commit is contained in:
11
sources/com/google/common/primitives/Booleans.java
Normal file
11
sources/com/google/common/primitives/Booleans.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.google.common.primitives;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Booleans {
|
||||
public static int a(boolean z, boolean z2) {
|
||||
if (z == z2) {
|
||||
return 0;
|
||||
}
|
||||
return z ? 1 : -1;
|
||||
}
|
||||
}
|
192
sources/com/google/common/primitives/Doubles.java
Normal file
192
sources/com/google/common/primitives/Doubles.java
Normal file
@@ -0,0 +1,192 @@
|
||||
package com.google.common.primitives;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.io.Serializable;
|
||||
import java.util.AbstractList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.RandomAccess;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Doubles {
|
||||
|
||||
private static class DoubleArrayAsList extends AbstractList<Double> implements RandomAccess, Serializable {
|
||||
final double[] a;
|
||||
final int b;
|
||||
final int c;
|
||||
|
||||
DoubleArrayAsList(double[] dArr, int i, int i2) {
|
||||
this.a = dArr;
|
||||
this.b = i;
|
||||
this.c = i2;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public Double set(int i, Double d) {
|
||||
Preconditions.a(i, size());
|
||||
double[] dArr = this.a;
|
||||
int i2 = this.b;
|
||||
double d2 = dArr[i2 + i];
|
||||
Preconditions.a(d);
|
||||
dArr[i2 + i] = d.doubleValue();
|
||||
return Double.valueOf(d2);
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
||||
public boolean contains(Object obj) {
|
||||
return (obj instanceof Double) && Doubles.c(this.a, ((Double) obj).doubleValue(), this.b, this.c) != -1;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.Collection, java.util.List
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof DoubleArrayAsList)) {
|
||||
return super.equals(obj);
|
||||
}
|
||||
DoubleArrayAsList doubleArrayAsList = (DoubleArrayAsList) obj;
|
||||
int size = size();
|
||||
if (doubleArrayAsList.size() != size) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (this.a[this.b + i] != doubleArrayAsList.a[doubleArrayAsList.b + i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.Collection, java.util.List
|
||||
public int hashCode() {
|
||||
int i = 1;
|
||||
for (int i2 = this.b; i2 < this.c; i2++) {
|
||||
i = (i * 31) + Doubles.a(this.a[i2]);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public int indexOf(Object obj) {
|
||||
int c;
|
||||
if (!(obj instanceof Double) || (c = Doubles.c(this.a, ((Double) obj).doubleValue(), this.b, this.c)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
return c - this.b;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public int lastIndexOf(Object obj) {
|
||||
int d;
|
||||
if (!(obj instanceof Double) || (d = Doubles.d(this.a, ((Double) obj).doubleValue(), this.b, this.c)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
return d - this.b;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
||||
public int size() {
|
||||
return this.c - this.b;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public List<Double> subList(int i, int i2) {
|
||||
Preconditions.b(i, i2, size());
|
||||
if (i == i2) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
double[] dArr = this.a;
|
||||
int i3 = this.b;
|
||||
return new DoubleArrayAsList(dArr, i + i3, i3 + i2);
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder(size() * 12);
|
||||
sb.append('[');
|
||||
sb.append(this.a[this.b]);
|
||||
int i = this.b;
|
||||
while (true) {
|
||||
i++;
|
||||
if (i >= this.c) {
|
||||
sb.append(']');
|
||||
return sb.toString();
|
||||
}
|
||||
sb.append(", ");
|
||||
sb.append(this.a[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public Double get(int i) {
|
||||
Preconditions.a(i, size());
|
||||
return Double.valueOf(this.a[this.b + i]);
|
||||
}
|
||||
|
||||
double[] a() {
|
||||
return Arrays.copyOfRange(this.a, this.b, this.c);
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
a();
|
||||
}
|
||||
|
||||
public static boolean b(double d) {
|
||||
return Double.NEGATIVE_INFINITY < d && d < Double.POSITIVE_INFINITY;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static int c(double[] dArr, double d, int i, int i2) {
|
||||
while (i < i2) {
|
||||
if (dArr[i] == d) {
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static int d(double[] dArr, double d, int i, int i2) {
|
||||
for (int i3 = i2 - 1; i3 >= i; i3--) {
|
||||
if (dArr[i3] == d) {
|
||||
return i3;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int a(double d) {
|
||||
return Double.valueOf(d).hashCode();
|
||||
}
|
||||
|
||||
public static double[] a(Collection<? extends Number> collection) {
|
||||
if (collection instanceof DoubleArrayAsList) {
|
||||
return ((DoubleArrayAsList) collection).a();
|
||||
}
|
||||
Object[] array = collection.toArray();
|
||||
int length = array.length;
|
||||
double[] dArr = new double[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
Object obj = array[i];
|
||||
Preconditions.a(obj);
|
||||
dArr[i] = ((Number) obj).doubleValue();
|
||||
}
|
||||
return dArr;
|
||||
}
|
||||
|
||||
private static Pattern a() {
|
||||
return Pattern.compile("[+-]?(?:NaN|Infinity|" + ("(?:\\d++(?:\\.\\d*+)?|\\.\\d++)(?:[eE][+-]?\\d++)?[fFdD]?") + "|" + ("0[xX](?:\\p{XDigit}++(?:\\.\\p{XDigit}*+)?|\\.\\p{XDigit}++)[pP][+-]?\\d++[fFdD]?") + ")");
|
||||
}
|
||||
}
|
360
sources/com/google/common/primitives/ImmutableDoubleArray.java
Normal file
360
sources/com/google/common/primitives/ImmutableDoubleArray.java
Normal file
@@ -0,0 +1,360 @@
|
||||
package com.google.common.primitives;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.io.Serializable;
|
||||
import java.util.AbstractList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.RandomAccess;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ImmutableDoubleArray implements Serializable {
|
||||
private static final ImmutableDoubleArray EMPTY = new ImmutableDoubleArray(new double[0]);
|
||||
private final double[] array;
|
||||
private final int end;
|
||||
private final transient int start;
|
||||
|
||||
static class AsList extends AbstractList<Double> implements RandomAccess {
|
||||
private final ImmutableDoubleArray a;
|
||||
|
||||
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
||||
public boolean contains(Object obj) {
|
||||
return indexOf(obj) >= 0;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.Collection, java.util.List
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof AsList) {
|
||||
return this.a.equals(((AsList) obj).a);
|
||||
}
|
||||
if (!(obj instanceof List)) {
|
||||
return false;
|
||||
}
|
||||
List list = (List) obj;
|
||||
if (size() != list.size()) {
|
||||
return false;
|
||||
}
|
||||
int i = this.a.start;
|
||||
for (Object obj2 : list) {
|
||||
if (obj2 instanceof Double) {
|
||||
int i2 = i + 1;
|
||||
if (ImmutableDoubleArray.areEqual(this.a.array[i], ((Double) obj2).doubleValue())) {
|
||||
i = i2;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.Collection, java.util.List
|
||||
public int hashCode() {
|
||||
return this.a.hashCode();
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public int indexOf(Object obj) {
|
||||
if (obj instanceof Double) {
|
||||
return this.a.indexOf(((Double) obj).doubleValue());
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public int lastIndexOf(Object obj) {
|
||||
if (obj instanceof Double) {
|
||||
return this.a.lastIndexOf(((Double) obj).doubleValue());
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
||||
public int size() {
|
||||
return this.a.length();
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public List<Double> subList(int i, int i2) {
|
||||
return this.a.subArray(i, i2).asList();
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection
|
||||
public String toString() {
|
||||
return this.a.toString();
|
||||
}
|
||||
|
||||
private AsList(ImmutableDoubleArray immutableDoubleArray) {
|
||||
this.a = immutableDoubleArray;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public Double get(int i) {
|
||||
return Double.valueOf(this.a.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static boolean areEqual(double d, double d2) {
|
||||
return Double.doubleToLongBits(d) == Double.doubleToLongBits(d2);
|
||||
}
|
||||
|
||||
public static Builder builder(int i) {
|
||||
Preconditions.a(i >= 0, "Invalid initialCapacity: %s", i);
|
||||
return new Builder(i);
|
||||
}
|
||||
|
||||
public static ImmutableDoubleArray copyOf(double[] dArr) {
|
||||
return dArr.length == 0 ? EMPTY : new ImmutableDoubleArray(Arrays.copyOf(dArr, dArr.length));
|
||||
}
|
||||
|
||||
private boolean isPartialView() {
|
||||
return this.start > 0 || this.end < this.array.length;
|
||||
}
|
||||
|
||||
public static ImmutableDoubleArray of() {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
public List<Double> asList() {
|
||||
return new AsList();
|
||||
}
|
||||
|
||||
public boolean contains(double d) {
|
||||
return indexOf(d) >= 0;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof ImmutableDoubleArray)) {
|
||||
return false;
|
||||
}
|
||||
ImmutableDoubleArray immutableDoubleArray = (ImmutableDoubleArray) obj;
|
||||
if (length() != immutableDoubleArray.length()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < length(); i++) {
|
||||
if (!areEqual(get(i), immutableDoubleArray.get(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public double get(int i) {
|
||||
Preconditions.a(i, length());
|
||||
return this.array[this.start + i];
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int i = 1;
|
||||
for (int i2 = this.start; i2 < this.end; i2++) {
|
||||
i = (i * 31) + Doubles.a(this.array[i2]);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
public int indexOf(double d) {
|
||||
for (int i = this.start; i < this.end; i++) {
|
||||
if (areEqual(this.array[i], d)) {
|
||||
return i - this.start;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return this.end == this.start;
|
||||
}
|
||||
|
||||
public int lastIndexOf(double d) {
|
||||
int i = this.end;
|
||||
do {
|
||||
i--;
|
||||
if (i < this.start) {
|
||||
return -1;
|
||||
}
|
||||
} while (!areEqual(this.array[i], d));
|
||||
return i - this.start;
|
||||
}
|
||||
|
||||
public int length() {
|
||||
return this.end - this.start;
|
||||
}
|
||||
|
||||
Object readResolve() {
|
||||
return isEmpty() ? EMPTY : this;
|
||||
}
|
||||
|
||||
public ImmutableDoubleArray subArray(int i, int i2) {
|
||||
Preconditions.b(i, i2, length());
|
||||
if (i == i2) {
|
||||
return EMPTY;
|
||||
}
|
||||
double[] dArr = this.array;
|
||||
int i3 = this.start;
|
||||
return new ImmutableDoubleArray(dArr, i + i3, i3 + i2);
|
||||
}
|
||||
|
||||
public double[] toArray() {
|
||||
return Arrays.copyOfRange(this.array, this.start, this.end);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
if (isEmpty()) {
|
||||
return "[]";
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(length() * 5);
|
||||
sb.append('[');
|
||||
sb.append(this.array[this.start]);
|
||||
int i = this.start;
|
||||
while (true) {
|
||||
i++;
|
||||
if (i >= this.end) {
|
||||
sb.append(']');
|
||||
return sb.toString();
|
||||
}
|
||||
sb.append(", ");
|
||||
sb.append(this.array[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public ImmutableDoubleArray trimmed() {
|
||||
return isPartialView() ? new ImmutableDoubleArray(toArray()) : this;
|
||||
}
|
||||
|
||||
Object writeReplace() {
|
||||
return trimmed();
|
||||
}
|
||||
|
||||
private ImmutableDoubleArray(double[] dArr) {
|
||||
this(dArr, 0, dArr.length);
|
||||
}
|
||||
|
||||
public static ImmutableDoubleArray of(double d) {
|
||||
return new ImmutableDoubleArray(new double[]{d});
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
private double[] a;
|
||||
private int b = 0;
|
||||
|
||||
Builder(int i) {
|
||||
this.a = new double[i];
|
||||
}
|
||||
|
||||
public Builder a(double d) {
|
||||
a(1);
|
||||
double[] dArr = this.a;
|
||||
int i = this.b;
|
||||
dArr[i] = d;
|
||||
this.b = i + 1;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder a(Iterable<Double> iterable) {
|
||||
if (iterable instanceof Collection) {
|
||||
a((Collection<Double>) iterable);
|
||||
return this;
|
||||
}
|
||||
Iterator<Double> it = iterable.iterator();
|
||||
while (it.hasNext()) {
|
||||
a(it.next().doubleValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder a(Collection<Double> collection) {
|
||||
a(collection.size());
|
||||
for (Double d : collection) {
|
||||
double[] dArr = this.a;
|
||||
int i = this.b;
|
||||
this.b = i + 1;
|
||||
dArr[i] = d.doubleValue();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private void a(int i) {
|
||||
int i2 = this.b + i;
|
||||
double[] dArr = this.a;
|
||||
if (i2 > dArr.length) {
|
||||
double[] dArr2 = new double[a(dArr.length, i2)];
|
||||
System.arraycopy(this.a, 0, dArr2, 0, this.b);
|
||||
this.a = dArr2;
|
||||
}
|
||||
}
|
||||
|
||||
private static int a(int i, int i2) {
|
||||
if (i2 < 0) {
|
||||
throw new AssertionError("cannot store more than MAX_VALUE elements");
|
||||
}
|
||||
int i3 = i + (i >> 1) + 1;
|
||||
if (i3 < i2) {
|
||||
i3 = Integer.highestOneBit(i2 - 1) << 1;
|
||||
}
|
||||
if (i3 < 0) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
return i3;
|
||||
}
|
||||
|
||||
public ImmutableDoubleArray a() {
|
||||
int i = this.b;
|
||||
return i == 0 ? ImmutableDoubleArray.EMPTY : new ImmutableDoubleArray(this.a, 0, i);
|
||||
}
|
||||
}
|
||||
|
||||
private ImmutableDoubleArray(double[] dArr, int i, int i2) {
|
||||
this.array = dArr;
|
||||
this.start = i;
|
||||
this.end = i2;
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder(10);
|
||||
}
|
||||
|
||||
public static ImmutableDoubleArray copyOf(Collection<Double> collection) {
|
||||
return collection.isEmpty() ? EMPTY : new ImmutableDoubleArray(Doubles.a(collection));
|
||||
}
|
||||
|
||||
public static ImmutableDoubleArray of(double d, double d2) {
|
||||
return new ImmutableDoubleArray(new double[]{d, d2});
|
||||
}
|
||||
|
||||
public static ImmutableDoubleArray copyOf(Iterable<Double> iterable) {
|
||||
if (iterable instanceof Collection) {
|
||||
return copyOf((Collection<Double>) iterable);
|
||||
}
|
||||
Builder builder = builder();
|
||||
builder.a(iterable);
|
||||
return builder.a();
|
||||
}
|
||||
|
||||
public static ImmutableDoubleArray of(double d, double d2, double d3) {
|
||||
return new ImmutableDoubleArray(new double[]{d, d2, d3});
|
||||
}
|
||||
|
||||
public static ImmutableDoubleArray of(double d, double d2, double d3, double d4) {
|
||||
return new ImmutableDoubleArray(new double[]{d, d2, d3, d4});
|
||||
}
|
||||
|
||||
public static ImmutableDoubleArray of(double d, double d2, double d3, double d4, double d5) {
|
||||
return new ImmutableDoubleArray(new double[]{d, d2, d3, d4, d5});
|
||||
}
|
||||
|
||||
public static ImmutableDoubleArray of(double d, double d2, double d3, double d4, double d5, double d6) {
|
||||
return new ImmutableDoubleArray(new double[]{d, d2, d3, d4, d5, d6});
|
||||
}
|
||||
|
||||
public static ImmutableDoubleArray of(double d, double... dArr) {
|
||||
double[] dArr2 = new double[dArr.length + 1];
|
||||
dArr2[0] = d;
|
||||
System.arraycopy(dArr, 0, dArr2, 1, dArr.length);
|
||||
return new ImmutableDoubleArray(dArr2);
|
||||
}
|
||||
}
|
359
sources/com/google/common/primitives/ImmutableIntArray.java
Normal file
359
sources/com/google/common/primitives/ImmutableIntArray.java
Normal file
@@ -0,0 +1,359 @@
|
||||
package com.google.common.primitives;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.io.Serializable;
|
||||
import java.util.AbstractList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.RandomAccess;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ImmutableIntArray implements Serializable {
|
||||
private static final ImmutableIntArray EMPTY = new ImmutableIntArray(new int[0]);
|
||||
private final int[] array;
|
||||
private final int end;
|
||||
private final transient int start;
|
||||
|
||||
static class AsList extends AbstractList<Integer> implements RandomAccess {
|
||||
private final ImmutableIntArray a;
|
||||
|
||||
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
||||
public boolean contains(Object obj) {
|
||||
return indexOf(obj) >= 0;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.Collection, java.util.List
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof AsList) {
|
||||
return this.a.equals(((AsList) obj).a);
|
||||
}
|
||||
if (!(obj instanceof List)) {
|
||||
return false;
|
||||
}
|
||||
List list = (List) obj;
|
||||
if (size() != list.size()) {
|
||||
return false;
|
||||
}
|
||||
int i = this.a.start;
|
||||
for (Object obj2 : list) {
|
||||
if (obj2 instanceof Integer) {
|
||||
int i2 = i + 1;
|
||||
if (this.a.array[i] == ((Integer) obj2).intValue()) {
|
||||
i = i2;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.Collection, java.util.List
|
||||
public int hashCode() {
|
||||
return this.a.hashCode();
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public int indexOf(Object obj) {
|
||||
if (obj instanceof Integer) {
|
||||
return this.a.indexOf(((Integer) obj).intValue());
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public int lastIndexOf(Object obj) {
|
||||
if (obj instanceof Integer) {
|
||||
return this.a.lastIndexOf(((Integer) obj).intValue());
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
||||
public int size() {
|
||||
return this.a.length();
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public List<Integer> subList(int i, int i2) {
|
||||
return this.a.subArray(i, i2).asList();
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection
|
||||
public String toString() {
|
||||
return this.a.toString();
|
||||
}
|
||||
|
||||
private AsList(ImmutableIntArray immutableIntArray) {
|
||||
this.a = immutableIntArray;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public Integer get(int i) {
|
||||
return Integer.valueOf(this.a.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder builder(int i) {
|
||||
Preconditions.a(i >= 0, "Invalid initialCapacity: %s", i);
|
||||
return new Builder(i);
|
||||
}
|
||||
|
||||
public static ImmutableIntArray copyOf(int[] iArr) {
|
||||
return iArr.length == 0 ? EMPTY : new ImmutableIntArray(Arrays.copyOf(iArr, iArr.length));
|
||||
}
|
||||
|
||||
private boolean isPartialView() {
|
||||
return this.start > 0 || this.end < this.array.length;
|
||||
}
|
||||
|
||||
public static ImmutableIntArray of() {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
public List<Integer> asList() {
|
||||
return new AsList();
|
||||
}
|
||||
|
||||
public boolean contains(int i) {
|
||||
return indexOf(i) >= 0;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof ImmutableIntArray)) {
|
||||
return false;
|
||||
}
|
||||
ImmutableIntArray immutableIntArray = (ImmutableIntArray) obj;
|
||||
if (length() != immutableIntArray.length()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < length(); i++) {
|
||||
if (get(i) != immutableIntArray.get(i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public int get(int i) {
|
||||
Preconditions.a(i, length());
|
||||
return this.array[this.start + i];
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int i = 1;
|
||||
for (int i2 = this.start; i2 < this.end; i2++) {
|
||||
int i3 = this.array[i2];
|
||||
Ints.a(i3);
|
||||
i = (i * 31) + i3;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
public int indexOf(int i) {
|
||||
for (int i2 = this.start; i2 < this.end; i2++) {
|
||||
if (this.array[i2] == i) {
|
||||
return i2 - this.start;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return this.end == this.start;
|
||||
}
|
||||
|
||||
public int lastIndexOf(int i) {
|
||||
int i2;
|
||||
int i3 = this.end;
|
||||
do {
|
||||
i3--;
|
||||
i2 = this.start;
|
||||
if (i3 < i2) {
|
||||
return -1;
|
||||
}
|
||||
} while (this.array[i3] != i);
|
||||
return i3 - i2;
|
||||
}
|
||||
|
||||
public int length() {
|
||||
return this.end - this.start;
|
||||
}
|
||||
|
||||
Object readResolve() {
|
||||
return isEmpty() ? EMPTY : this;
|
||||
}
|
||||
|
||||
public ImmutableIntArray subArray(int i, int i2) {
|
||||
Preconditions.b(i, i2, length());
|
||||
if (i == i2) {
|
||||
return EMPTY;
|
||||
}
|
||||
int[] iArr = this.array;
|
||||
int i3 = this.start;
|
||||
return new ImmutableIntArray(iArr, i + i3, i3 + i2);
|
||||
}
|
||||
|
||||
public int[] toArray() {
|
||||
return Arrays.copyOfRange(this.array, this.start, this.end);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
if (isEmpty()) {
|
||||
return "[]";
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(length() * 5);
|
||||
sb.append('[');
|
||||
sb.append(this.array[this.start]);
|
||||
int i = this.start;
|
||||
while (true) {
|
||||
i++;
|
||||
if (i >= this.end) {
|
||||
sb.append(']');
|
||||
return sb.toString();
|
||||
}
|
||||
sb.append(", ");
|
||||
sb.append(this.array[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public ImmutableIntArray trimmed() {
|
||||
return isPartialView() ? new ImmutableIntArray(toArray()) : this;
|
||||
}
|
||||
|
||||
Object writeReplace() {
|
||||
return trimmed();
|
||||
}
|
||||
|
||||
private ImmutableIntArray(int[] iArr) {
|
||||
this(iArr, 0, iArr.length);
|
||||
}
|
||||
|
||||
public static ImmutableIntArray copyOf(Collection<Integer> collection) {
|
||||
return collection.isEmpty() ? EMPTY : new ImmutableIntArray(Ints.a(collection));
|
||||
}
|
||||
|
||||
public static ImmutableIntArray of(int i) {
|
||||
return new ImmutableIntArray(new int[]{i});
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
private int[] a;
|
||||
private int b = 0;
|
||||
|
||||
Builder(int i) {
|
||||
this.a = new int[i];
|
||||
}
|
||||
|
||||
private void b(int i) {
|
||||
int i2 = this.b + i;
|
||||
int[] iArr = this.a;
|
||||
if (i2 > iArr.length) {
|
||||
int[] iArr2 = new int[a(iArr.length, i2)];
|
||||
System.arraycopy(this.a, 0, iArr2, 0, this.b);
|
||||
this.a = iArr2;
|
||||
}
|
||||
}
|
||||
|
||||
public Builder a(int i) {
|
||||
b(1);
|
||||
int[] iArr = this.a;
|
||||
int i2 = this.b;
|
||||
iArr[i2] = i;
|
||||
this.b = i2 + 1;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder a(Iterable<Integer> iterable) {
|
||||
if (iterable instanceof Collection) {
|
||||
a((Collection<Integer>) iterable);
|
||||
return this;
|
||||
}
|
||||
Iterator<Integer> it = iterable.iterator();
|
||||
while (it.hasNext()) {
|
||||
a(it.next().intValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder a(Collection<Integer> collection) {
|
||||
b(collection.size());
|
||||
for (Integer num : collection) {
|
||||
int[] iArr = this.a;
|
||||
int i = this.b;
|
||||
this.b = i + 1;
|
||||
iArr[i] = num.intValue();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private static int a(int i, int i2) {
|
||||
if (i2 < 0) {
|
||||
throw new AssertionError("cannot store more than MAX_VALUE elements");
|
||||
}
|
||||
int i3 = i + (i >> 1) + 1;
|
||||
if (i3 < i2) {
|
||||
i3 = Integer.highestOneBit(i2 - 1) << 1;
|
||||
}
|
||||
if (i3 < 0) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
return i3;
|
||||
}
|
||||
|
||||
public ImmutableIntArray a() {
|
||||
int i = this.b;
|
||||
return i == 0 ? ImmutableIntArray.EMPTY : new ImmutableIntArray(this.a, 0, i);
|
||||
}
|
||||
}
|
||||
|
||||
private ImmutableIntArray(int[] iArr, int i, int i2) {
|
||||
this.array = iArr;
|
||||
this.start = i;
|
||||
this.end = i2;
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder(10);
|
||||
}
|
||||
|
||||
public static ImmutableIntArray copyOf(Iterable<Integer> iterable) {
|
||||
if (iterable instanceof Collection) {
|
||||
return copyOf((Collection<Integer>) iterable);
|
||||
}
|
||||
Builder builder = builder();
|
||||
builder.a(iterable);
|
||||
return builder.a();
|
||||
}
|
||||
|
||||
public static ImmutableIntArray of(int i, int i2) {
|
||||
return new ImmutableIntArray(new int[]{i, i2});
|
||||
}
|
||||
|
||||
public static ImmutableIntArray of(int i, int i2, int i3) {
|
||||
return new ImmutableIntArray(new int[]{i, i2, i3});
|
||||
}
|
||||
|
||||
public static ImmutableIntArray of(int i, int i2, int i3, int i4) {
|
||||
return new ImmutableIntArray(new int[]{i, i2, i3, i4});
|
||||
}
|
||||
|
||||
public static ImmutableIntArray of(int i, int i2, int i3, int i4, int i5) {
|
||||
return new ImmutableIntArray(new int[]{i, i2, i3, i4, i5});
|
||||
}
|
||||
|
||||
public static ImmutableIntArray of(int i, int i2, int i3, int i4, int i5, int i6) {
|
||||
return new ImmutableIntArray(new int[]{i, i2, i3, i4, i5, i6});
|
||||
}
|
||||
|
||||
public static ImmutableIntArray of(int i, int... iArr) {
|
||||
int[] iArr2 = new int[iArr.length + 1];
|
||||
iArr2[0] = i;
|
||||
System.arraycopy(iArr, 0, iArr2, 1, iArr.length);
|
||||
return new ImmutableIntArray(iArr2);
|
||||
}
|
||||
}
|
357
sources/com/google/common/primitives/ImmutableLongArray.java
Normal file
357
sources/com/google/common/primitives/ImmutableLongArray.java
Normal file
@@ -0,0 +1,357 @@
|
||||
package com.google.common.primitives;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.io.Serializable;
|
||||
import java.util.AbstractList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.RandomAccess;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ImmutableLongArray implements Serializable {
|
||||
private static final ImmutableLongArray EMPTY = new ImmutableLongArray(new long[0]);
|
||||
private final long[] array;
|
||||
private final int end;
|
||||
private final transient int start;
|
||||
|
||||
static class AsList extends AbstractList<Long> implements RandomAccess {
|
||||
private final ImmutableLongArray a;
|
||||
|
||||
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
||||
public boolean contains(Object obj) {
|
||||
return indexOf(obj) >= 0;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.Collection, java.util.List
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof AsList) {
|
||||
return this.a.equals(((AsList) obj).a);
|
||||
}
|
||||
if (!(obj instanceof List)) {
|
||||
return false;
|
||||
}
|
||||
List list = (List) obj;
|
||||
if (size() != list.size()) {
|
||||
return false;
|
||||
}
|
||||
int i = this.a.start;
|
||||
for (Object obj2 : list) {
|
||||
if (obj2 instanceof Long) {
|
||||
int i2 = i + 1;
|
||||
if (this.a.array[i] == ((Long) obj2).longValue()) {
|
||||
i = i2;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.Collection, java.util.List
|
||||
public int hashCode() {
|
||||
return this.a.hashCode();
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public int indexOf(Object obj) {
|
||||
if (obj instanceof Long) {
|
||||
return this.a.indexOf(((Long) obj).longValue());
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public int lastIndexOf(Object obj) {
|
||||
if (obj instanceof Long) {
|
||||
return this.a.lastIndexOf(((Long) obj).longValue());
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
||||
public int size() {
|
||||
return this.a.length();
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public List<Long> subList(int i, int i2) {
|
||||
return this.a.subArray(i, i2).asList();
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection
|
||||
public String toString() {
|
||||
return this.a.toString();
|
||||
}
|
||||
|
||||
private AsList(ImmutableLongArray immutableLongArray) {
|
||||
this.a = immutableLongArray;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public Long get(int i) {
|
||||
return Long.valueOf(this.a.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder builder(int i) {
|
||||
Preconditions.a(i >= 0, "Invalid initialCapacity: %s", i);
|
||||
return new Builder(i);
|
||||
}
|
||||
|
||||
public static ImmutableLongArray copyOf(long[] jArr) {
|
||||
return jArr.length == 0 ? EMPTY : new ImmutableLongArray(Arrays.copyOf(jArr, jArr.length));
|
||||
}
|
||||
|
||||
private boolean isPartialView() {
|
||||
return this.start > 0 || this.end < this.array.length;
|
||||
}
|
||||
|
||||
public static ImmutableLongArray of() {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
public List<Long> asList() {
|
||||
return new AsList();
|
||||
}
|
||||
|
||||
public boolean contains(long j) {
|
||||
return indexOf(j) >= 0;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof ImmutableLongArray)) {
|
||||
return false;
|
||||
}
|
||||
ImmutableLongArray immutableLongArray = (ImmutableLongArray) obj;
|
||||
if (length() != immutableLongArray.length()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < length(); i++) {
|
||||
if (get(i) != immutableLongArray.get(i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public long get(int i) {
|
||||
Preconditions.a(i, length());
|
||||
return this.array[this.start + i];
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int i = 1;
|
||||
for (int i2 = this.start; i2 < this.end; i2++) {
|
||||
i = (i * 31) + Longs.a(this.array[i2]);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
public int indexOf(long j) {
|
||||
for (int i = this.start; i < this.end; i++) {
|
||||
if (this.array[i] == j) {
|
||||
return i - this.start;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return this.end == this.start;
|
||||
}
|
||||
|
||||
public int lastIndexOf(long j) {
|
||||
int i;
|
||||
int i2 = this.end;
|
||||
do {
|
||||
i2--;
|
||||
i = this.start;
|
||||
if (i2 < i) {
|
||||
return -1;
|
||||
}
|
||||
} while (this.array[i2] != j);
|
||||
return i2 - i;
|
||||
}
|
||||
|
||||
public int length() {
|
||||
return this.end - this.start;
|
||||
}
|
||||
|
||||
Object readResolve() {
|
||||
return isEmpty() ? EMPTY : this;
|
||||
}
|
||||
|
||||
public ImmutableLongArray subArray(int i, int i2) {
|
||||
Preconditions.b(i, i2, length());
|
||||
if (i == i2) {
|
||||
return EMPTY;
|
||||
}
|
||||
long[] jArr = this.array;
|
||||
int i3 = this.start;
|
||||
return new ImmutableLongArray(jArr, i + i3, i3 + i2);
|
||||
}
|
||||
|
||||
public long[] toArray() {
|
||||
return Arrays.copyOfRange(this.array, this.start, this.end);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
if (isEmpty()) {
|
||||
return "[]";
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(length() * 5);
|
||||
sb.append('[');
|
||||
sb.append(this.array[this.start]);
|
||||
int i = this.start;
|
||||
while (true) {
|
||||
i++;
|
||||
if (i >= this.end) {
|
||||
sb.append(']');
|
||||
return sb.toString();
|
||||
}
|
||||
sb.append(", ");
|
||||
sb.append(this.array[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public ImmutableLongArray trimmed() {
|
||||
return isPartialView() ? new ImmutableLongArray(toArray()) : this;
|
||||
}
|
||||
|
||||
Object writeReplace() {
|
||||
return trimmed();
|
||||
}
|
||||
|
||||
private ImmutableLongArray(long[] jArr) {
|
||||
this(jArr, 0, jArr.length);
|
||||
}
|
||||
|
||||
public static ImmutableLongArray of(long j) {
|
||||
return new ImmutableLongArray(new long[]{j});
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
private long[] a;
|
||||
private int b = 0;
|
||||
|
||||
Builder(int i) {
|
||||
this.a = new long[i];
|
||||
}
|
||||
|
||||
public Builder a(long j) {
|
||||
a(1);
|
||||
long[] jArr = this.a;
|
||||
int i = this.b;
|
||||
jArr[i] = j;
|
||||
this.b = i + 1;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder a(Iterable<Long> iterable) {
|
||||
if (iterable instanceof Collection) {
|
||||
a((Collection<Long>) iterable);
|
||||
return this;
|
||||
}
|
||||
Iterator<Long> it = iterable.iterator();
|
||||
while (it.hasNext()) {
|
||||
a(it.next().longValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder a(Collection<Long> collection) {
|
||||
a(collection.size());
|
||||
for (Long l : collection) {
|
||||
long[] jArr = this.a;
|
||||
int i = this.b;
|
||||
this.b = i + 1;
|
||||
jArr[i] = l.longValue();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private void a(int i) {
|
||||
int i2 = this.b + i;
|
||||
long[] jArr = this.a;
|
||||
if (i2 > jArr.length) {
|
||||
long[] jArr2 = new long[a(jArr.length, i2)];
|
||||
System.arraycopy(this.a, 0, jArr2, 0, this.b);
|
||||
this.a = jArr2;
|
||||
}
|
||||
}
|
||||
|
||||
private static int a(int i, int i2) {
|
||||
if (i2 < 0) {
|
||||
throw new AssertionError("cannot store more than MAX_VALUE elements");
|
||||
}
|
||||
int i3 = i + (i >> 1) + 1;
|
||||
if (i3 < i2) {
|
||||
i3 = Integer.highestOneBit(i2 - 1) << 1;
|
||||
}
|
||||
if (i3 < 0) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
return i3;
|
||||
}
|
||||
|
||||
public ImmutableLongArray a() {
|
||||
int i = this.b;
|
||||
return i == 0 ? ImmutableLongArray.EMPTY : new ImmutableLongArray(this.a, 0, i);
|
||||
}
|
||||
}
|
||||
|
||||
private ImmutableLongArray(long[] jArr, int i, int i2) {
|
||||
this.array = jArr;
|
||||
this.start = i;
|
||||
this.end = i2;
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder(10);
|
||||
}
|
||||
|
||||
public static ImmutableLongArray copyOf(Collection<Long> collection) {
|
||||
return collection.isEmpty() ? EMPTY : new ImmutableLongArray(Longs.a(collection));
|
||||
}
|
||||
|
||||
public static ImmutableLongArray of(long j, long j2) {
|
||||
return new ImmutableLongArray(new long[]{j, j2});
|
||||
}
|
||||
|
||||
public static ImmutableLongArray copyOf(Iterable<Long> iterable) {
|
||||
if (iterable instanceof Collection) {
|
||||
return copyOf((Collection<Long>) iterable);
|
||||
}
|
||||
Builder builder = builder();
|
||||
builder.a(iterable);
|
||||
return builder.a();
|
||||
}
|
||||
|
||||
public static ImmutableLongArray of(long j, long j2, long j3) {
|
||||
return new ImmutableLongArray(new long[]{j, j2, j3});
|
||||
}
|
||||
|
||||
public static ImmutableLongArray of(long j, long j2, long j3, long j4) {
|
||||
return new ImmutableLongArray(new long[]{j, j2, j3, j4});
|
||||
}
|
||||
|
||||
public static ImmutableLongArray of(long j, long j2, long j3, long j4, long j5) {
|
||||
return new ImmutableLongArray(new long[]{j, j2, j3, j4, j5});
|
||||
}
|
||||
|
||||
public static ImmutableLongArray of(long j, long j2, long j3, long j4, long j5, long j6) {
|
||||
return new ImmutableLongArray(new long[]{j, j2, j3, j4, j5, j6});
|
||||
}
|
||||
|
||||
public static ImmutableLongArray of(long j, long... jArr) {
|
||||
long[] jArr2 = new long[jArr.length + 1];
|
||||
jArr2[0] = j;
|
||||
System.arraycopy(jArr, 0, jArr2, 1, jArr.length);
|
||||
return new ImmutableLongArray(jArr2);
|
||||
}
|
||||
}
|
204
sources/com/google/common/primitives/Ints.java
Normal file
204
sources/com/google/common/primitives/Ints.java
Normal file
@@ -0,0 +1,204 @@
|
||||
package com.google.common.primitives;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.io.Serializable;
|
||||
import java.util.AbstractList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.RandomAccess;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Ints {
|
||||
|
||||
private static class IntArrayAsList extends AbstractList<Integer> implements RandomAccess, Serializable {
|
||||
final int[] a;
|
||||
final int b;
|
||||
final int c;
|
||||
|
||||
IntArrayAsList(int[] iArr, int i, int i2) {
|
||||
this.a = iArr;
|
||||
this.b = i;
|
||||
this.c = i2;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public Integer set(int i, Integer num) {
|
||||
Preconditions.a(i, size());
|
||||
int[] iArr = this.a;
|
||||
int i2 = this.b;
|
||||
int i3 = iArr[i2 + i];
|
||||
Preconditions.a(num);
|
||||
iArr[i2 + i] = num.intValue();
|
||||
return Integer.valueOf(i3);
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
||||
public boolean contains(Object obj) {
|
||||
return (obj instanceof Integer) && Ints.c(this.a, ((Integer) obj).intValue(), this.b, this.c) != -1;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.Collection, java.util.List
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof IntArrayAsList)) {
|
||||
return super.equals(obj);
|
||||
}
|
||||
IntArrayAsList intArrayAsList = (IntArrayAsList) obj;
|
||||
int size = size();
|
||||
if (intArrayAsList.size() != size) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (this.a[this.b + i] != intArrayAsList.a[intArrayAsList.b + i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.Collection, java.util.List
|
||||
public int hashCode() {
|
||||
int i = 1;
|
||||
for (int i2 = this.b; i2 < this.c; i2++) {
|
||||
int i3 = this.a[i2];
|
||||
Ints.a(i3);
|
||||
i = (i * 31) + i3;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public int indexOf(Object obj) {
|
||||
int c;
|
||||
if (!(obj instanceof Integer) || (c = Ints.c(this.a, ((Integer) obj).intValue(), this.b, this.c)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
return c - this.b;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public int lastIndexOf(Object obj) {
|
||||
int d;
|
||||
if (!(obj instanceof Integer) || (d = Ints.d(this.a, ((Integer) obj).intValue(), this.b, this.c)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
return d - this.b;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
||||
public int size() {
|
||||
return this.c - this.b;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public List<Integer> subList(int i, int i2) {
|
||||
Preconditions.b(i, i2, size());
|
||||
if (i == i2) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
int[] iArr = this.a;
|
||||
int i3 = this.b;
|
||||
return new IntArrayAsList(iArr, i + i3, i3 + i2);
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder(size() * 5);
|
||||
sb.append('[');
|
||||
sb.append(this.a[this.b]);
|
||||
int i = this.b;
|
||||
while (true) {
|
||||
i++;
|
||||
if (i >= this.c) {
|
||||
sb.append(']');
|
||||
return sb.toString();
|
||||
}
|
||||
sb.append(", ");
|
||||
sb.append(this.a[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public Integer get(int i) {
|
||||
Preconditions.a(i, size());
|
||||
return Integer.valueOf(this.a[this.b + i]);
|
||||
}
|
||||
|
||||
int[] a() {
|
||||
return Arrays.copyOfRange(this.a, this.b, this.c);
|
||||
}
|
||||
}
|
||||
|
||||
public static int a(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
public static int a(int i, int i2) {
|
||||
if (i < i2) {
|
||||
return -1;
|
||||
}
|
||||
return i > i2 ? 1 : 0;
|
||||
}
|
||||
|
||||
public static int b(long j) {
|
||||
if (j > 2147483647L) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
if (j < -2147483648L) {
|
||||
return Integer.MIN_VALUE;
|
||||
}
|
||||
return (int) j;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static int c(int[] iArr, int i, int i2, int i3) {
|
||||
while (i2 < i3) {
|
||||
if (iArr[i2] == i) {
|
||||
return i2;
|
||||
}
|
||||
i2++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static int d(int[] iArr, int i, int i2, int i3) {
|
||||
for (int i4 = i3 - 1; i4 >= i2; i4--) {
|
||||
if (iArr[i4] == i) {
|
||||
return i4;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int a(long j) {
|
||||
int i = (int) j;
|
||||
Preconditions.a(((long) i) == j, "Out of range: %s", j);
|
||||
return i;
|
||||
}
|
||||
|
||||
public static int[] a(Collection<? extends Number> collection) {
|
||||
if (collection instanceof IntArrayAsList) {
|
||||
return ((IntArrayAsList) collection).a();
|
||||
}
|
||||
Object[] array = collection.toArray();
|
||||
int length = array.length;
|
||||
int[] iArr = new int[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
Object obj = array[i];
|
||||
Preconditions.a(obj);
|
||||
iArr[i] = ((Number) obj).intValue();
|
||||
}
|
||||
return iArr;
|
||||
}
|
||||
}
|
209
sources/com/google/common/primitives/Longs.java
Normal file
209
sources/com/google/common/primitives/Longs.java
Normal file
@@ -0,0 +1,209 @@
|
||||
package com.google.common.primitives;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||||
import java.io.Serializable;
|
||||
import java.util.AbstractList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.RandomAccess;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Longs {
|
||||
|
||||
private static class LongArrayAsList extends AbstractList<Long> implements RandomAccess, Serializable {
|
||||
final long[] a;
|
||||
final int b;
|
||||
final int c;
|
||||
|
||||
LongArrayAsList(long[] jArr, int i, int i2) {
|
||||
this.a = jArr;
|
||||
this.b = i;
|
||||
this.c = i2;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public Long set(int i, Long l) {
|
||||
Preconditions.a(i, size());
|
||||
long[] jArr = this.a;
|
||||
int i2 = this.b;
|
||||
long j = jArr[i2 + i];
|
||||
Preconditions.a(l);
|
||||
jArr[i2 + i] = l.longValue();
|
||||
return Long.valueOf(j);
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
||||
public boolean contains(Object obj) {
|
||||
return (obj instanceof Long) && Longs.c(this.a, ((Long) obj).longValue(), this.b, this.c) != -1;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.Collection, java.util.List
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof LongArrayAsList)) {
|
||||
return super.equals(obj);
|
||||
}
|
||||
LongArrayAsList longArrayAsList = (LongArrayAsList) obj;
|
||||
int size = size();
|
||||
if (longArrayAsList.size() != size) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (this.a[this.b + i] != longArrayAsList.a[longArrayAsList.b + i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.Collection, java.util.List
|
||||
public int hashCode() {
|
||||
int i = 1;
|
||||
for (int i2 = this.b; i2 < this.c; i2++) {
|
||||
i = (i * 31) + Longs.a(this.a[i2]);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public int indexOf(Object obj) {
|
||||
int c;
|
||||
if (!(obj instanceof Long) || (c = Longs.c(this.a, ((Long) obj).longValue(), this.b, this.c)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
return c - this.b;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public int lastIndexOf(Object obj) {
|
||||
int d;
|
||||
if (!(obj instanceof Long) || (d = Longs.d(this.a, ((Long) obj).longValue(), this.b, this.c)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
return d - this.b;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
||||
public int size() {
|
||||
return this.c - this.b;
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public List<Long> subList(int i, int i2) {
|
||||
Preconditions.b(i, i2, size());
|
||||
if (i == i2) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
long[] jArr = this.a;
|
||||
int i3 = this.b;
|
||||
return new LongArrayAsList(jArr, i + i3, i3 + i2);
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractCollection
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder(size() * 10);
|
||||
sb.append('[');
|
||||
sb.append(this.a[this.b]);
|
||||
int i = this.b;
|
||||
while (true) {
|
||||
i++;
|
||||
if (i >= this.c) {
|
||||
sb.append(']');
|
||||
return sb.toString();
|
||||
}
|
||||
sb.append(", ");
|
||||
sb.append(this.a[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // java.util.AbstractList, java.util.List
|
||||
public Long get(int i) {
|
||||
Preconditions.a(i, size());
|
||||
return Long.valueOf(this.a[this.b + i]);
|
||||
}
|
||||
|
||||
long[] a() {
|
||||
return Arrays.copyOfRange(this.a, this.b, this.c);
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
a();
|
||||
}
|
||||
|
||||
public static int a(long j) {
|
||||
return (int) (j ^ (j >>> 32));
|
||||
}
|
||||
|
||||
public static int a(long j, long j2) {
|
||||
if (j < j2) {
|
||||
return -1;
|
||||
}
|
||||
return j > j2 ? 1 : 0;
|
||||
}
|
||||
|
||||
public static long a(byte b, byte b2, byte b3, byte b4, byte b5, byte b6, byte b7, byte b8) {
|
||||
return ((b2 & 255) << 48) | ((b & 255) << 56) | ((b3 & 255) << 40) | ((b4 & 255) << 32) | ((b5 & 255) << 24) | ((b6 & 255) << 16) | ((b7 & 255) << 8) | (b8 & 255);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static int c(long[] jArr, long j, int i, int i2) {
|
||||
while (i < i2) {
|
||||
if (jArr[i] == j) {
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static int d(long[] jArr, long j, int i, int i2) {
|
||||
for (int i3 = i2 - 1; i3 >= i; i3--) {
|
||||
if (jArr[i3] == j) {
|
||||
return i3;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static byte[] a() {
|
||||
byte[] bArr = new byte[PeripheralType.SERVO];
|
||||
Arrays.fill(bArr, (byte) -1);
|
||||
for (int i = 0; i <= 9; i++) {
|
||||
bArr[i + 48] = (byte) i;
|
||||
}
|
||||
for (int i2 = 0; i2 <= 26; i2++) {
|
||||
byte b = (byte) (i2 + 10);
|
||||
bArr[i2 + 65] = b;
|
||||
bArr[i2 + 97] = b;
|
||||
}
|
||||
return bArr;
|
||||
}
|
||||
|
||||
public static long[] a(Collection<? extends Number> collection) {
|
||||
if (collection instanceof LongArrayAsList) {
|
||||
return ((LongArrayAsList) collection).a();
|
||||
}
|
||||
Object[] array = collection.toArray();
|
||||
int length = array.length;
|
||||
long[] jArr = new long[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
Object obj = array[i];
|
||||
Preconditions.a(obj);
|
||||
jArr[i] = ((Number) obj).longValue();
|
||||
}
|
||||
return jArr;
|
||||
}
|
||||
}
|
50
sources/com/google/common/primitives/Primitives.java
Normal file
50
sources/com/google/common/primitives/Primitives.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package com.google.common.primitives;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Primitives {
|
||||
private static final Map<Class<?>, Class<?>> a;
|
||||
private static final Map<Class<?>, Class<?>> b;
|
||||
|
||||
static {
|
||||
HashMap hashMap = new HashMap(16);
|
||||
HashMap hashMap2 = new HashMap(16);
|
||||
a(hashMap, hashMap2, Boolean.TYPE, Boolean.class);
|
||||
a(hashMap, hashMap2, Byte.TYPE, Byte.class);
|
||||
a(hashMap, hashMap2, Character.TYPE, Character.class);
|
||||
a(hashMap, hashMap2, Double.TYPE, Double.class);
|
||||
a(hashMap, hashMap2, Float.TYPE, Float.class);
|
||||
a(hashMap, hashMap2, Integer.TYPE, Integer.class);
|
||||
a(hashMap, hashMap2, Long.TYPE, Long.class);
|
||||
a(hashMap, hashMap2, Short.TYPE, Short.class);
|
||||
a(hashMap, hashMap2, Void.TYPE, Void.class);
|
||||
a = Collections.unmodifiableMap(hashMap);
|
||||
b = Collections.unmodifiableMap(hashMap2);
|
||||
}
|
||||
|
||||
private static void a(Map<Class<?>, Class<?>> map, Map<Class<?>, Class<?>> map2, Class<?> cls, Class<?> cls2) {
|
||||
map.put(cls, cls2);
|
||||
map2.put(cls2, cls);
|
||||
}
|
||||
|
||||
public static <T> Class<T> b(Class<T> cls) {
|
||||
Preconditions.a(cls);
|
||||
Class<T> cls2 = (Class) a.get(cls);
|
||||
return cls2 == null ? cls : cls2;
|
||||
}
|
||||
|
||||
public static Set<Class<?>> a() {
|
||||
return b.keySet();
|
||||
}
|
||||
|
||||
public static <T> Class<T> a(Class<T> cls) {
|
||||
Preconditions.a(cls);
|
||||
Class<T> cls2 = (Class) b.get(cls);
|
||||
return cls2 == null ? cls : cls2;
|
||||
}
|
||||
}
|
12
sources/com/google/common/primitives/SignedBytes.java
Normal file
12
sources/com/google/common/primitives/SignedBytes.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.google.common.primitives;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class SignedBytes {
|
||||
public static byte a(long j) {
|
||||
byte b = (byte) j;
|
||||
Preconditions.a(((long) b) == j, "Out of range: %s", j);
|
||||
return b;
|
||||
}
|
||||
}
|
15
sources/com/google/common/primitives/UnsignedBytes.java
Normal file
15
sources/com/google/common/primitives/UnsignedBytes.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.google.common.primitives;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class UnsignedBytes {
|
||||
public static byte a(long j) {
|
||||
Preconditions.a((j >> 8) == 0, "out of range: %s", j);
|
||||
return (byte) j;
|
||||
}
|
||||
|
||||
public static int a(byte b) {
|
||||
return b & 255;
|
||||
}
|
||||
}
|
115
sources/com/google/common/primitives/UnsignedInteger.java
Normal file
115
sources/com/google/common/primitives/UnsignedInteger.java
Normal file
@@ -0,0 +1,115 @@
|
||||
package com.google.common.primitives;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.math.BigInteger;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class UnsignedInteger extends Number implements Comparable<UnsignedInteger> {
|
||||
private final int value;
|
||||
public static final UnsignedInteger ZERO = fromIntBits(0);
|
||||
public static final UnsignedInteger ONE = fromIntBits(1);
|
||||
public static final UnsignedInteger MAX_VALUE = fromIntBits(-1);
|
||||
|
||||
private UnsignedInteger(int i) {
|
||||
this.value = i & (-1);
|
||||
}
|
||||
|
||||
public static UnsignedInteger fromIntBits(int i) {
|
||||
return new UnsignedInteger(i);
|
||||
}
|
||||
|
||||
public static UnsignedInteger valueOf(long j) {
|
||||
Preconditions.a((4294967295L & j) == j, "value (%s) is outside the range for an unsigned integer value", j);
|
||||
return fromIntBits((int) j);
|
||||
}
|
||||
|
||||
public BigInteger bigIntegerValue() {
|
||||
return BigInteger.valueOf(longValue());
|
||||
}
|
||||
|
||||
public UnsignedInteger dividedBy(UnsignedInteger unsignedInteger) {
|
||||
int i = this.value;
|
||||
Preconditions.a(unsignedInteger);
|
||||
return fromIntBits(UnsignedInts.b(i, unsignedInteger.value));
|
||||
}
|
||||
|
||||
@Override // java.lang.Number
|
||||
public double doubleValue() {
|
||||
return longValue();
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
return (obj instanceof UnsignedInteger) && this.value == ((UnsignedInteger) obj).value;
|
||||
}
|
||||
|
||||
@Override // java.lang.Number
|
||||
public float floatValue() {
|
||||
return longValue();
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override // java.lang.Number
|
||||
public int intValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override // java.lang.Number
|
||||
public long longValue() {
|
||||
return UnsignedInts.b(this.value);
|
||||
}
|
||||
|
||||
public UnsignedInteger minus(UnsignedInteger unsignedInteger) {
|
||||
int i = this.value;
|
||||
Preconditions.a(unsignedInteger);
|
||||
return fromIntBits(i - unsignedInteger.value);
|
||||
}
|
||||
|
||||
public UnsignedInteger mod(UnsignedInteger unsignedInteger) {
|
||||
int i = this.value;
|
||||
Preconditions.a(unsignedInteger);
|
||||
return fromIntBits(UnsignedInts.c(i, unsignedInteger.value));
|
||||
}
|
||||
|
||||
public UnsignedInteger plus(UnsignedInteger unsignedInteger) {
|
||||
int i = this.value;
|
||||
Preconditions.a(unsignedInteger);
|
||||
return fromIntBits(i + unsignedInteger.value);
|
||||
}
|
||||
|
||||
public UnsignedInteger times(UnsignedInteger unsignedInteger) {
|
||||
int i = this.value;
|
||||
Preconditions.a(unsignedInteger);
|
||||
return fromIntBits(i * unsignedInteger.value);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return toString(10);
|
||||
}
|
||||
|
||||
@Override // java.lang.Comparable
|
||||
public int compareTo(UnsignedInteger unsignedInteger) {
|
||||
Preconditions.a(unsignedInteger);
|
||||
return UnsignedInts.a(this.value, unsignedInteger.value);
|
||||
}
|
||||
|
||||
public String toString(int i) {
|
||||
return UnsignedInts.d(this.value, i);
|
||||
}
|
||||
|
||||
public static UnsignedInteger valueOf(BigInteger bigInteger) {
|
||||
Preconditions.a(bigInteger);
|
||||
Preconditions.a(bigInteger.signum() >= 0 && bigInteger.bitLength() <= 32, "value (%s) is outside the range for an unsigned integer value", bigInteger);
|
||||
return fromIntBits(bigInteger.intValue());
|
||||
}
|
||||
|
||||
public static UnsignedInteger valueOf(String str) {
|
||||
return valueOf(str, 10);
|
||||
}
|
||||
|
||||
public static UnsignedInteger valueOf(String str, int i) {
|
||||
return fromIntBits(UnsignedInts.a(str, i));
|
||||
}
|
||||
}
|
39
sources/com/google/common/primitives/UnsignedInts.java
Normal file
39
sources/com/google/common/primitives/UnsignedInts.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package com.google.common.primitives;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class UnsignedInts {
|
||||
static int a(int i) {
|
||||
return i ^ Integer.MIN_VALUE;
|
||||
}
|
||||
|
||||
public static int a(int i, int i2) {
|
||||
return Ints.a(a(i), a(i2));
|
||||
}
|
||||
|
||||
public static int b(int i, int i2) {
|
||||
return (int) (b(i) / b(i2));
|
||||
}
|
||||
|
||||
public static long b(int i) {
|
||||
return i & 4294967295L;
|
||||
}
|
||||
|
||||
public static int c(int i, int i2) {
|
||||
return (int) (b(i) % b(i2));
|
||||
}
|
||||
|
||||
public static String d(int i, int i2) {
|
||||
return Long.toString(i & 4294967295L, i2);
|
||||
}
|
||||
|
||||
public static int a(String str, int i) {
|
||||
Preconditions.a(str);
|
||||
long parseLong = Long.parseLong(str, i);
|
||||
if ((4294967295L & parseLong) == parseLong) {
|
||||
return (int) parseLong;
|
||||
}
|
||||
throw new NumberFormatException("Input " + str + " in base " + i + " is not in the range of an unsigned integer");
|
||||
}
|
||||
}
|
122
sources/com/google/common/primitives/UnsignedLong.java
Normal file
122
sources/com/google/common/primitives/UnsignedLong.java
Normal file
@@ -0,0 +1,122 @@
|
||||
package com.google.common.primitives;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigInteger;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class UnsignedLong extends Number implements Comparable<UnsignedLong>, Serializable {
|
||||
private static final long UNSIGNED_MASK = Long.MAX_VALUE;
|
||||
private final long value;
|
||||
public static final UnsignedLong ZERO = new UnsignedLong(0);
|
||||
public static final UnsignedLong ONE = new UnsignedLong(1);
|
||||
public static final UnsignedLong MAX_VALUE = new UnsignedLong(-1);
|
||||
|
||||
private UnsignedLong(long j) {
|
||||
this.value = j;
|
||||
}
|
||||
|
||||
public static UnsignedLong fromLongBits(long j) {
|
||||
return new UnsignedLong(j);
|
||||
}
|
||||
|
||||
public static UnsignedLong valueOf(long j) {
|
||||
Preconditions.a(j >= 0, "value (%s) is outside the range for an unsigned long value", j);
|
||||
return fromLongBits(j);
|
||||
}
|
||||
|
||||
public BigInteger bigIntegerValue() {
|
||||
BigInteger valueOf = BigInteger.valueOf(this.value & UNSIGNED_MASK);
|
||||
return this.value < 0 ? valueOf.setBit(63) : valueOf;
|
||||
}
|
||||
|
||||
public UnsignedLong dividedBy(UnsignedLong unsignedLong) {
|
||||
long j = this.value;
|
||||
Preconditions.a(unsignedLong);
|
||||
return fromLongBits(UnsignedLongs.b(j, unsignedLong.value));
|
||||
}
|
||||
|
||||
@Override // java.lang.Number
|
||||
public double doubleValue() {
|
||||
long j = this.value;
|
||||
double d = UNSIGNED_MASK & j;
|
||||
return j < 0 ? d + 9.223372036854776E18d : d;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
return (obj instanceof UnsignedLong) && this.value == ((UnsignedLong) obj).value;
|
||||
}
|
||||
|
||||
@Override // java.lang.Number
|
||||
public float floatValue() {
|
||||
long j = this.value;
|
||||
float f = UNSIGNED_MASK & j;
|
||||
return j < 0 ? f + 9.223372E18f : f;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return Longs.a(this.value);
|
||||
}
|
||||
|
||||
@Override // java.lang.Number
|
||||
public int intValue() {
|
||||
return (int) this.value;
|
||||
}
|
||||
|
||||
@Override // java.lang.Number
|
||||
public long longValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public UnsignedLong minus(UnsignedLong unsignedLong) {
|
||||
long j = this.value;
|
||||
Preconditions.a(unsignedLong);
|
||||
return fromLongBits(j - unsignedLong.value);
|
||||
}
|
||||
|
||||
public UnsignedLong mod(UnsignedLong unsignedLong) {
|
||||
long j = this.value;
|
||||
Preconditions.a(unsignedLong);
|
||||
return fromLongBits(UnsignedLongs.c(j, unsignedLong.value));
|
||||
}
|
||||
|
||||
public UnsignedLong plus(UnsignedLong unsignedLong) {
|
||||
long j = this.value;
|
||||
Preconditions.a(unsignedLong);
|
||||
return fromLongBits(j + unsignedLong.value);
|
||||
}
|
||||
|
||||
public UnsignedLong times(UnsignedLong unsignedLong) {
|
||||
long j = this.value;
|
||||
Preconditions.a(unsignedLong);
|
||||
return fromLongBits(j * unsignedLong.value);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return UnsignedLongs.b(this.value);
|
||||
}
|
||||
|
||||
@Override // java.lang.Comparable
|
||||
public int compareTo(UnsignedLong unsignedLong) {
|
||||
Preconditions.a(unsignedLong);
|
||||
return UnsignedLongs.a(this.value, unsignedLong.value);
|
||||
}
|
||||
|
||||
public String toString(int i) {
|
||||
return UnsignedLongs.a(this.value, i);
|
||||
}
|
||||
|
||||
public static UnsignedLong valueOf(BigInteger bigInteger) {
|
||||
Preconditions.a(bigInteger);
|
||||
Preconditions.a(bigInteger.signum() >= 0 && bigInteger.bitLength() <= 64, "value (%s) is outside the range for an unsigned long value", bigInteger);
|
||||
return fromLongBits(bigInteger.longValue());
|
||||
}
|
||||
|
||||
public static UnsignedLong valueOf(String str) {
|
||||
return valueOf(str, 10);
|
||||
}
|
||||
|
||||
public static UnsignedLong valueOf(String str, int i) {
|
||||
return fromLongBits(UnsignedLongs.a(str, i));
|
||||
}
|
||||
}
|
129
sources/com/google/common/primitives/UnsignedLongs.java
Normal file
129
sources/com/google/common/primitives/UnsignedLongs.java
Normal file
@@ -0,0 +1,129 @@
|
||||
package com.google.common.primitives;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.math.BigInteger;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class UnsignedLongs {
|
||||
private static final long[] a = new long[37];
|
||||
private static final int[] b = new int[37];
|
||||
private static final int[] c = new int[37];
|
||||
|
||||
static {
|
||||
BigInteger bigInteger = new BigInteger("10000000000000000", 16);
|
||||
for (int i = 2; i <= 36; i++) {
|
||||
long j = i;
|
||||
a[i] = b(-1L, j);
|
||||
b[i] = (int) c(-1L, j);
|
||||
c[i] = bigInteger.toString(i).length() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static int a(long j, long j2) {
|
||||
return Longs.a(a(j), a(j2));
|
||||
}
|
||||
|
||||
private static long a(long j) {
|
||||
return j ^ Long.MIN_VALUE;
|
||||
}
|
||||
|
||||
public static long b(long j, long j2) {
|
||||
if (j2 < 0) {
|
||||
return a(j, j2) < 0 ? 0L : 1L;
|
||||
}
|
||||
if (j >= 0) {
|
||||
return j / j2;
|
||||
}
|
||||
long j3 = ((j >>> 1) / j2) << 1;
|
||||
return j3 + (a(j - (j3 * j2), j2) < 0 ? 0 : 1);
|
||||
}
|
||||
|
||||
public static long c(long j, long j2) {
|
||||
if (j2 < 0) {
|
||||
return a(j, j2) < 0 ? j : j - j2;
|
||||
}
|
||||
if (j >= 0) {
|
||||
return j % j2;
|
||||
}
|
||||
long j3 = j - ((((j >>> 1) / j2) << 1) * j2);
|
||||
if (a(j3, j2) < 0) {
|
||||
j2 = 0;
|
||||
}
|
||||
return j3 - j2;
|
||||
}
|
||||
|
||||
public static long a(String str, int i) {
|
||||
Preconditions.a(str);
|
||||
if (str.length() == 0) {
|
||||
throw new NumberFormatException("empty string");
|
||||
}
|
||||
if (i < 2 || i > 36) {
|
||||
throw new NumberFormatException("illegal radix: " + i);
|
||||
}
|
||||
int i2 = c[i] - 1;
|
||||
long j = 0;
|
||||
for (int i3 = 0; i3 < str.length(); i3++) {
|
||||
int digit = Character.digit(str.charAt(i3), i);
|
||||
if (digit == -1) {
|
||||
throw new NumberFormatException(str);
|
||||
}
|
||||
if (i3 > i2 && a(j, digit, i)) {
|
||||
throw new NumberFormatException("Too large for unsigned long: " + str);
|
||||
}
|
||||
j = (j * i) + digit;
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
public static String b(long j) {
|
||||
return a(j, 10);
|
||||
}
|
||||
|
||||
private static boolean a(long j, int i, int i2) {
|
||||
if (j < 0) {
|
||||
return true;
|
||||
}
|
||||
long[] jArr = a;
|
||||
if (j < jArr[i2]) {
|
||||
return false;
|
||||
}
|
||||
return j > jArr[i2] || i > b[i2];
|
||||
}
|
||||
|
||||
public static String a(long j, int i) {
|
||||
long b2;
|
||||
Preconditions.a(i >= 2 && i <= 36, "radix (%s) must be between Character.MIN_RADIX and Character.MAX_RADIX", i);
|
||||
if (j == 0) {
|
||||
return "0";
|
||||
}
|
||||
if (j > 0) {
|
||||
return Long.toString(j, i);
|
||||
}
|
||||
char[] cArr = new char[64];
|
||||
int length = cArr.length;
|
||||
int i2 = i - 1;
|
||||
if ((i & i2) == 0) {
|
||||
int numberOfTrailingZeros = Integer.numberOfTrailingZeros(i);
|
||||
do {
|
||||
length--;
|
||||
cArr[length] = Character.forDigit(((int) j) & i2, i);
|
||||
j >>>= numberOfTrailingZeros;
|
||||
} while (j != 0);
|
||||
} else {
|
||||
if ((i & 1) == 0) {
|
||||
b2 = (j >>> 1) / (i >>> 1);
|
||||
} else {
|
||||
b2 = b(j, i);
|
||||
}
|
||||
long j2 = i;
|
||||
length--;
|
||||
cArr[length] = Character.forDigit((int) (j - (b2 * j2)), i);
|
||||
while (b2 > 0) {
|
||||
length--;
|
||||
cArr[length] = Character.forDigit((int) (b2 % j2), i);
|
||||
b2 /= j2;
|
||||
}
|
||||
}
|
||||
return new String(cArr, length, cArr.length - length);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user