Class IntValueRange
- java.lang.Object
-
- org.optaplanner.core.impl.domain.valuerange.AbstractCountableValueRange<Integer>
-
- org.optaplanner.core.impl.domain.valuerange.buildin.primint.IntValueRange
-
- All Implemented Interfaces:
CountableValueRange<Integer>,ValueRange<Integer>
public class IntValueRange extends AbstractCountableValueRange<Integer>
-
-
Constructor Summary
Constructors Constructor Description IntValueRange(int from, int to)IntValueRange(int from, int to, int incrementUnit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(Integer value)Iterator<Integer>createOriginalIterator()Select the elements in original (natural) order.Iterator<Integer>createRandomIterator(Random workingRandom)Select in random order, but without shuffling the elements.Integerget(long index)Used by uniform random selection in a composite or nullable CountableValueRange.longgetSize()Used by uniform random selection in a composite or nullable CountableValueRange.StringtoString()-
Methods inherited from class org.optaplanner.core.impl.domain.valuerange.AbstractCountableValueRange
isEmpty
-
-
-
-
Constructor Detail
-
IntValueRange
public IntValueRange(int from, int to)- Parameters:
from- inclusive minimumto- exclusive maximum,>= from
-
IntValueRange
public IntValueRange(int from, int to, int incrementUnit)- Parameters:
from- inclusive minimumto- exclusive maximum,>= fromincrementUnit-> 0
-
-
Method Detail
-
getSize
public long getSize()
Description copied from interface:CountableValueRangeUsed by uniform random selection in a composite or nullable CountableValueRange.- Returns:
- the exact number of elements generated by this
CountableValueRange, always>= 0
-
contains
public boolean contains(Integer value)
- Parameters:
value- sometimes null- Returns:
- true if the ValueRange contains that value
-
get
public Integer get(long index)
Description copied from interface:CountableValueRangeUsed by uniform random selection in a composite or nullable CountableValueRange.- Parameters:
index- always<CountableValueRange.getSize()- Returns:
- sometimes null (if
PlanningVariable.nullable()is true)
-
createOriginalIterator
public Iterator<Integer> createOriginalIterator()
Description copied from interface:CountableValueRangeSelect the elements in original (natural) order.- Returns:
- never null
-
createRandomIterator
public Iterator<Integer> createRandomIterator(Random workingRandom)
Description copied from interface:ValueRangeSelect 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, theRandomto use when any random number is needed, so runs are reproducible.- Returns:
- never null
-
-