public final class RangeInclusiveI extends Object
Immutable type representing an inclusive range with int
components.
| Constructor and Description |
|---|
RangeInclusiveI(int in_lower,
int in_upper)
Construct an inclusive range.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
int |
getInterval()
Retrieve the number of values in the range
[lower, upper]. |
int |
getLower() |
int |
getUpper() |
int |
hashCode() |
boolean |
includesValue(int value)
Determine if the given value is included in this range.
|
boolean |
isIncludedIn(RangeInclusiveI other)
Determine if the given range is included in this range.
|
String |
toString() |
public RangeInclusiveI(int in_lower,
int in_upper)
lower <= upper.in_lower - The lower boundin_upper - The upper boundpublic int getInterval()
Retrieve the number of values in the range [lower, upper].
That is, (upper - lower) + 1.
public int getLower()
public int getUpper()
public boolean includesValue(int value)
Determine if the given value is included in this range.
value - The given valuetrue iff
value >= this.getLower() && value <= this.getUpper()
.public boolean isIncludedIn(RangeInclusiveI other)
Determine if the given range is included in this range.
other - The given rangetrue iff
this.getLower() >= other.getLower() && this.getUpper() <= other.getUpper()
.Copyright © 2014 <code@io7m.com> http://io7m.com