Package com.io7m.junsigned.ranges
Interface UnsignedRangeInclusiveIType
- All Known Implementing Classes:
UnsignedRangeInclusiveI
@Immutable
public interface UnsignedRangeInclusiveIType
An inclusive range with
int components.-
Method Summary
Modifier and TypeMethodDescriptiondefault voidCheck preconditions for the type.default booleanincludesValue(int value) Determine if the given value is included in this range.default intinterval()Retrieve the number of values in the range[lower, upper].default booleanDetermine if the given range is included in this range.intlower()intupper()
-
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
@Derived 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:
trueiffvalue >= this.getLower() && value <= this.getUpper().
-
isIncludedIn
Determine if the given range is included in this range.
- Parameters:
other- The given range- Returns:
trueiffthis.getLower() >= other.getLower() && this.getUpper() <= other.getUpper().
-
checkPreconditions
@Check default void checkPreconditions()Check preconditions for the type.
-