@Immutable @ParametersAreNonnullByDefault public interface IntRange
| Modifier and Type | Method and Description |
|---|---|
static IntRange |
all()
Creates a range that contains every value of type
C. |
static IntRange |
and(IntRange r1,
IntRange r2)
Creates a range that contains all values enclosed by both ranges.
|
static IntRange |
atLeast(int lower)
Creates a range that contains all values greater than or equal to
lower. |
static IntRange |
atMost(int upper)
Creates a range that contains all values less than or equal to
upper. |
static IntRange |
closed(int lower,
int upper)
Creates a range that contains all values greater than or equal to
lower and less than or equal to upper. |
static IntRange |
closedOpen(int lower,
int upper)
Creates a range that contains all values greater than or equal to
lower and strictly less than upper. |
boolean |
contains(int value)
Returns
true if value is within the bounds of this range. |
default boolean |
containsAll(Iterable<Integer> values)
Returns
true if every element in values is contained in this range. |
static IntRange |
empty()
Creates a range that does not contain any value.
|
static IntRange |
greaterThan(int lower)
Creates a range that contains all values strictly greater than
lower. |
static IntRange |
lessThan(int upper)
Creates a range that contains all values strictly less than
upper. |
static IntRange |
open(int lower,
int upper)
Creates a range that contains all values strictly greater than
lower and strictly less than upper. |
static IntRange |
openClosed(int lower,
int upper)
Creates a range that contains all values strictly greater than
lower and less than or equal to upper. |
static IntRange |
or(IntRange r1,
IntRange r2)
Creates a range that contains all values enclosed by at least one range.
|
static IntRange |
singleton(int value)
Creates a range that contains only the given
value. |
static IntRange |
xor(IntRange r1,
IntRange r2)
Creates a range that contains all values enclosed by one range, but not another.
|
@Nonnull static IntRange open(int lower, int upper)
lower and strictly less than upper.lower - the lower bound of the range (exclusive)upper - the upper bound of the range (exclusive)IllegalArgumentException - if lower is greater than upper@Nonnull static IntRange closed(int lower, int upper)
lower and less than or equal to upper.lower - the lower bound of the range (inclusive)upper - the upper bound of the range (inclusive)IllegalArgumentException - if lower is greater than upper@Nonnull static IntRange openClosed(int lower, int upper)
lower and less than or equal to upper.lower - the lower bound of the range (exclusive)upper - the upper bound of the range (inclusive)IllegalArgumentException - if lower is greater than upper@Nonnull static IntRange closedOpen(int lower, int upper)
lower and strictly less than upper.lower - the lower bound of the range (inclusive)upper - the upper bound of the range (exclusive)IllegalArgumentException - if lower is greater than upper@Nonnull static IntRange singleton(int value)
value. The returned range is closed on both ends.value - the unique value of the rangeclosed(int, int)@Nonnull static IntRange atLeast(int lower)
lower.lower - the lower bound of the range (inclusive)@Nonnull static IntRange atMost(int upper)
upper.upper - the upper bound of the range (inclusive)@Nonnull static IntRange greaterThan(int lower)
lower.lower - the lower bound of the range (exclusive)@Nonnull static IntRange lessThan(int upper)
upper.upper - the upper bound of the range (exclusive)@Nonnull static IntRange all()
C.@Nonnull static IntRange empty()
@Nonnull static IntRange and(IntRange r1, IntRange r2)
The intersection exists if and only if the two ranges are connected.
r1 - the first ranger2 - the second rangeNullPointerException - if any argument is nullBoolean.logicalAnd(boolean, boolean)@Nonnull static IntRange or(IntRange r1, IntRange r2)
r1 - the first ranger2 - the second rangeNullPointerException - if any argument is nullBoolean.logicalOr(boolean, boolean)@Nonnull static IntRange xor(IntRange r1, IntRange r2)
r1 - the first ranger2 - the second rangeNullPointerException - if any argument is nullBoolean.logicalXor(boolean, boolean)boolean contains(int value)
true if value is within the bounds of this range.value - the value to be tested for inclusiontrue if value is within the bounds of this rangedefault boolean containsAll(Iterable<Integer> values)
true if every element in values is contained in this range.values - the value to be tested for inclusiontrue if every element in values is contained in this rangeNullPointerException - if any argument is nullcontains(int)Copyright © 2017–2019 Atlanmod. All rights reserved.