|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsbrt.kernel.math.Interval
public final class Interval
This class is used to represent closed intervals of the form [α, &beta], where α ≤ β.
Instances of this class are immutable.
Constructor Summary | |
---|---|
Interval(double lowerBound,
double upperBound)
Constructs a new interval with the provided lower and upper bounds. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object o)
Indicates if the provided object is equal to this interval. |
double |
getLower()
Returns the lower bound (or endpoint) of this interval. |
double |
getRange()
Returns getUpper() - getLower() . |
double |
getUpper()
Returns the upper bound (or endpoint) of this interval. |
int |
hashCode()
Returns a content-based hash code. |
boolean |
isWithin(double value)
Indicates if the provided value lies within this interval. |
boolean |
isWithin(double value,
double tolerance)
Indicates if the provided value lies within this interval, given the provided numerical tolerance. |
java.lang.String |
toString()
Returns a string representation of this interval. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Interval(double lowerBound, double upperBound)
lowerBound
- the lower bound of the interval, αupperBound
- the upper bound of the interval, β
IllegalBoundsException
- if lower bound > upper bound
java.lang.IllegalArgumentException
- if either value is
Double.NaN
, lowerBound == Double.POSITIVE_INFINITY
,
or upperBound == Double.NEGATIVE_INFINITY
.Method Detail |
---|
public double getLower()
public double getUpper()
public double getRange()
getUpper() - getLower()
.
getUpper() - getLower()
.public boolean isWithin(double value)
value
≤ β.
This is determined by applying the Java
language numerical comparison operators
<
and >
to the primitive
double
values. This is equivalent to calling
isWithin(double, double) with a tolerance
of 0.0d
.
value
- the numerical value to test.
true
if the provided values lies
within this interval; false
otherwise.public boolean isWithin(double value, double tolerance)
tolerance
≤
value
≤
β + tolerance
.
This is determined by applying the Java
language numerical comparison operators
<
and >
to the primitive
double
values.
value
- the numerical value to test.tolerance
- the numerical tolerance.
true
if the provided values lies
within this interval; false
otherwise.public boolean equals(java.lang.Object o)
==
to the primitive double
values.
equals
in class java.lang.Object
o
- the object to test for equality.
true
if the provided object equals
this interval; false
otherwise.public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |