Class CompositeCountableValueRange<T>

java.lang.Object
ai.timefold.solver.core.impl.domain.valuerange.AbstractCountableValueRange<T>
ai.timefold.solver.core.impl.domain.valuerange.buildin.composite.CompositeCountableValueRange<T>
All Implemented Interfaces:
CountableValueRange<T>, ValueRange<T>

public final class CompositeCountableValueRange<T> extends AbstractCountableValueRange<T>
  • Constructor Details

    • CompositeCountableValueRange

      public CompositeCountableValueRange(List<? extends CountableValueRange<T>> childValueRangeList)
  • Method Details

    • getSize

      public long getSize()
      Description copied from interface: CountableValueRange
      Used by uniform random selection in a composite CountableValueRange, or one which includes nulls.
      Returns:
      the exact number of elements generated by this CountableValueRange, always >= 0
    • get

      public T get(long index)
      Description copied from interface: CountableValueRange
      Used by uniform random selection in a composite CountableValueRange, or one which includes nulls.
      Parameters:
      index - always < CountableValueRange.getSize()
      Returns:
      sometimes null (if PlanningVariable.allowsUnassigned() is true)
    • contains

      public boolean contains(T value)
      Parameters:
      value - sometimes null
      Returns:
      true if the ValueRange contains that value
    • createOriginalIterator

      public @NonNull Iterator<T> createOriginalIterator()
      Description copied from interface: CountableValueRange
      Select the elements in original (natural) order.
    • createRandomIterator

      public @NonNull Iterator<T> createRandomIterator(@NonNull 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 - the Random to use when any random number is needed, so runs are reproducible.