Rabbit-R1/switch port/java/sources/com/google/common/base/Preconditions.java
2024-05-21 17:08:36 -04:00

541 lines
19 KiB
Java

package com.google.common.base;
import javax.annotation.CheckForNull;
@ElementTypesAreNonnullByDefault
/* loaded from: classes2.dex */
public final class Preconditions {
private Preconditions() {
}
public static void checkArgument(boolean z) {
if (!z) {
throw new IllegalArgumentException();
}
}
public static void checkArgument(boolean z, @CheckForNull Object obj) {
if (!z) {
throw new IllegalArgumentException(String.valueOf(obj));
}
}
public static void checkArgument(boolean z, String str, @CheckForNull Object... objArr) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, objArr));
}
}
public static void checkArgument(boolean z, String str, char c) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, Character.valueOf(c)));
}
}
public static void checkArgument(boolean z, String str, int i) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, Integer.valueOf(i)));
}
}
public static void checkArgument(boolean z, String str, long j) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, Long.valueOf(j)));
}
}
public static void checkArgument(boolean z, String str, @CheckForNull Object obj) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, obj));
}
}
public static void checkArgument(boolean z, String str, char c, char c2) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, Character.valueOf(c), Character.valueOf(c2)));
}
}
public static void checkArgument(boolean z, String str, char c, int i) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, Character.valueOf(c), Integer.valueOf(i)));
}
}
public static void checkArgument(boolean z, String str, char c, long j) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, Character.valueOf(c), Long.valueOf(j)));
}
}
public static void checkArgument(boolean z, String str, char c, @CheckForNull Object obj) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, Character.valueOf(c), obj));
}
}
public static void checkArgument(boolean z, String str, int i, char c) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, Integer.valueOf(i), Character.valueOf(c)));
}
}
public static void checkArgument(boolean z, String str, int i, int i2) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, Integer.valueOf(i), Integer.valueOf(i2)));
}
}
public static void checkArgument(boolean z, String str, int i, long j) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, Integer.valueOf(i), Long.valueOf(j)));
}
}
public static void checkArgument(boolean z, String str, int i, @CheckForNull Object obj) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, Integer.valueOf(i), obj));
}
}
public static void checkArgument(boolean z, String str, long j, char c) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, Long.valueOf(j), Character.valueOf(c)));
}
}
public static void checkArgument(boolean z, String str, long j, int i) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, Long.valueOf(j), Integer.valueOf(i)));
}
}
public static void checkArgument(boolean z, String str, long j, long j2) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, Long.valueOf(j), Long.valueOf(j2)));
}
}
public static void checkArgument(boolean z, String str, long j, @CheckForNull Object obj) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, Long.valueOf(j), obj));
}
}
public static void checkArgument(boolean z, String str, @CheckForNull Object obj, char c) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, obj, Character.valueOf(c)));
}
}
public static void checkArgument(boolean z, String str, @CheckForNull Object obj, int i) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, obj, Integer.valueOf(i)));
}
}
public static void checkArgument(boolean z, String str, @CheckForNull Object obj, long j) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, obj, Long.valueOf(j)));
}
}
public static void checkArgument(boolean z, String str, @CheckForNull Object obj, @CheckForNull Object obj2) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, obj, obj2));
}
}
public static void checkArgument(boolean z, String str, @CheckForNull Object obj, @CheckForNull Object obj2, @CheckForNull Object obj3) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, obj, obj2, obj3));
}
}
public static void checkArgument(boolean z, String str, @CheckForNull Object obj, @CheckForNull Object obj2, @CheckForNull Object obj3, @CheckForNull Object obj4) {
if (!z) {
throw new IllegalArgumentException(Strings.lenientFormat(str, obj, obj2, obj3, obj4));
}
}
public static void checkState(boolean z) {
if (!z) {
throw new IllegalStateException();
}
}
public static void checkState(boolean z, @CheckForNull Object obj) {
if (!z) {
throw new IllegalStateException(String.valueOf(obj));
}
}
public static void checkState(boolean z, @CheckForNull String str, @CheckForNull Object... objArr) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, objArr));
}
}
public static void checkState(boolean z, String str, char c) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, Character.valueOf(c)));
}
}
public static void checkState(boolean z, String str, int i) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, Integer.valueOf(i)));
}
}
public static void checkState(boolean z, String str, long j) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, Long.valueOf(j)));
}
}
public static void checkState(boolean z, String str, @CheckForNull Object obj) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, obj));
}
}
public static void checkState(boolean z, String str, char c, char c2) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, Character.valueOf(c), Character.valueOf(c2)));
}
}
public static void checkState(boolean z, String str, char c, int i) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, Character.valueOf(c), Integer.valueOf(i)));
}
}
public static void checkState(boolean z, String str, char c, long j) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, Character.valueOf(c), Long.valueOf(j)));
}
}
public static void checkState(boolean z, String str, char c, @CheckForNull Object obj) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, Character.valueOf(c), obj));
}
}
public static void checkState(boolean z, String str, int i, char c) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, Integer.valueOf(i), Character.valueOf(c)));
}
}
public static void checkState(boolean z, String str, int i, int i2) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, Integer.valueOf(i), Integer.valueOf(i2)));
}
}
public static void checkState(boolean z, String str, int i, long j) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, Integer.valueOf(i), Long.valueOf(j)));
}
}
public static void checkState(boolean z, String str, int i, @CheckForNull Object obj) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, Integer.valueOf(i), obj));
}
}
public static void checkState(boolean z, String str, long j, char c) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, Long.valueOf(j), Character.valueOf(c)));
}
}
public static void checkState(boolean z, String str, long j, int i) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, Long.valueOf(j), Integer.valueOf(i)));
}
}
public static void checkState(boolean z, String str, long j, long j2) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, Long.valueOf(j), Long.valueOf(j2)));
}
}
public static void checkState(boolean z, String str, long j, @CheckForNull Object obj) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, Long.valueOf(j), obj));
}
}
public static void checkState(boolean z, String str, @CheckForNull Object obj, char c) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, obj, Character.valueOf(c)));
}
}
public static void checkState(boolean z, String str, @CheckForNull Object obj, int i) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, obj, Integer.valueOf(i)));
}
}
public static void checkState(boolean z, String str, @CheckForNull Object obj, long j) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, obj, Long.valueOf(j)));
}
}
public static void checkState(boolean z, String str, @CheckForNull Object obj, @CheckForNull Object obj2) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, obj, obj2));
}
}
public static void checkState(boolean z, String str, @CheckForNull Object obj, @CheckForNull Object obj2, @CheckForNull Object obj3) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, obj, obj2, obj3));
}
}
public static void checkState(boolean z, String str, @CheckForNull Object obj, @CheckForNull Object obj2, @CheckForNull Object obj3, @CheckForNull Object obj4) {
if (!z) {
throw new IllegalStateException(Strings.lenientFormat(str, obj, obj2, obj3, obj4));
}
}
public static <T> T checkNotNull(@CheckForNull T t) {
t.getClass();
return t;
}
public static <T> T checkNotNull(@CheckForNull T t, @CheckForNull Object obj) {
if (t != null) {
return t;
}
throw new NullPointerException(String.valueOf(obj));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, @CheckForNull Object... objArr) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, objArr));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, char c) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, Character.valueOf(c)));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, int i) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, Integer.valueOf(i)));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, long j) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, Long.valueOf(j)));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, @CheckForNull Object obj) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, obj));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, char c, char c2) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, Character.valueOf(c), Character.valueOf(c2)));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, char c, int i) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, Character.valueOf(c), Integer.valueOf(i)));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, char c, long j) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, Character.valueOf(c), Long.valueOf(j)));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, char c, @CheckForNull Object obj) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, Character.valueOf(c), obj));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, int i, char c) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, Integer.valueOf(i), Character.valueOf(c)));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, int i, int i2) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, Integer.valueOf(i), Integer.valueOf(i2)));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, int i, long j) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, Integer.valueOf(i), Long.valueOf(j)));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, int i, @CheckForNull Object obj) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, Integer.valueOf(i), obj));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, long j, char c) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, Long.valueOf(j), Character.valueOf(c)));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, long j, int i) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, Long.valueOf(j), Integer.valueOf(i)));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, long j, long j2) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, Long.valueOf(j), Long.valueOf(j2)));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, long j, @CheckForNull Object obj) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, Long.valueOf(j), obj));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, @CheckForNull Object obj, char c) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, obj, Character.valueOf(c)));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, @CheckForNull Object obj, int i) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, obj, Integer.valueOf(i)));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, @CheckForNull Object obj, long j) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, obj, Long.valueOf(j)));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, @CheckForNull Object obj, @CheckForNull Object obj2) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, obj, obj2));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, @CheckForNull Object obj, @CheckForNull Object obj2, @CheckForNull Object obj3) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, obj, obj2, obj3));
}
public static <T> T checkNotNull(@CheckForNull T t, String str, @CheckForNull Object obj, @CheckForNull Object obj2, @CheckForNull Object obj3, @CheckForNull Object obj4) {
if (t != null) {
return t;
}
throw new NullPointerException(Strings.lenientFormat(str, obj, obj2, obj3, obj4));
}
public static int checkElementIndex(int i, int i2) {
return checkElementIndex(i, i2, "index");
}
public static int checkElementIndex(int i, int i2, String str) {
if (i < 0 || i >= i2) {
throw new IndexOutOfBoundsException(badElementIndex(i, i2, str));
}
return i;
}
private static String badElementIndex(int i, int i2, String str) {
if (i < 0) {
return Strings.lenientFormat("%s (%s) must not be negative", str, Integer.valueOf(i));
}
if (i2 < 0) {
throw new IllegalArgumentException(new StringBuilder(26).append("negative size: ").append(i2).toString());
}
return Strings.lenientFormat("%s (%s) must be less than size (%s)", str, Integer.valueOf(i), Integer.valueOf(i2));
}
public static int checkPositionIndex(int i, int i2) {
return checkPositionIndex(i, i2, "index");
}
public static int checkPositionIndex(int i, int i2, String str) {
if (i < 0 || i > i2) {
throw new IndexOutOfBoundsException(badPositionIndex(i, i2, str));
}
return i;
}
private static String badPositionIndex(int i, int i2, String str) {
if (i < 0) {
return Strings.lenientFormat("%s (%s) must not be negative", str, Integer.valueOf(i));
}
if (i2 < 0) {
throw new IllegalArgumentException(new StringBuilder(26).append("negative size: ").append(i2).toString());
}
return Strings.lenientFormat("%s (%s) must not be greater than size (%s)", str, Integer.valueOf(i), Integer.valueOf(i2));
}
public static void checkPositionIndexes(int i, int i2, int i3) {
if (i < 0 || i2 < i || i2 > i3) {
throw new IndexOutOfBoundsException(badPositionIndexes(i, i2, i3));
}
}
private static String badPositionIndexes(int i, int i2, int i3) {
if (i < 0 || i > i3) {
return badPositionIndex(i, i3, "start index");
}
if (i2 < 0 || i2 > i3) {
return badPositionIndex(i2, i3, "end index");
}
return Strings.lenientFormat("end index (%s) must not be less than start index (%s)", Integer.valueOf(i2), Integer.valueOf(i));
}
}