java.lang.Object
org.jhotdraw8.base.util.MathUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic doubleclamp(double value, double min, double max) Clamps a value to the given range.static floatclamp(float value, float min, float max) Clamps a value to the given range.static intclamp(int value, int min, int max) Clamps a value to the given range.static longclamp(long value, long min, long max) Clamps a value to the given range.
-
Method Details
-
clamp
public static long clamp(long value, long min, long max) Clamps a value to the given range.- Parameters:
value- the valuemin- the lower bound of the rangemax- the upper bound of the range- Returns:
- the constrained value
-
clamp
public static double clamp(double value, double min, double max) Clamps a value to the given range.- Parameters:
value- the valuemin- the lower bound of the rangemax- the upper bound of the range- Returns:
- the constrained value
-
clamp
public static float clamp(float value, float min, float max) Clamps a value to the given range.- Parameters:
value- the valuemin- the lower bound of the rangemax- the upper bound of the range- Returns:
- the constrained value
-
clamp
public static int clamp(int value, int min, int max) Clamps a value to the given range.- Parameters:
value- the valuemin- the lower bound of the rangemax- the upper bound of the range- Returns:
- the constrained value
-