org.optaplanner.core.impl.score.director.incremental

## Interface IncrementalScoreCalculator<Solution_>

- Type Parameters:
    `Solution_` - the solution type, the class with the `PlanningSolution` annotation
  All Known Subinterfaces:
    ConstraintMatchAwareIncrementalScoreCalculator<Solution_>
  All Known Implementing Classes:
    AbstractIncrementalScoreCalculator

      public interface IncrementalScoreCalculator<Solution_>

  Used for incremental java `Score` calculation. This is much faster than `EasyScoreCalculator` but requires much more code to implement too.

  Any implementation is naturally stateful.

  See Also:
    `IncrementalScoreDirector`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterEntityAdded(Object entity)`
    `void` | `afterEntityRemoved(Object entity)`
    `void` | `afterVariableChanged(Object entity, String variableName)`
    `void` | `beforeEntityAdded(Object entity)`
    `void` | `beforeEntityRemoved(Object entity)`
    `void` | `beforeVariableChanged(Object entity, String variableName)`
    `Score` | `calculateScore()` This method is only called if the `Score` cannot be predicted.
    `void` | `resetWorkingSolution(Solution_ workingSolution)` There are no `beforeEntityAdded(Object)` and `afterEntityAdded(Object)` calls for entities that are already present in the workingSolution.

- - ### Method Detail

    - #### resetWorkingSolution

          void resetWorkingSolution(Solution_ workingSolution)

      There are no `beforeEntityAdded(Object)` and `afterEntityAdded(Object)` calls for entities that are already present in the workingSolution.
      Parameters:
        `workingSolution` - never null

    - #### beforeEntityAdded

          void beforeEntityAdded(Object entity)

      Parameters:
        `entity` - never null, an instance of a `PlanningEntity` class

    - #### afterEntityAdded

          void afterEntityAdded(Object entity)

      Parameters:
        `entity` - never null, an instance of a `PlanningEntity` class

    - #### beforeVariableChanged

          void beforeVariableChanged(Object entity,
                                     String variableName)

      Parameters:
        `entity` - never null, an instance of a `PlanningEntity` class
        `variableName` - never null, either a genuine or shadow `PlanningVariable`

    - #### afterVariableChanged

          void afterVariableChanged(Object entity,
                                    String variableName)

      Parameters:
        `entity` - never null, an instance of a `PlanningEntity` class
        `variableName` - never null, either a genuine or shadow `PlanningVariable`

    - #### beforeEntityRemoved

          void beforeEntityRemoved(Object entity)

      Parameters:
        `entity` - never null, an instance of a `PlanningEntity` class

    - #### afterEntityRemoved

          void afterEntityRemoved(Object entity)

      Parameters:
        `entity` - never null, an instance of a `PlanningEntity` class

    - #### calculateScore

          Score calculateScore()

      This method is only called if the `Score` cannot be predicted. The `Score` can be predicted for example after an undo `Move`.
      Returns:
        never null

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