Class BoundedConstraint

java.lang.Object
org.moeaframework.core.constraint.AbstractConstraint
org.moeaframework.core.constraint.BoundedConstraint
All Implemented Interfaces:
Serializable, Comparable<Constraint>, Constraint, Copyable<Constraint>, Defined, Named
Direct Known Subclasses:
Between, Outside

public abstract class BoundedConstraint extends AbstractConstraint
Abstract class for bounded constraints of the form <lower> <op> <value> <op> <upper>. To handle numerical precision when comparing floating-point values, a small epsilon difference is permitted, which by default is Settings.EPS.
See Also:
  • Field Details

    • lower

      protected final double lower
      The lower bound of this constraint.
    • upper

      protected final double upper
      The upper bound of this constraint.
    • epsilon

      protected final double epsilon
      The epsilon or numerical precision of this constraint.
  • Constructor Details

    • BoundedConstraint

      public BoundedConstraint(double lower, double upper)
      Constructs a new bounded constraint.
      Parameters:
      lower - the lower threshold
      upper - the upper threshold
    • BoundedConstraint

      public BoundedConstraint(double lower, double upper, double epsilon)
      Constructs a new bounded constraint.
      Parameters:
      lower - the lower threshold
      upper - the upper threshold
      epsilon - the epsilon value
    • BoundedConstraint

      public BoundedConstraint(String name, double lower, double upper)
      Constructs a new bounded constraint.
      Parameters:
      name - the name
      lower - the lower threshold
      upper - the upper threshold
    • BoundedConstraint

      public BoundedConstraint(String name, double lower, double upper, double epsilon)
      Constructs a new bounded constraint.
      Parameters:
      name - the name
      lower - the lower threshold
      upper - the upper threshold
      epsilon - the epsilon value
    • BoundedConstraint

      public BoundedConstraint(BoundedConstraint copy)
      Constructs a copy of a bounded constraint.
      Parameters:
      copy - the constraint to copy
  • Method Details

    • getLower

      public double getLower()
      Returns the lower bound of this constraint.
      Returns:
      the lower bound
    • getUpper

      public double getUpper()
      Returns the upper bound of this constraint.
      Returns:
      the upper bound
    • getEpsilon

      public double getEpsilon()
      Returns the epsilon or numerical precision of this constraint.
      Returns:
      the epsilon value
    • getDefinition

      public String getDefinition()
      Description copied from interface: Defined
      Returns the string representation, or definition, of this object.
      Returns:
      the definition
    • toString

      public String toString()
      Overrides:
      toString in class AbstractConstraint
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AbstractConstraint
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class AbstractConstraint