Modifier and Type | Field and Description |
---|---|
private double |
lower |
private double |
upper |
static Range |
ZERO_TO_INFINITY |
Constructor and Description |
---|
Range(double lower,
double upper)
Constructs a new
Range . |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(double x) |
static Range |
cut(Range a,
Range b)
provides the intersection of 2 overlapping ranges
|
boolean |
equals(Object o) |
double |
getLower() |
double |
getUpper() |
int |
hashCode() |
Range |
reduceAround(double x,
Range other)
under the premise, that x is within this range,
and not within the other range, it shrinks this range in a way
to exclude the other range, but still contain x.
|
String |
toString() |
private final double lower
private final double upper
public static final Range ZERO_TO_INFINITY
public Range(double lower, double upper)
Range
.lower
- Lower bound. Must be positive or zeroupper
- Upper boundIllegalArgumentException
- if the range is invalid (lower < 0 || lower >= upper
)public boolean contains(double x)
public Range reduceAround(double x, Range other)
public double getLower()
public double getUpper()