public final class BoundedRange extends Object
minBound <= min <= max <= maxBound
.
BoundedRang
is immutable.
withMin(double)
, withMinBound(double)
etc derive a new
BoundedRange
with the given min
, minBound
etc, while
maintaining the minBound <= min <= max <= maxBound
property. For
example, this.withMin(x)
, will also update max
, if
x > this.getMax()
.
join(other)
will derive a new
BoundedRange
, with min
the minimum of this.getMin()
and other.getMin()
and so on.
Constructor and Description |
---|
BoundedRange(double minBound,
double maxBound,
double min,
double max) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
Bounds |
getBounds() |
double |
getMax() |
double |
getMaxBound() |
double |
getMin() |
double |
getMinBound() |
int |
hashCode() |
BoundedRange |
join(BoundedRange other) |
String |
toString() |
BoundedRange |
withMax(double newMax) |
BoundedRange |
withMaxBound(double newMaxBound) |
BoundedRange |
withMin(double newMin) |
BoundedRange |
withMinBound(double newMinBound) |
public BoundedRange(double minBound, double maxBound, double min, double max)
public double getMinBound()
public double getMaxBound()
public Bounds getBounds()
public double getMin()
public double getMax()
public BoundedRange withMax(double newMax)
public BoundedRange withMin(double newMin)
public BoundedRange withMaxBound(double newMaxBound)
public BoundedRange withMinBound(double newMinBound)
public BoundedRange join(BoundedRange other)
Copyright © 2015–2021 Fiji. All rights reserved.