java.lang.Object
java.lang.Record
io.jenetics.util.DoubleRange
- Record Components:
min
- the minimum value of the rangemax
- the maximum value of the range
- All Implemented Interfaces:
Serializable
Double range class.
- Since:
- 3.2
- Version:
- 8.3
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDoubleRange
(double min, double max) Create a newDoubleRange
object with the givenmin
andmax
values. -
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(double value) Checks whether the givenvalue
is within the range[min, max)
.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.intersect
(DoubleRange other) Return the intersection ofthis
range with theother
.double
max()
Returns the value of themax
record component.double
min()
Returns the value of themin
record component.static DoubleRange
of
(double min, double max) Deprecated, for removal: This API element is subject to removal in a future version.Class is a record now, and this factory method will be removed in the next major version.toString()
Returns a string representation of this record class.
-
Constructor Details
-
DoubleRange
Create a newDoubleRange
object with the givenmin
andmax
values.- Parameters:
min
- the lower bound of the double rangemax
- the upper bound of the double range- Throws:
IllegalArgumentException
- ifmin > max
or one of the parameters is not finite
-
-
Method Details
-
contains
Checks whether the givenvalue
is within the range[min, max)
.- Parameters:
value
- the value to check- Returns:
true
if thevalue
is with the range[min, max)
,false
otherwise- Since:
- 8.0
-
intersect
Return the intersection ofthis
range with theother
.- Parameters:
other
- the intersection range orOptional.empty()
if there is none- Returns:
- the range intersection
- Since:
- 8.0
-
of
Deprecated, for removal: This API element is subject to removal in a future version.Class is a record now, and this factory method will be removed in the next major version. UseDoubleRange(double, double)
instead.Create a newDoubleRange
object with the givenmin
andmax
values.- Parameters:
min
- the lower bound of the double rangemax
- the upper bound of the double range- Returns:
- a new
DoubleRange
object - Throws:
IllegalArgumentException
- ifmin > max
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
min
Returns the value of themin
record component.- Returns:
- the value of the
min
record component
-
max
Returns the value of themax
record component.- Returns:
- the value of the
max
record component
-