Package jsl.utilities
Class Interval
- java.lang.Object
-
- jsl.utilities.Interval
-
public class Interval extends java.lang.Object
Can be used to represent confidence intervals. Intervals between two real numbers where the lower limit must be less than or equal to the upper limit.
-
-
Constructor Summary
Constructors Constructor Description Interval(double xLower, double xUpper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(double x)
boolean
contains(Interval interval)
Checks if the supplied interval is contained within this intervaldouble
getHalfWidth()
Half of the width of the intervaldouble
getLowerLimit()
double
getUpperLimit()
double
getWidth()
The width of the intervalInterval
newInstance()
A new instance with the same interval settings.void
setInterval(double xLower, double xUpper)
Sets the interval Throws IllegalArgumentExceptons if the lower limit is >= upper limitjava.lang.String
toString()
-
-
-
Method Detail
-
setInterval
public final void setInterval(double xLower, double xUpper)
Sets the interval Throws IllegalArgumentExceptons if the lower limit is >= upper limit- Parameters:
xLower
- the lower limitxUpper
- the upper limit
-
newInstance
public final Interval newInstance()
A new instance with the same interval settings.- Returns:
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getLowerLimit
public final double getLowerLimit()
- Returns:
- the lower limit of the interval
-
getUpperLimit
public final double getUpperLimit()
- Returns:
- The upper limit of the interval
-
getWidth
public final double getWidth()
The width of the interval- Returns:
-
getHalfWidth
public final double getHalfWidth()
Half of the width of the interval- Returns:
-
contains
public final boolean contains(double x)
- Parameters:
x
- the value to check- Returns:
- true if x is in the interval (includes end points)
-
contains
public final boolean contains(Interval interval)
Checks if the supplied interval is contained within this interval- Parameters:
interval
-- Returns:
- true only if both lower and upper limits of supplied interval are within this interval
-
-