List of utility methods to do Integer Clamp
int | clamp(int x, int min, int max) clamp if (x > max) return max; if (x > min) return x; return min; |
String | clamp(String string, int maxChars) clamp if (containsData(string) && string.length() > maxChars) { string = string.substring(0, maxChars) + "..."; return string; |
int | clamp_int(int num, int min, int max) Returns the value of the first parameter, clamped to be within the lower and upper limits given by the second and third parameters. return num < min ? min : (num > max ? max : num);
|
int | clamp_wrap(int a, int x, int y) Returns the given double clamped between the two values (wraps around if out of range). return a < x ? y - (x - a) % (y - x) : a > y ? x + (a - y) % (y - x) : a;
|
int | clampAngle(int angle) Adjust the angle so that his value is in range [-180;180[ angle = angle % 360; if (angle >= 180) { angle -= 360; if (angle < -180) { angle += 360; return angle; ... |
byte | clampByte(int in) Clamps a number to the range supported by byte data type. return (in > 0xFF ? (byte) 0xFF : (in >= 0 ? (byte) in : (byte) 0)); |
int | clampColor(int c) clamp Color return c < 0 ? 0 : c > 255 ? 255 : c;
|
int | clampColorInt(int color) clamp Color Int return (color < 0) ? 0 : (color > RGB_WHITE) ? RGB_WHITE : color;
|
int | CLAMPED_Wr(long ITERW, int FBZCP) CLAMPE Wr int RESULT = (short) ((ITERW) >> 32); if (!FBZCP_RGBZW_CLAMP(FBZCP)) { RESULT &= 0xffff; if (RESULT == 0xffff) RESULT = 0; else if (RESULT == 0x100) RESULT = 0xff; RESULT &= 0xff; ... |
int | clampI(int a, int min, int max) clamp I return a < min ? min : (a > max ? max : a);
|