Class NumericBounds<T extends Number>

    • Field Detail

      • m_LowerBound

        protected T extends Number m_LowerBound
        the lower bound.
      • m_UpperBound

        protected T extends Number m_UpperBound
        the upper bound.
    • Constructor Detail

      • NumericBounds

        public NumericBounds​(T lowerBound,
                             T upperBound)
        Initializes the constraint.
        Parameters:
        lowerBound - the lower bound, can be null
        upperBound - the upper bound, can be null
      • NumericBounds

        public NumericBounds​(AbstractOption owner,
                             T lowerBound,
                             T upperBound)
        Initializes the constraint.
        Parameters:
        owner - the option this constraint is for
        lowerBound - the lower bound, can be null
        upperBound - the upper bound, can be null
    • Method Detail

      • hasLowerBound

        public boolean hasLowerBound()
        Checks whether a lower bound has been defined for this option.
        Returns:
        true if lower bound exists
      • getLowerBound

        public T getLowerBound()
        Returns the lower bound for this option.
        Returns:
        the lower bound, can be null if none defined
      • hasUpperBound

        public boolean hasUpperBound()
        Checks whether a lower bound has been defined for this option.
        Returns:
        true if lower bound exists
      • getUpperBound

        public T getUpperBound()
        Returns the lower bound for this option.
        Returns:
        the lower bound, can be null if none defined
      • isValidMsg

        public String isValidMsg​(Number value)
        Checks the value against the constraints. If it violates the constraints, uses the owner's logger to output a warning message.
        Specified by:
        isValidMsg in class AbstractOptionConstraint<T extends Number>
        Parameters:
        value - the value to check
        Returns:
        null if valid otherwise the error message
      • checkBounds

        public T checkBounds​(T number)
        Checks whether the number is within the specified bounds (if any).
        Parameters:
        number - the number to check
        Returns:
        the default value for this option, if the bounds were defined and the value was outside