List of utility methods to do Integer Clamp
int | clamp(int ptr, int size) clamp return clamp(ptr, 0, size - 1);
|
int | clamp(int v, int min, int max) clamp if (v < min) v = min; if (v > max) v = max; return v; |
int | clamp(int v, int min, int max) clamp return Math.max(Math.min(v, max), min);
|
int | clamp(int v, int min, int max) Clamps the specified value into the given range. return (v < min ? min : (v > max ? max : v));
|
int | clamp(int val, int min, int max) clamp val = Math.min(val, max); val = Math.max(val, min); return val; |
int | clamp(int value, final int minimum, final int maximum) clamp if (minimum > maximum) { throw new IllegalArgumentException( "The minimum " + minimum + " is larger than the maximum " + maximum + ", possible bug?"); if (value < minimum) { value = minimum; } else if (value > maximum) { value = maximum; ... |
int | clamp(int value, int a, int b) Returns the passed in value if it resides within the specified range (inclusive). int min = (a > b) ? b : a; int max = (a > b) ? a : b; if (value < min) value = min; else if (value > max) value = max; return value; |
int | clamp(int value, int low, int high) clamp return (int) clamp((double) value, (double) low, (double) high); |
int | clamp(int value, int low, int high) Clamps the supplied value to between low and high (both inclusive). if (value < low) return low; if (value > high) return high; return value; |
int | clamp(int value, int min, int max) Ensures that a values does not leave a range. return Math.min(Math.max(value, min), max);
|