public final class XMath extends Object
| Modifier and Type | Method and Description |
|---|---|
static double |
limit(double value,
double min,
double max)
Limits a value between two others:
If
value is lower than min, returns
min.
If value is greater than max, returns
max.
Otherwise, returns value.
|
static float |
limit(float value,
float min,
float max)
Limits a value between two others:
If
value is lower than min, returns
min.
If value is greater than max, returns
max.
Otherwise, returns value.
|
static int |
limit(int value,
int min,
int max)
Limits a value between two others:
If
value is lower than min, returns
min.
If value is greater than max, returns
max.
Otherwise, returns value.
|
static long |
limit(long value,
long min,
long max)
Limits a value between two others:
If
value is lower than min, returns
min.
If value is greater than max, returns
max.
Otherwise, returns value.
|
public static double limit(double value,
double min,
double max)
value is lower than min, returns
min.value is greater than max, returns
max.value.value - the value to limitmin - the lower boundmax - the upper boundIllegalArgumentException - if min is greater than maxpublic static float limit(float value,
float min,
float max)
value is lower than min, returns
min.value is greater than max, returns
max.value.value - the value to limitmin - the lower boundmax - the upper boundIllegalArgumentException - if min is greater than maxpublic static int limit(int value,
int min,
int max)
value is lower than min, returns
min.value is greater than max, returns
max.value.value - the value to limitmin - the lower boundmax - the upper boundIllegalArgumentException - if min is greater than maxpublic static long limit(long value,
long min,
long max)
value is lower than min, returns
min.value is greater than max, returns
max.value.value - the value to limitmin - the lower boundmax - the upper boundIllegalArgumentException - if min is greater than max