Package edu.wpi.first.hal.util
Class BoundaryException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- edu.wpi.first.hal.util.BoundaryException
-
- All Implemented Interfaces:
Serializable
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 Summary
Constructors Constructor Description BoundaryException(String message)
Create a new exception with the given message.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.static String
getMessage(double value, double lower, double upper)
Returns the message for a boundary exception.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
BoundaryException
public BoundaryException(String message)
Create a new exception with the given message.- Parameters:
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.- Parameters:
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.- Parameters:
value
- The given valuelower
- The lower limitupper
- The upper limit- Returns:
- the message for a boundary exception
-
-