Package uk.gov.gchq.koryphe.util
Class RangeUtil
- java.lang.Object
-
- uk.gov.gchq.koryphe.util.RangeUtil
-
public final class RangeUtil extends Object
A utility class for Ranges.
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEFAULT_FULLY_CONTAINED
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends Comparable<T>>
booleaninRange(Comparable<T> startValue, Comparable<T> endValue, T rangeStart, T rangeEnd, Boolean startInclusive, Boolean endInclusive)
Checks the start and end values within a provided range.static <T extends Comparable<T>>
booleaninRange(Comparable<T> startValue, Comparable<T> endValue, T rangeStart, T rangeEnd, Boolean startInclusive, Boolean endInclusive, Boolean startFullyContained, Boolean endFullyContained)
Checks the start and end values within a provided range.
-
-
-
Field Detail
-
DEFAULT_FULLY_CONTAINED
public static final boolean DEFAULT_FULLY_CONTAINED
- See Also:
- Constant Field Values
-
-
Method Detail
-
inRange
public static <T extends Comparable<T>> boolean inRange(Comparable<T> startValue, Comparable<T> endValue, T rangeStart, T rangeEnd, Boolean startInclusive, Boolean endInclusive)
Checks the start and end values within a provided range.- Type Parameters:
T
- the type of the range- Parameters:
startValue
- the start value to testendValue
- the end value to testrangeStart
- the start of the defined allowed rangerangeEnd
- the end of the defined allowed rangestartInclusive
- true if the start of the range is inclusiveendInclusive
- true if the end of the range is inclusive- Returns:
- true if the start and end values are within the range.
-
inRange
public static <T extends Comparable<T>> boolean inRange(Comparable<T> startValue, Comparable<T> endValue, T rangeStart, T rangeEnd, Boolean startInclusive, Boolean endInclusive, Boolean startFullyContained, Boolean endFullyContained)
Checks the start and end values within a provided range.- Type Parameters:
T
- the type of the range- Parameters:
startValue
- the start value to testendValue
- the end value to testrangeStart
- the start of the defined allowed rangerangeEnd
- the start of the defined allowed rangestartInclusive
- true if the start of the range is inclusiveendInclusive
- true if the end of the range is inclusivestartFullyContained
- true if the start of the range is fully containedendFullyContained
- true if the end of the range is fully contained- Returns:
- true if the start and end values are within the range.
-
-