- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
155 lines
5.2 KiB
Java
155 lines
5.2 KiB
Java
package androidx.core.util;
|
|
|
|
import android.text.TextUtils;
|
|
import androidx.annotation.IntRange;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.annotation.RestrictTo;
|
|
import java.util.Locale;
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
/* loaded from: classes.dex */
|
|
public final class Preconditions {
|
|
public static void checkArgument(boolean z) {
|
|
if (!z) {
|
|
throw new IllegalArgumentException();
|
|
}
|
|
}
|
|
|
|
public static void checkArgument(boolean z, @NonNull Object obj) {
|
|
if (!z) {
|
|
throw new IllegalArgumentException(String.valueOf(obj));
|
|
}
|
|
}
|
|
|
|
public static void checkArgument(boolean z, @NonNull String str, @NonNull Object... objArr) {
|
|
if (!z) {
|
|
throw new IllegalArgumentException(String.format(str, objArr));
|
|
}
|
|
}
|
|
|
|
@NonNull
|
|
public static <T extends CharSequence> T checkStringNotEmpty(@Nullable T t) {
|
|
if (TextUtils.isEmpty(t)) {
|
|
throw new IllegalArgumentException();
|
|
}
|
|
return t;
|
|
}
|
|
|
|
@NonNull
|
|
public static <T extends CharSequence> T checkStringNotEmpty(@Nullable T t, @NonNull Object obj) {
|
|
if (TextUtils.isEmpty(t)) {
|
|
throw new IllegalArgumentException(String.valueOf(obj));
|
|
}
|
|
return t;
|
|
}
|
|
|
|
@NonNull
|
|
public static <T extends CharSequence> T checkStringNotEmpty(@Nullable T t, @NonNull String str, @NonNull Object... objArr) {
|
|
if (TextUtils.isEmpty(t)) {
|
|
throw new IllegalArgumentException(String.format(str, objArr));
|
|
}
|
|
return t;
|
|
}
|
|
|
|
@NonNull
|
|
public static <T> T checkNotNull(@Nullable T t) {
|
|
t.getClass();
|
|
return t;
|
|
}
|
|
|
|
@NonNull
|
|
public static <T> T checkNotNull(@Nullable T t, @NonNull Object obj) {
|
|
if (t != null) {
|
|
return t;
|
|
}
|
|
throw new NullPointerException(String.valueOf(obj));
|
|
}
|
|
|
|
public static void checkState(boolean z, @Nullable String str) {
|
|
if (!z) {
|
|
throw new IllegalStateException(str);
|
|
}
|
|
}
|
|
|
|
public static void checkState(boolean z) {
|
|
checkState(z, null);
|
|
}
|
|
|
|
public static int checkFlagsArgument(int i, int i2) {
|
|
if ((i & i2) == i) {
|
|
return i;
|
|
}
|
|
throw new IllegalArgumentException("Requested flags 0x" + Integer.toHexString(i) + ", but only 0x" + Integer.toHexString(i2) + " are allowed");
|
|
}
|
|
|
|
@IntRange(from = 0)
|
|
public static int checkArgumentNonnegative(int i, @Nullable String str) {
|
|
if (i >= 0) {
|
|
return i;
|
|
}
|
|
throw new IllegalArgumentException(str);
|
|
}
|
|
|
|
@IntRange(from = 0)
|
|
public static int checkArgumentNonnegative(int i) {
|
|
if (i >= 0) {
|
|
return i;
|
|
}
|
|
throw new IllegalArgumentException();
|
|
}
|
|
|
|
public static int checkArgumentInRange(int i, int i2, int i3, @NonNull String str) {
|
|
if (i < i2) {
|
|
throw new IllegalArgumentException(String.format(Locale.US, "%s is out of range of [%d, %d] (too low)", str, Integer.valueOf(i2), Integer.valueOf(i3)));
|
|
}
|
|
if (i <= i3) {
|
|
return i;
|
|
}
|
|
throw new IllegalArgumentException(String.format(Locale.US, "%s is out of range of [%d, %d] (too high)", str, Integer.valueOf(i2), Integer.valueOf(i3)));
|
|
}
|
|
|
|
public static long checkArgumentInRange(long j, long j2, long j3, @NonNull String str) {
|
|
if (j < j2) {
|
|
throw new IllegalArgumentException(String.format(Locale.US, "%s is out of range of [%d, %d] (too low)", str, Long.valueOf(j2), Long.valueOf(j3)));
|
|
}
|
|
if (j <= j3) {
|
|
return j;
|
|
}
|
|
throw new IllegalArgumentException(String.format(Locale.US, "%s is out of range of [%d, %d] (too high)", str, Long.valueOf(j2), Long.valueOf(j3)));
|
|
}
|
|
|
|
public static float checkArgumentInRange(float f, float f2, float f3, @NonNull String str) {
|
|
if (f < f2) {
|
|
throw new IllegalArgumentException(String.format(Locale.US, "%s is out of range of [%f, %f] (too low)", str, Float.valueOf(f2), Float.valueOf(f3)));
|
|
}
|
|
if (f <= f3) {
|
|
return f;
|
|
}
|
|
throw new IllegalArgumentException(String.format(Locale.US, "%s is out of range of [%f, %f] (too high)", str, Float.valueOf(f2), Float.valueOf(f3)));
|
|
}
|
|
|
|
public static double checkArgumentInRange(double d, double d2, double d3, @NonNull String str) {
|
|
if (d < d2) {
|
|
throw new IllegalArgumentException(String.format(Locale.US, "%s is out of range of [%f, %f] (too low)", str, Double.valueOf(d2), Double.valueOf(d3)));
|
|
}
|
|
if (d <= d3) {
|
|
return d;
|
|
}
|
|
throw new IllegalArgumentException(String.format(Locale.US, "%s is out of range of [%f, %f] (too high)", str, Double.valueOf(d2), Double.valueOf(d3)));
|
|
}
|
|
|
|
public static float checkArgumentFinite(float f, @NonNull String str) {
|
|
if (Float.isNaN(f)) {
|
|
throw new IllegalArgumentException(str + " must not be NaN");
|
|
}
|
|
if (!Float.isInfinite(f)) {
|
|
return f;
|
|
}
|
|
throw new IllegalArgumentException(str + " must not be infinite");
|
|
}
|
|
|
|
private Preconditions() {
|
|
}
|
|
}
|