org.optaplanner.core.impl.domain.valuerange.buildin.primlong

## Class LongValueRange

- java.lang.Object
- - org.optaplanner.core.impl.domain.valuerange.AbstractCountableValueRange<Long>
  - - org.optaplanner.core.impl.domain.valuerange.buildin.primlong.LongValueRange

- All Implemented Interfaces:
    Serializable, CountableValueRange<Long>, ValueRange<Long>

      public class LongValueRange
      extends AbstractCountableValueRange<Long>

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LongValueRange(long from, long to)`
    `LongValueRange(long from, long to, long incrementUnit)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `contains(Long value)`
    `Iterator<Long>` | `createOriginalIterator()` Select the elements in original (natural) order.
    `Iterator<Long>` | `createRandomIterator(Random workingRandom)` Select in random order, but without shuffling the elements.
    `Long` | `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`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### LongValueRange

          public LongValueRange(long from,
                                long to)

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

    - #### LongValueRange

          public LongValueRange(long from,
                                long to,
                                long incrementUnit)

      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`

    - #### contains

          public boolean contains(Long value)

      Parameters:
        `value` - sometimes null
      Returns:
        true if the ValueRange contains that value

    - #### get

          public Long 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)

    - #### createOriginalIterator

          public Iterator<Long> createOriginalIterator()

      Description copied from interface: `CountableValueRange`
      Select the elements in original (natural) order.
      Returns:
        never null

    - #### createRandomIterator

          public Iterator<Long> 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, the `Random` to use when any random number is needed, so `EnvironmentMode.REPRODUCIBLE` works correctly. `RandomUtils` can be useful too.
      Returns:
        never null

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2006–2021 JBoss by Red Hat. All rights reserved.