OptaPlanner core 6.2.0.Beta1

org.optaplanner.core.impl.domain.valuerange.buildin.bigdecimal
Class BigDecimalValueRange

java.lang.Object
  extended by org.optaplanner.core.impl.domain.valuerange.AbstractCountableValueRange<BigDecimal>
      extended by org.optaplanner.core.impl.domain.valuerange.buildin.bigdecimal.BigDecimalValueRange
All Implemented Interfaces:
Serializable, CountableValueRange<BigDecimal>, ValueRange<BigDecimal>

public class BigDecimalValueRange
extends AbstractCountableValueRange<BigDecimal>

See Also:
Serialized Form

Constructor Summary
BigDecimalValueRange(BigDecimal from, BigDecimal to)
          All parameters must have the same BigDecimal.scale().
BigDecimalValueRange(BigDecimal from, BigDecimal to, BigDecimal incrementUnit)
          All parameters must have the same BigDecimal.scale().
 
Method Summary
 boolean contains(BigDecimal value)
           
 Iterator<BigDecimal> createOriginalIterator()
          Select the elements in original (natural) order.
 Iterator<BigDecimal> createRandomIterator(Random workingRandom)
          Select in random order, without shuffling the elements.
 BigDecimal 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BigDecimalValueRange

public BigDecimalValueRange(BigDecimal from,
                            BigDecimal to)
All parameters must have the same BigDecimal.scale().

Parameters:
from - inclusive minimum
to - exclusive maximum, >= from

BigDecimalValueRange

public BigDecimalValueRange(BigDecimal from,
                            BigDecimal to,
                            BigDecimal incrementUnit)
All parameters must have the same BigDecimal.scale().

Parameters:
from - inclusive minimum
to - exclusive maximum, >= from
incrementUnit - > 0
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 BigDecimal 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(BigDecimal value)
Parameters:
value - sometimes null
Returns:
true if the ValueRange contains that value

createOriginalIterator

public Iterator<BigDecimal> createOriginalIterator()
Description copied from interface: CountableValueRange
Select the elements in original (natural) order.

Returns:
never null

createRandomIterator

public Iterator<BigDecimal> createRandomIterator(Random workingRandom)
Description copied from interface: ValueRange
Select in random order, without shuffling the elements. Each element might be selected multiple times. Scales well because it does not require caching.

Parameters:
workingRandom - never null, the Random to use when any random number is needed, so EnvironmentMode.REPRODUCIBLE works correctly
Returns:
never null

OptaPlanner core 6.2.0.Beta1

Copyright © 2006-2014 JBoss by Red Hat. All Rights Reserved.