java.lang.Object
org.tquadrat.foundation.util.RangeFunctions
@UtilityClass
@ClassVersion(sourceVersion="$Id: RangeFunctions.java 1032 2022-04-10 17:27:44Z tquadrat $")
@API(status=STABLE,
     since="0.0.7")
public final class RangeFunctions
extends Object
Several range checking functions.
The functions in this class support range checking for various types. This can be especially useful for scripting, but is also usable in other contexts.
- Author:
 - Thomas Thrien (thomas.thrien@tquadrat.org)
 - Thanks to:
 - Ben Gidley
 - Version:
 - $Id: RangeFunctions.java 1032 2022-04-10 17:27:44Z tquadrat $
 - Since:
 - 0.0.7
 - UML Diagram
 - 
    
        
UML Diagram for "org.tquadrat.foundation.util.RangeFunctions"
 
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisAbove(char value, char floor) Returnstrueifvalueis abovefloor.static booleanisAbove(double value, double floor) Returnstrueifvalueis abovefloor.static booleanisAbove(long value, long floor) Returnstrueifvalueis abovefloor.static <T> booleanisAbove(Comparable<T> value, T floor) Returnstrueifvalueis abovefloor.static <T> booleanisAbove(Comparable<T> value, T floor, boolean include) Returnstrueifvalueis abovefloor.static <T> booleanisAbove(Comparator<T> comparator, T value, T floor) Returnstrueifvalueis abovefloor.static <T> booleanisAbove(Comparator<T> comparator, T value, T floor, boolean include) Returnstrueifvalueis abovefloor.static booleanisBelow(char value, char ceiling) Returnstrueifvalueis belowceiling.static booleanisBelow(double value, double ceiling) Returnstrueifvalueis belowceiling.static booleanisBelow(long value, long ceiling) Returnstrueifvalueis belowceiling.static <T> booleanisBelow(Comparable<T> value, T ceiling) Returnstrueifvalueis belowceiling.static <T> booleanisBelow(Comparable<T> value, T ceiling, boolean include) Returnstrueifvalueis belowceiling.static <T> booleanisBelow(Comparator<T> comparator, T value, T ceiling) Returnstrueifvalueis belowceiling.static <T> booleanisBelow(Comparator<T> comparator, T value, T ceiling, boolean include) Returnstrueifvalueis belowceiling.static booleanisBetween(char value, char floor, char ceiling) Returnstrueifvalueis betweenfloorandceiling.static booleanisBetween(char value, char floor, char ceiling, boolean include) Returnstrueifvalueis betweenfloorandceiling.static booleanisBetween(double value, double floor, double ceiling) Returnstrueifvalueis betweenfloorandceiling.static booleanisBetween(double value, double floor, double ceiling, boolean include) Returnstrueifvalueis betweenfloorandceiling.static booleanisBetween(long value, long floor, long ceiling) Returnstrueifvalueis betweenfloorandceiling.static booleanisBetween(long value, long floor, long ceiling, boolean include) Returnstrueifvalueis betweenfloorandceiling.static <T> booleanisBetween(Comparable<T> value, T floor, T ceiling) Returnstrueifvalueis betweenfloorandceiling.static <T> booleanisBetween(Comparable<T> value, T floor, T ceiling, boolean include) Returnstrueifvalueis betweenfloorandceiling.static <T> booleanisBetween(Comparator<T> comparator, T value, T floor, T ceiling) Returnstrueifvalueis betweenfloorandceiling.static <T> booleanisBetween(Comparator<T> comparator, T value, T floor, T ceiling, boolean include) Returnstrueifvalueis betweenfloorandceiling. 
- 
Constructor Details
- 
RangeFunctions
private RangeFunctions()No instance is allowed for this class. 
 - 
 - 
Method Details
- 
isAbove
Returnstrueifvalueis abovefloor.- Type Parameters:
 T- The type of the values to check.- Parameters:
 value- The value to compare.floor- The border value.include-trueif the border is included,falseif not.- Returns:
 trueif the given value is greater than the given border value,falseotherwise. Ifincludeistrue, it will be "greater or equal", respectively.
 - 
