Class Validate

java.lang.Object
org.moeaframework.core.configuration.Validate

public class Validate extends Object
Methods to validate inputs and throw IllegalArgumentException if the check fails.
  • Method Summary

    Modifier and Type
    Method
    Description
    static 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 to 0.0.
    static void
    greaterThanOrEqualToZero(String propertyName, int value)
    Validates that the value is greater than or equal to 0.
    static void
    greaterThanZero(String propertyName, double value)
    Validates that the value is greater than 0.0.
    static void
    greaterThanZero(String propertyName, int value)
    Validates that the value is greater than 0.
    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
    notNull(String propertyName, Object object)
    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
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • greaterThanZero

      public static void greaterThanZero(String propertyName, int value)
      Validates that the value is greater than 0.
      Parameters:
      propertyName - the property name being set
      value - the value to check
      Throws:
      IllegalArgumentException - if the check fails
    • greaterThanZero

      public static void greaterThanZero(String propertyName, double value)
      Validates that the value is greater than 0.0.
      Parameters:
      propertyName - the property name being set
      value - the value to check
      Throws:
      IllegalArgumentException - if the check fails
    • greaterThanOrEqualToZero

      public static void greaterThanOrEqualToZero(String propertyName, int value)
      Validates that the value is greater than or equal to 0.
      Parameters:
      propertyName - the property name being set
      value - the value to check
      Throws:
      IllegalArgumentException - if the check fails
    • greaterThanOrEqualToZero

      public static void greaterThanOrEqualToZero(String propertyName, double value)
      Validates that the value is greater than or equal to 0.0.
      Parameters:
      propertyName - the property name being set
      value - the value to check
      Throws:
      IllegalArgumentException - if the check fails
    • greaterThan

      public static void greaterThan(String propertyName, int minValue, int value)
      Validates that the value is greater than some minimum value, exclusively.
      Parameters:
      propertyName - the property name being set
      minValue - the minimum value, exclusive
      value - the value to check
      Throws:
      IllegalArgumentException - if the check fails
    • greaterThan

      public static void greaterThan(String propertyName, double minValue, double value)
      Validates that the value is greater than some minimum value, exclusively.
      Parameters:
      propertyName - the property name being set
      minValue - the minimum value, exclusive
      value - the value to check
      Throws:
      IllegalArgumentException - if the check fails
    • greaterThanOrEqual

      public static void greaterThanOrEqual(String propertyName, int minValue, int value)
      Validates that the value is greater than or equal to some minimum value.
      Parameters:
      propertyName - the property name being set
      minValue - the minimum value, inclusive
      value - the value to check
      Throws:
      IllegalArgumentException - if the check fails
    • greaterThanOrEqual

      public static void greaterThanOrEqual(String propertyName, double minValue, double value)
      Validates that the value is greater than or equal to some minimum value.
      Parameters:
      propertyName - the property name being set
      minValue - the minimum value, inclusive
      value - 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 set
      lowerBound - the lower bound, inclusive
      upperBound - the upperBound, inclusive
      value - the value to check
      Throws:
      IllegalArgumentException - if the check fails
    • inclusiveBetween

      public static void inclusiveBetween(String propertyName, int lowerBound, int upperBound, int value)
      Validates that the value is contained within the lower and upper bounds, inclusively.
      Parameters:
      propertyName - the property name being set
      lowerBound - the lower bound, inclusive
      upperBound - the upperBound, inclusive
      value - the value to check
      Throws:
      IllegalArgumentException - if the check fails
    • probability

      public static void probability(String propertyName, double value)
      Validates that the value is a probability, namely between 0.0 and 1.0, inclusively.
      Parameters:
      propertyName - the property name being set
      value - the value to check
      Throws:
      IllegalArgumentException - if the check fails
    • notNull

      public static void notNull(String propertyName, Object object)
      Validates that the object is not null.
      Parameters:
      propertyName - the property name being set
      object - the object to check
      Throws:
      IllegalArgumentException - if the check fails
    • problemHasNoConstraints

      public static void problemHasNoConstraints(Problem problem)
      Validates that the problem is unconstrained.
      Parameters:
      problem - the problem
      Throws:
      IllegalArgumentException - if the check fails
    • problemType

      public static void problemType(Problem problem, Class<? extends Variable> type)
      Validates that the problem only contains decision variables of the given type.
      Parameters:
      problem - the problem
      type - the required decision variable type
      Throws:
      IllegalArgumentException - if the check fails