Package jsl.utilities

Class 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.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected double myLower  
      protected double myUpper  
    • 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 interval
      double getHalfWidth()
      Half of the width of the interval
      double getLowerLimit()  
      double getUpperLimit()  
      double getWidth()
      The width of the interval
      Interval 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 limit
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • myLower

        protected double myLower
      • myUpper

        protected double myUpper
    • Constructor Detail

      • Interval

        public Interval​(double xLower,
                        double xUpper)
        Parameters:
        xLower - the lower limit
        xUpper - the upper limit
    • 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 limit
        xUpper - 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 class java.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