isAbove
Returnstrueifvalueis abovefloor.- Type Parameters:
 T- The type of the values to check.- Parameters:
 comparator- The comparator that is used for the comparison.value- The value to compare.floor- The border value.include-trueif the border is included,falseif not.- Returns:
 trueif the given value is greater than the given border value,falseotherwise. Ifincludeistrue, it will be "greater or equal", respectively.
 - 
isAbove
Returnstrueifvalueis abovefloor. Ifincludeistrue,flooris included, otherwise it is not part of the range.- Type Parameters:
 T- The type of the values to check.- Parameters:
 value- The value to compare.floor- The border value.- Returns:
 trueif the given value is greater than the given border value,falseotherwise.
 - 
isAbove
Returnstrueifvalueis abovefloor. Ifincludeistrue,flooris included, otherwise it is not part of the range.- Type Parameters:
 T- The type of the values to check.- Parameters:
 comparator- The comparator that is used for the comparison.value- The value to compare.floor- The border value.- Returns:
 trueif the given value is greater than the given border value,falseotherwise.
 - 
isAbove
Returnstrueifvalueis abovefloor.- Parameters:
 value- The value to compare.floor- The border value.- Returns:
 trueif the given value is greater than the given border value,falseotherwise.
 - 
isAbove
Returnstrueifvalueis abovefloor.- Parameters:
 value- The value to compare.floor- The border value.- Returns:
 trueif the given value is greater than the given border value,falseotherwise.
 - 
isAbove
Returnstrueifvalueis abovefloor.- Parameters:
 value- The value to compare.floor- The border value.- Returns:
 trueif the given value is greater than the given border value,falseotherwise.
 - 
isBelow
Returnstrueifvalueis belowceiling. Ifincludeistrue,ceilingis included, otherwise it is not part of the range.- Type Parameters:
 T- The type of the values to check.- Parameters:
 value- The value to compare.ceiling- The border value.include-trueif the border is included,falseif not.- Returns:
 trueif the given value is less than the given border value,falseotherwise. Ifincludeistrue, it will be "less or equal", respectively.
 - 
isBelow
Returnstrueifvalueis belowceiling. Ifincludeistrue,ceilingis included, otherwise it is not part of the range.- Type Parameters:
 T- The type of the values to check.- Parameters:
 comparator- The comparator that is used for the comparison.value- The value to compare.ceiling- The border value.include-trueif the border is included,falseif not.- Returns:
 trueif the given value is less than the given border value,falseotherwise. Ifincludeistrue, it will be "less or equal", respectively.
 - 
isBelow
Returnstrueifvalueis belowceiling.- Type Parameters:
 T- The type of the values to check.- Parameters:
 value- The value to compare.ceiling- The border value.- Returns:
 trueif the given value is less than the given border value,falseotherwise.
 - 
isBelow
Returnstrueifvalueis belowceiling.- Type Parameters:
 T- The type of the values to check.- Parameters:
 comparator- The comparator that is used for the comparison.value- The value to compare.ceiling- The border value.- Returns:
 trueif the given value is less than the given border value,falseotherwise.
 - 
isBelow
Returnstrueifvalueis belowceiling.- Parameters:
 value- The value to compare.ceiling- The border value.- Returns:
 trueif the given value is less than the given border value,falseotherwise.
 - 
isBelow
Returnstrueifvalueis belowceiling.- Parameters:
 value- The value to compare.ceiling- The border value.- Returns:
 trueif the given value is less than the given border value,falseotherwise.
 - 
isBelow
Returnstrueifvalueis belowceiling.- Parameters:
 value- The value to compare.ceiling- The border value.- Returns:
 trueif the given value is less than the given border value,falseotherwise.
 - 
