Class TemporalValueRange<Temporal_ extends Temporal & Comparable<? super Temporal_>>
- java.lang.Object
-
- org.optaplanner.core.impl.domain.valuerange.AbstractCountableValueRange<Temporal_>
-
- org.optaplanner.core.impl.domain.valuerange.buildin.temporal.TemporalValueRange<Temporal_>
-
- All Implemented Interfaces:
CountableValueRange<Temporal_>
,ValueRange<Temporal_>
public class TemporalValueRange<Temporal_ extends Temporal & Comparable<? super Temporal_>> extends AbstractCountableValueRange<Temporal_>
-
-
Constructor Summary
Constructors Constructor Description TemporalValueRange(Temporal_ from, Temporal_ to, long incrementUnitAmount, TemporalUnit incrementUnitType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(Temporal_ value)
Iterator<Temporal_>
createOriginalIterator()
Select the elements in original (natural) order.Iterator<Temporal_>
createRandomIterator(Random workingRandom)
Select in random order, but without shuffling the elements.Temporal_
get(long index)
Used by uniform random selection in a composite or nullable CountableValueRange.long
getSize()
Used by uniform random selection in a composite or nullable CountableValueRange.String
toString()
-
Methods inherited from class org.optaplanner.core.impl.domain.valuerange.AbstractCountableValueRange
isEmpty
-
-
-
-
Constructor Detail
-
TemporalValueRange
public TemporalValueRange(Temporal_ from, Temporal_ to, long incrementUnitAmount, TemporalUnit incrementUnitType)
- Parameters:
from
- never null, inclusive minimumto
- never null, exclusive maximum,>= from
incrementUnitAmount
-> 0
incrementUnitType
- never null, must besupported
byfrom
andto
-
-
Method Detail
-
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
public Temporal_ get(long index)
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
public boolean contains(Temporal_ value)
- Parameters:
value
- sometimes null- Returns:
- true if the ValueRange contains that value
-
createOriginalIterator
public Iterator<Temporal_> createOriginalIterator()
Description copied from interface:CountableValueRange
Select the elements in original (natural) order.- Returns:
- never null
-
createRandomIterator
public Iterator<Temporal_> createRandomIterator(Random workingRandom)
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
-
-