Record Class LongRange
java.lang.Object
java.lang.Record
io.jenetics.util.LongRange
- Record Components:
min- the minimum value of the rangemax- the maximum value of the range
- All Implemented Interfaces:
Serializable
Long range class.
- Since:
- 3.2
- Version:
- 8.3
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(long value) Checks whether the givenvalueis within the range[min, max).final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Return the intersection ofthisrange with theother.longmax()Returns the value of themaxrecord component.longmin()Returns the value of theminrecord component.stream()toString()Returns a string representation of this record class.
-
Constructor Details
-
LongRange
Create a newLongRangeobject with the givenminandmaxvalues.- Parameters:
min- the lower bound of the long rangemax- the upper bound of the long range- Throws:
IllegalArgumentException- ifmin > max
-
LongRange
Create a new (half-open) range, which contains only the given value:[value, value + 1).- Parameters:
value- the value of the created (half-open) integer range
-
-
Method Details
-
contains
Checks whether the givenvalueis within the range[min, max).- Parameters:
value- the value to check- Returns:
trueif thevalueis with the range[min, max),falseotherwise- Since:
- 8.0
-
intersect
Return the intersection ofthisrange with theother.- Parameters:
other- the intersection range orOptional.empty()if there is none- Returns:
- the range intersection
- Since:
- 8.0
-
stream
Returns a sequential orderedLongStreamfrommin()(inclusive) tomax()(exclusive) by an incremental step of1.An equivalent sequence of increasing values can be produced sequentially using a
forloop as follows:for (long i = range.min(); i < range.max(); ++i) { // ... }- Returns:
- a sequential
LongStreamfor the range oflongelements - Since:
- 3.4
-
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
min
-
max
-