Class CompositeCountableValueRange<T>
java.lang.Object
org.optaplanner.core.impl.domain.valuerange.AbstractCountableValueRange<T>
org.optaplanner.core.impl.domain.valuerange.buildin.composite.CompositeCountableValueRange<T>
- All Implemented Interfaces:
CountableValueRange<T>
,ValueRange<T>
-
Constructor Summary
ConstructorDescriptionCompositeCountableValueRange
(List<? extends CountableValueRange<T>> childValueRangeList) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Select the elements in original (natural) order.createRandomIterator
(Random workingRandom) Select in random order, but without shuffling the elements.get
(long index) Used by uniform random selection in a composite or nullable CountableValueRange.List<? extends ValueRange<T>>
long
getSize()
Used by uniform random selection in a composite or nullable CountableValueRange.Methods inherited from class org.optaplanner.core.impl.domain.valuerange.AbstractCountableValueRange
isEmpty
-
Constructor Details
-
CompositeCountableValueRange
-
-
Method Details
-
getChildValueRangeList
-
getSize
public long getSize()Description copied from interface:CountableValueRange
Used by uniform random selection in a composite or nullable CountableValueRange.- Returns:
- the exact number of elements generated by this
CountableValueRange
, always>= 0
-
get
Description copied from interface:CountableValueRange
Used by uniform random selection in a composite or nullable CountableValueRange.- Parameters:
index
- always<
CountableValueRange.getSize()
- Returns:
- sometimes null (if
PlanningVariable.nullable()
is true)
-
contains
- Parameters:
value
- sometimes null- Returns:
- true if the ValueRange contains that value
-
createOriginalIterator
Description copied from interface:CountableValueRange
Select the elements in original (natural) order.- Returns:
- never null
-
createRandomIterator
Description copied from interface:ValueRange
Select in random order, but without shuffling the elements. Each element might be selected multiple times. Scales well because it does not require caching.- Parameters:
workingRandom
- never null, theRandom
to use when any random number is needed, so runs are reproducible.- Returns:
- never null
-