Package ch.hevs.kart.utils
Class Limits
java.lang.Object
ch.hevs.kart.utils.Limits
Offers static methods in order to limit values to a given range.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Comparable<T>>
Tlimit
(T value, T min, T max) Generic limit function.
-
Constructor Details
-
Limits
public Limits()
-
-
Method Details
-
limit
Generic limit function. Limits the given value to the given range (min, max).
- Type Parameters:
T
- The type of the value and limits have to implement the Comparable interface.- Parameters:
value
- The input value to limit.min
- The minimal value.max
- The maximal allowed value.- Returns:
- Value limited to the given limits (min, max).
-