Class DoubleRange

java.lang.Object
io.jenetics.util.DoubleRange
All Implemented Interfaces:
Serializable

public final class DoubleRange extends Object implements Serializable
Double range class.
Since:
3.2
Version:
6.0
See Also:
Implementation Note:
This class is immutable and thread-safe.
  • Method Details

    • min

      public double min()
      Return the minimum value of the double range.
      Returns:
      the minimum value of the double range
    • max

      public double max()
      Return the maximum value of the double range.
      Returns:
      the maximum value of the double range
    • contains

      public boolean contains(double value)
      Checks whether the given value is within the range [min, max).
      Parameters:
      value - the value to check
      Returns:
      true if the value is with the range [min, max), false otherwise
      Since:
      8.0
    • intersect

      Return the intersection of this range with the other.
      Parameters:
      other - the intersection range or Optional.empty() if there is none
      Returns:
      the range intersection
      Since:
      8.0
    • of

      public static DoubleRange of(double min, double max)
      Create a new DoubleRange object with the given min and max values.
      Parameters:
      min - the lower bound of the double range
      max - the upper bound of the double range
      Returns:
      a new DoubleRange object
      Throws:
      IllegalArgumentException - if min > max
    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object