Class BaseInterval

    • Field Detail

      • DOUBLE_TOSTRING

        public static final int DOUBLE_TOSTRING
        the number of decimals value for just using Double.toString method.
        See Also:
        Constant Field Values
      • DEFAULT_NUM_DECIMALS

        public static final int DEFAULT_NUM_DECIMALS
        the default number of decimals to use.
        See Also:
        Constant Field Values
      • m_Infinite

        protected boolean m_Infinite
        from negative to positive infinity.
      • m_Lower

        protected double m_Lower
        the lower bound of the interval.
      • m_LowerInclusive

        protected boolean m_LowerInclusive
        whether the lower is inclusive.
      • m_Upper

        protected double m_Upper
        the upper bound of the interval.
      • m_UpperInclusive

        protected boolean m_UpperInclusive
        whether the upper is inclusive.
      • m_NumDecimals

        protected int m_NumDecimals
        the number of decimals to display (-1 for Double.toString).
    • Constructor Detail

      • BaseInterval

        public BaseInterval()
        Initializes the string with empty string.
      • BaseInterval

        public BaseInterval​(int numDecimals)
        Initializes the string with empty string.
        Parameters:
        numDecimals - the number of decimals to use for printing the ranges; -1 for Double.toString
      • BaseInterval

        public BaseInterval​(String s)
        Initializes the object with the specified interval.
        Parameters:
        s - the interval to parse
      • BaseInterval

        public BaseInterval​(String s,
                            int numDecimals)
        Initializes the object with the specified interval.
        Parameters:
        s - the interval to parse
        numDecimals - the number of decimals to use for printing the ranges; -1 for Double.toString
      • BaseInterval

        public BaseInterval​(double lower,
                            double upper)
        Initializes the object with the specified (inclusive) bounds.
        Parameters:
        lower - the lower bound
        upper - the upper bound
      • BaseInterval

        public BaseInterval​(double lower,
                            double upper,
                            int numDecimals)
        Initializes the object with the specified (inclusive) bounds.
        Parameters:
        lower - the lower bound
        upper - the upper bound
        numDecimals - the number of decimals to use for printing the ranges; -1 for Double.toString
      • BaseInterval

        public BaseInterval​(double lower,
                            boolean lowerInclusive,
                            double upper,
                            boolean upperInclusive)
        Initializes the object with the specified bounds.
        Parameters:
        lower - the lower bound
        lowerInclusive - whether the lower bound is inclusive
        upper - the upper bound
        upperInclusive - whether the upper bound is inclusive
      • BaseInterval

        public BaseInterval​(double lower,
                            boolean lowerInclusive,
                            double upper,
                            boolean upperInclusive,
                            int numDecimals)
        Initializes the object with the specified bounds.
        Parameters:
        lower - the lower bound
        lowerInclusive - whether the lower bound is inclusive
        upper - the upper bound
        upperInclusive - whether the upper bound is inclusive
        numDecimals - the number of decimals to use for printing the ranges; -1 for Double.toString
    • Method Detail

      • setNumDecimals

        public void setNumDecimals​(int value)
        Sets the number of decimals to use in the ranges.
        Parameters:
        value - the number of decimals; -1 for Double.toString
      • getNumDecimals

        public int getNumDecimals()
        Returns the number of decimals to use in the ranges.
        Returns:
        the number of decimals; -1 for Double.toString
      • parse

        protected Object[] parse​(String value)
        Parses the string.
        Parameters:
        value - the string value to parse
        Returns:
        null if failed to parse, otherwise lower incl/lower/upper/upper incl
      • isValid

        public boolean isValid​(String value)
        Checks whether the string value is a valid presentation for this class.
        Overrides:
        isValid in class AbstractBaseString
        Parameters:
        value - the string value to check
        Returns:
        true if empty or interval
      • convert

        protected String convert​(String value)
        Converts the string according to the specified conversion.
        Overrides:
        convert in class AbstractBaseString
        Parameters:
        value - the string to convert
        Returns:
        the converted string
      • isLowerInclusive

        public boolean isLowerInclusive()
        Returns whether the lower bound is inclusive.
        Returns:
        true if inclusive
      • getLower

        public double getLower()
        Returns the lower bound.
        Returns:
        the lower bound
      • isUpperInclusive

        public boolean isUpperInclusive()
        Returns whether the upper bound is inclusive.
        Returns:
        true if inclusive
      • getUpper

        public double getUpper()
        Returns the upper bound.
        Returns:
        the upper bound
      • isInside

        public boolean isInside​(double value)
        Checks whether the value falls inside the bounds, taking the inclusivity of the bounds into account.
        Parameters:
        value - the value to check
        Returns:
        true if within bounds
      • isInfinite

        public boolean isInfinite()
        Returns whether the range is from negative to positive infinity.
        Returns:
        true if no bounds
        See Also:
        ALL
      • getTipText

        public String getTipText()
        Returns a tool tip for the GUI editor (ignored if null is returned).
        Specified by:
        getTipText in class AbstractBaseString
        Returns:
        the tool tip