Package jsl.utilities
Class Interval
- java.lang.Object
-
- jsl.utilities.Interval
-
public class Interval extends java.lang.ObjectCan 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 booleancontains(double x)booleancontains(Interval interval)Checks if the supplied interval is contained within this intervaldoublegetHalfWidth()Half of the width of the intervaldoublegetLowerLimit()doublegetUpperLimit()doublegetWidth()The width of the intervalIntervalnewInstance()A new instance with the same interval settings.voidsetInterval(double xLower, double xUpper)Sets the interval Throws IllegalArgumentExceptons if the lower limit is >= upper limitjava.lang.StringtoString()
-
-
-
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:
toStringin 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
-
-