public final class Assert
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
private |
Assert() |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkIndex(int index,
int limit) |
static boolean |
checkIndex(int index,
int start,
int limit) |
static boolean |
checkNotEmpty(java.util.Collection collection)
Throws
IllegalArgumentException if string |
static boolean |
checkNotSpecialWidthHeight(int value) |
static int |
reviseIndex(int index,
int limit) |
static int |
reviseIndex(int index,
int start,
int limit) |
static float |
reviseInterval(float x,
float a,
float b,
boolean left_open,
boolean right_open)
Open : { x | a < x < b }
Closed : { x | a <= x <= b }
Left-closed,right-open : { x | a <= x < b }
Left-open,right-closed : { x | a < x <= b }
|
static int |
reviseInterval(int x,
int a,
int b,
boolean left_open,
boolean right_open)
Open : { x | a < x < b }
Closed : { x | a <= x <= b }
Left-closed,right-open : { x | a <= x < b }
Left-open,right-closed : { x | a < x <= b }
|
static long |
reviseInterval(long x,
long a,
long b,
boolean left_open,
boolean right_open)
Open : { x | a < x < b }
Closed : { x | a <= x <= b }
Left-closed,right-open : { x | a <= x < b }
Left-open,right-closed : { x | a < x <= b }
|
public static boolean checkIndex(int index, int start, int limit)
index
- The index to check.start
- The start of the allowed range (inclusive).limit
- The end of the allowed range (exclusive).index
outside the
specified bounds. index
falls outside the specified bounds.
public static boolean checkIndex(int index, int limit)
index
- The index to check.limit
- The end of the allowed range (exclusive).index
outside the
specified bounds. index
falls outside the specified bounds.
public static boolean checkNotEmpty(java.util.Collection collection)
IllegalArgumentException
if string
collection
- Collection
public static boolean checkNotSpecialWidthHeight(int value)
ViewGroup.LayoutParams.MATCH_PARENT
,
ViewGroup.LayoutParams.WRAP_CONTENT
public static int reviseInterval(int x, int a, int b, boolean left_open, boolean right_open)
Open : { x | a < x < b } Closed : { x | a <= x <= b } Left-closed,right-open : { x | a <= x < b } Left-open,right-closed : { x | a < x <= b }WARNING: open interval special situation(a>b), return origin x.
left_open
- True open(a < x), false closed(a <= x)right_open
- True open(x > b), false closed(x >= b)public static long reviseInterval(long x, long a, long b, boolean left_open, boolean right_open)
Open : { x | a < x < b } Closed : { x | a <= x <= b } Left-closed,right-open : { x | a <= x < b } Left-open,right-closed : { x | a < x <= b }WARNING: open interval special situation(a>b), return origin x.
left_open
- True open(a < x), false closed(a <= x)right_open
- True open(x > b), false closed(x >= b)public static float reviseInterval(float x, float a, float b, boolean left_open, boolean right_open)
Open : { x | a < x < b } Closed : { x | a <= x <= b } Left-closed,right-open : { x | a <= x < b } Left-open,right-closed : { x | a < x <= b }WARNING: open interval special situation(a>b), return origin x.
left_open
- True open(a < x), false closed(a <= x)right_open
- True open(x > b), false closed(x >= b)public static int reviseIndex(int index, int start, int limit)
index
- The index to check.start
- The start of the allowed range (inclusive).limit
- The end of the allowed range (exclusive).public static int reviseIndex(int index, int limit)
index
- The index to check.limit
- The end of the allowed range (exclusive).