Class Validate
java.lang.Object
org.moeaframework.core.configuration.Validate
Methods to validate inputs and throw
IllegalArgumentException
if the check fails.-
Method Summary
Modifier and TypeMethodDescriptionstatic void
greaterThan
(String propertyName, double minValue, double value) Validates that the value is greater than some minimum value, exclusively.static void
greaterThan
(String propertyName, int minValue, int value) Validates that the value is greater than some minimum value, exclusively.static void
greaterThanOrEqual
(String propertyName, double minValue, double value) Validates that the value is greater than or equal to some minimum value.static void
greaterThanOrEqual
(String propertyName, int minValue, int value) Validates that the value is greater than or equal to some minimum value.static void
greaterThanOrEqualToZero
(String propertyName, double value) Validates that the value is greater than or equal to0.0
.static void
greaterThanOrEqualToZero
(String propertyName, int value) Validates that the value is greater than or equal to0
.static void
greaterThanZero
(String propertyName, double value) Validates that the value is greater than0.0
.static void
greaterThanZero
(String propertyName, int value) Validates that the value is greater than0
.static void
inclusiveBetween
(String propertyName, double lowerBound, double upperBound, double value) Validates that the value is contained within the lower and upper bounds, inclusively.static void
inclusiveBetween
(String propertyName, int lowerBound, int upperBound, int value) Validates that the value is contained within the lower and upper bounds, inclusively.static void
Validates that the object is not null.static void
probability
(String propertyName, double value) Validates that the value is a probability, namely between 0.0 and 1.0, inclusively.static void
problemHasNoConstraints
(Problem problem) Validates that the problem is unconstrained.static void
problemType
(Problem problem, Class<? extends Variable> type) Validates that the problem only contains decision variables of the given type.
-
Method Details
-
greaterThanZero
Validates that the value is greater than0
.- Parameters:
propertyName
- the property name being setvalue
- the value to check- Throws:
IllegalArgumentException
- if the check fails
-
greaterThanZero
Validates that the value is greater than0.0
.- Parameters:
propertyName
- the property name being setvalue
- the value to check- Throws:
IllegalArgumentException
- if the check fails
-
greaterThanOrEqualToZero
Validates that the value is greater than or equal to0
.- Parameters:
propertyName
- the property name being setvalue
- the value to check- Throws:
IllegalArgumentException
- if the check fails
-
greaterThanOrEqualToZero
Validates that the value is greater than or equal to0.0
.- Parameters:
propertyName
- the property name being setvalue
- the value to check- Throws:
IllegalArgumentException
- if the check fails
-
greaterThan
Validates that the value is greater than some minimum value, exclusively.- Parameters:
propertyName
- the property name being setminValue
- the minimum value, exclusivevalue
- the value to check- Throws:
IllegalArgumentException
- if the check fails
-
greaterThan
Validates that the value is greater than some minimum value, exclusively.- Parameters:
propertyName
- the property name being setminValue
- the minimum value, exclusivevalue
- the value to check- Throws:
IllegalArgumentException
- if the check fails
-
greaterThanOrEqual
Validates that the value is greater than or equal to some minimum value.- Parameters:
propertyName
- the property name being setminValue
- the minimum value, inclusivevalue
- the value to check- Throws:
IllegalArgumentException
- if the check fails
-
greaterThanOrEqual
Validates that the value is greater than or equal to some minimum value.- Parameters:
propertyName
- the property name being setminValue
- the minimum value, inclusivevalue
- the value to check- Throws:
IllegalArgumentException
- if the check fails
-
inclusiveBetween
public static void inclusiveBetween(String propertyName, double lowerBound, double upperBound, double value) Validates that the value is contained within the lower and upper bounds, inclusively.- Parameters:
propertyName
- the property name being setlowerBound
- the lower bound, inclusiveupperBound
- the upperBound, inclusivevalue
- the value to check- Throws:
IllegalArgumentException
- if the check fails
-
inclusiveBetween
Validates that the value is contained within the lower and upper bounds, inclusively.- Parameters:
propertyName
- the property name being setlowerBound
- the lower bound, inclusiveupperBound
- the upperBound, inclusivevalue
- the value to check- Throws:
IllegalArgumentException
- if the check fails
-
probability
Validates that the value is a probability, namely between 0.0 and 1.0, inclusively.- Parameters:
propertyName
- the property name being setvalue
- the value to check- Throws:
IllegalArgumentException
- if the check fails
-
notNull
Validates that the object is not null.- Parameters:
propertyName
- the property name being setobject
- the object to check- Throws:
IllegalArgumentException
- if the check fails
-
problemHasNoConstraints
Validates that the problem is unconstrained.- Parameters:
problem
- the problem- Throws:
IllegalArgumentException
- if the check fails
-
problemType
Validates that the problem only contains decision variables of the given type.- Parameters:
problem
- the problemtype
- the required decision variable type- Throws:
IllegalArgumentException
- if the check fails
-