Interface ValueRange<T>
- All Known Subinterfaces:
CountableValueRange<T>
- All Known Implementing Classes:
AbstractCountableValueRange,AbstractUncountableValueRange,BigDecimalValueRange,BigIntegerValueRange,BooleanValueRange,CompositeCountableValueRange,DoubleValueRange,EmptyValueRange,IntValueRange,ListValueRange,LongValueRange,NullAllowingCountableValueRange,TemporalValueRange
public interface ValueRange<T>
A ValueRange is a set of a values for a
PlanningVariable.
These values might be stored in memory as a Collection (usually a List or Set),
but if the values are numbers, they can also be stored in memory by their bounds
to use less memory and provide more opportunities.
ValueRange is stateful. Implementations must be immutable.
Prefer using CountableValueRange.
In a future version of Timefold Solver, uncountable value ranges will not be allowed,
and certain recently introduced features already do not support them.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleancreateRandomIterator(@NonNull Random workingRandom) Select in random order, but without shuffling the elements.booleanisEmpty()In aCountableValueRange, this must be consistent withCountableValueRange.getSize().
-
Method Details
-
isEmpty
boolean isEmpty()In aCountableValueRange, this must be consistent withCountableValueRange.getSize().- Returns:
- true if the range is empty
-
contains
- Parameters:
value- sometimes null- Returns:
- true if the ValueRange contains that value
-
createRandomIterator
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- theRandomto use when any random number is needed, so runs are reproducible.
-