Package com.io7m.jranges
Interface RangeInclusiveIType
- All Known Implementing Classes:
RangeInclusiveI
@Immutable
public interface RangeInclusiveIType
An inclusive range with
int
components.-
Method Summary
Modifier and TypeMethodDescriptiondefault void
Check preconditions for the type.default boolean
includesValue
(int value) Determine if the given value is included in this range.default int
interval()
Retrieve the number of values in the range[lower, upper]
.default boolean
isIncludedIn
(RangeInclusiveI other) Determine if the given range is included in this range.int
lower()
int
upper()
-
Method Details
-
lower
@Parameter int lower()- Returns:
- The lower bound of the inclusive range.
-
upper
@Parameter int upper()- Returns:
- The upper bound of the inclusive range.
-
interval
default int interval()Retrieve the number of values in the range
[lower, upper]
. That is,(upper - lower) + 1
.- Returns:
- The number of values in the range
-
includesValue
default boolean includesValue(int value) Determine if the given value is included in this range.
- Parameters:
value
- The given value- Returns:
true
iffvalue >= this.getLower() && value <= this.getUpper()
.
-
isIncludedIn
Determine if the given range is included in this range.
- Parameters:
other
- The given range- Returns:
true
iffthis.getLower() >= other.getLower() && this.getUpper() <= other.getUpper()
.
-
checkPreconditions
@Check default void checkPreconditions()Check preconditions for the type.
-