isBetween
Returnstrueifvalueis betweenfloorandceiling. Ifincludeistrue,floorandceilingare included, otherwise they are not in the range.- Type Parameters:
 T- The type of the values to check.- Parameters:
 value- The value to compare.floor- The lower border value.ceiling- The upper border value.include-trueif the borders are included,falseif not.- Returns:
 trueif the given value is greater than the given lower border value and less than the given upper border value,falseotherwise. Ifincludeistrue, it will be "greater or equal" and "less or equal", respectively.
 - 
isBetween
public static <T> boolean isBetween(Comparator<T> comparator, T value, T floor, T ceiling, boolean include) Returnstrueifvalueis betweenfloorandceiling. Ifincludeistrue,floorandceilingare included, otherwise they are not in the range.- Type Parameters:
 T- The type of the values to check.- Parameters:
 comparator- The comparator that is used for the comparison.value- The value to compare.floor- The lower border value.ceiling- The upper border value.include-trueif the borders are included,falseif not.- Returns:
 trueif the given value is greater than the given lower border value and less than the given upper border value,falseotherwise. Ifincludeistrue, it will be "greater or equal" and "less or equal", respectively.
 - 
isBetween
Returnstrueifvalueis betweenfloorandceiling. Ifincludeistrue,floorandceilingare included, otherwise they are not in the range.- Parameters:
 value- The value to compare.floor- The lower border value.ceiling- The upper border value.include-trueif the borders are included,falseif not.- Returns:
 trueif the given value is greater than the given lower border value and less than the given upper border value,falseotherwise. Ifincludeistrue, it will be "greater or equal" and "less or equal", respectively.
 - 
isBetween
Returnstrueifvalueis betweenfloorandceiling. Ifincludeistrue,floorandceilingare included, otherwise they are not in the range.- Parameters:
 value- The value to compare.floor- The lower border value.ceiling- The upper border value.include-trueif the borders are included,falseif not.- Returns:
 trueif the given value is greater than the given lower border value and less than the given upper border value,falseotherwise. Ifincludeistrue, it will be "greater or equal" and "less or equal", respectively.
 - 
isBetween
Returnstrueifvalueis betweenfloorandceiling. Ifincludeistrue,floorandceilingare included, otherwise they are not in the range.- Parameters:
 value- The value to compare.floor- The lower border value.ceiling- The upper border value.include-trueif the borders are included,falseif not.- Returns:
 trueif the given value is greater than the given lower border value and less than the given upper border value,falseotherwise. Ifincludeistrue, it will be "greater or equal" and "less or equal", respectively.
 - 
isBetween
Returnstrueifvalueis betweenfloorandceiling.- Type Parameters:
 T- The type of the values to check.- Parameters:
 value- The value to compare.floor- The lower border value.ceiling- The upper border value.- Returns:
 trueif the given value is greater than the given lower border value and less than the given upper border value,falseotherwise.
 - 
isBetween
Returnstrueifvalueis betweenfloorandceiling.- Type Parameters:
 T- The type of the values to check.- Parameters:
 comparator- The comparator that is used for the comparison.value- The value to compare.floor- The lower border value.ceiling- The upper border value.- Returns:
 trueif the given value is greater than the given lower border value and less than the given upper border value,falseotherwise.
 - 
isBetween
Returnstrueifvalueis betweenfloorandceiling.- Parameters:
 value- The value to compare.floor- The lower border value.ceiling- The upper border value.- Returns:
 trueif the given value is greater than the given lower border value and less than the given upper border value,falseotherwise.
 - 
isBetween
Returnstrueifvalueis betweenfloorandceiling.- Parameters:
 value- The value to compare.floor- The lower border value.ceiling- The upper border value.- Returns:
 trueif the given value is greater than the given lower border value and less than the given upper border value,falseotherwise.
 - 
isBetween
Returnstrueifvalueis betweenfloorandceiling.- Parameters:
 value- The value to compare.floor- The lower border value.ceiling- The upper border value.- Returns:
 trueif the given value is greater than the given lower border value and less than the given upper border value,falseotherwise.
 
 - 
 
