Package org.optaplanner.core.impl.heuristic.selector.value

## Interface ValueSelector<Solution_>

- All Superinterfaces:
    `EventListener`, `PhaseLifecycleListener<Solution_>`, `Selector<Solution_>`, `SolverLifecycleListener<Solution_>`
  All Known Subinterfaces:
    `EntityIndependentValueSelector<Solution_>`
  All Known Implementing Classes:
    `AbstractCachingValueSelector`, `AbstractValueSelector`, `CachingValueSelector`, `DowncastingValueSelector`, `EntityDependentSortingValueSelector`, `EntityIndependentFilteringValueSelector`, `EntityIndependentInitializedValueSelector`, `FilteringValueSelector`, `FromEntityPropertyValueSelector`, `FromSolutionPropertyValueSelector`, `InitializedValueSelector`, `MimicRecordingValueSelector`, `MimicReplayingValueSelector`, `NearEntityNearbyValueSelector`, `ProbabilityValueSelector`, `ReinitializeVariableValueSelector`, `SelectedCountLimitValueSelector`, `ShufflingValueSelector`, `SortingValueSelector`

      public interface ValueSelector<Solution_>
      extends Selector<Solution_>

  Selects values from the `ValueRangeProvider` for a `PlanningVariable` annotated property.
  See Also:
    `AbstractValueSelector`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Iterator<Object>` | `endingIterator​(Object entity)` | If `Selector.isNeverEnding()` is true, then `iterator(Object)` will never end.
    `long` | `getSize​(Object entity)` | Similar to `IterableSelector.getSize()`, but requires an entity.
    `GenuineVariableDescriptor<Solution_>` | `getVariableDescriptor()` |
    `Iterator<Object>` | `iterator​(Object entity)` | Similar to `Iterable.iterator()`, but requires an entity.

    - ### Methods inherited from interface org.optaplanner.core.impl.phase.event.PhaseLifecycleListener

      `phaseEnded, phaseStarted, stepEnded, stepStarted`

    - ### Methods inherited from interface org.optaplanner.core.impl.heuristic.selector.Selector

      `getCacheType, isCountable, isNeverEnding`

    - ### Methods inherited from interface org.optaplanner.core.impl.solver.event.SolverLifecycleListener

      `solvingEnded, solvingStarted`

- - ### Method Detail

    - #### getVariableDescriptor

          GenuineVariableDescriptor<Solution_> getVariableDescriptor()

      Returns:
        never null

    - #### getSize

          long getSize​(Object entity)

      Similar to `IterableSelector.getSize()`, but requires an entity.
      Parameters:
        `entity` - never null
      Returns:
        the approximate number of elements generated by this `Selector`, always `>= 0`
      Throws:
        `IllegalStateException` - if `Selector.isCountable()` returns false, but not if only `Selector.isNeverEnding()` returns true

    - #### iterator

          Iterator<Object> iterator​(Object entity)

      Similar to `Iterable.iterator()`, but requires an entity.
      Parameters:
        `entity` - never null
      Returns:
        never null

    - #### endingIterator

          Iterator<Object> endingIterator​(Object entity)

      If `Selector.isNeverEnding()` is true, then `iterator(Object)` will never end. This returns an ending `Iterator`, that tries to match `iterator(Object)` as much as possible, but return each distinct element only once and therefore it might not respect the configuration of this `ValueSelector` entirely.
      Parameters:
        `entity` - never null
      Returns:
        never null
      See Also:
        `iterator(Object)`