Class BoundaryException

  • All Implemented Interfaces:

    public class BoundaryException
    extends RuntimeException
    This exception represents an error in which a lower limit was set as higher than an upper limit.
    See Also:
    Serialized Form
    • Constructor Detail

      • BoundaryException

        public BoundaryException​(String message)
        Create a new exception with the given message.
        message - the message to attach to the exception
    • Method Detail

      • assertWithinBounds

        public static void assertWithinBounds​(double value,
                                              double lower,
                                              double upper)
        Make sure that the given value is between the upper and lower bounds, and throw an exception if they are not.
        value - The value to check.
        lower - The minimum acceptable value.
        upper - The maximum acceptable value.
      • getMessage

        public static String getMessage​(double value,
                                        double lower,
                                        double upper)
        Returns the message for a boundary exception. Used to keep the message consistent across all boundary exceptions.
        value - The given value
        lower - The lower limit
        upper - The upper limit
        the message for a boundary exception