Package org.optaplanner.core.api.score.holder

## Class AbstractScoreHolder<Score_ extends Score<Score_>>

- java.lang.Object
- - org.optaplanner.core.api.score.holder.AbstractScoreHolder<Score_>

- Type Parameters:
    `Score_` - the `Score` type
  All Implemented Interfaces:
    `Serializable`, `ScoreHolder<Score_>`
  Direct Known Subclasses:
    `BendableBigDecimalScoreHolder`, `BendableLongScoreHolder`, `BendableScoreHolder`, `HardMediumSoftBigDecimalScoreHolder`, `HardMediumSoftLongScoreHolder`, `HardMediumSoftScoreHolder`, `HardSoftBigDecimalScoreHolder`, `HardSoftDoubleScoreHolder`, `HardSoftLongScoreHolder`, `HardSoftScoreHolder`, `SimpleBigDecimalScoreHolder`, `SimpleDoubleScoreHolder`, `SimpleLongScoreHolder`, `SimpleScoreHolder`

      @Deprecated
      public abstract class AbstractScoreHolder<Score_ extends Score<Score_>>
      extends Object
      implements ScoreHolder<Score_>, Serializable

  Deprecated.
  for removal from public API
  Abstract superclass for `ScoreHolder`.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `class` | `AbstractScoreHolder.ConstraintActivationUnMatchListener` | Deprecated. for removal from public API

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected boolean` | `constraintMatchEnabled` | Deprecated.
    `protected Map<String,​ConstraintMatchTotal>` | `constraintMatchTotalMap` | Deprecated.
    `protected Map<Object,​Indictment>` | `indictmentMap` | Deprecated.
    `protected Score_` | `zeroScore` | Deprecated.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `AbstractScoreHolder​(boolean constraintMatchEnabled, Score_ zeroScore)` | Deprecated.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `configureConstraintWeight​(org.kie.api.definition.rule.Rule rule, Score_ constraintWeight)` | Deprecated. Sets up a `ConstraintWeight` from the `ConstraintConfiguration` during initialization.
    `protected List<Object>` | `extractJustificationList​(org.kie.api.runtime.rule.RuleContext kcontext)` | Deprecated.
    `Map<String,​ConstraintMatchTotal>` | `getConstraintMatchTotalMap()` | Deprecated. Explains the `Score` of `ScoreHolder.extractScore(int)`.
    `Collection<ConstraintMatchTotal>` | `getConstraintMatchTotals()` | Deprecated. Explains the `Score` of `ScoreHolder.extractScore(int)`.
    `Map<Object,​Indictment>` | `getIndictmentMap()` | Deprecated. Explains the impact of each planning entity or problem fact on the `Score`.
    `void` | `impactScore​(org.kie.api.runtime.rule.RuleContext kcontext)` | Deprecated. For internal use only, use penalize() or reward() instead.
    `void` | `impactScore​(org.kie.api.runtime.rule.RuleContext kcontext, int weightMultiplier)` | Deprecated. For internal use only, use penalize() or reward() instead.
    `void` | `impactScore​(org.kie.api.runtime.rule.RuleContext kcontext, long weightMultiplier)` | Deprecated. For internal use only, use penalize() or reward() instead.
    `void` | `impactScore​(org.kie.api.runtime.rule.RuleContext kcontext, BigDecimal weightMultiplier)` | Deprecated. For internal use only, use penalize() or reward() instead.
    `boolean` | `isConstraintMatchEnabled()` | Deprecated. Must be in sync with `ScoreDirector.isConstraintMatchEnabled()` for the `ScoreDirector` which contains this `ScoreHolder`.
    `protected void` | `registerConstraintMatch​(org.kie.api.runtime.rule.RuleContext kcontext, Runnable constraintUndoListener, Supplier<Score_> scoreSupplier)` | Deprecated. Requires @`OptaPlannerRuleEventListener` to be added as event listener on `KieSession`, otherwise the score changes caused by the constraint matches would not be undone.
    `void` | `setJustificationListConverter​(BiFunction<List<Object>,​org.kie.api.definition.rule.Rule,​List<Object>> converter)` | Deprecated. for removal from public API

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

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

    - ### Methods inherited from interface org.optaplanner.core.api.score.holder.ScoreHolder

      `extractScore`

- - ### Field Detail

    - #### constraintMatchEnabled

          protected final boolean constraintMatchEnabled

      Deprecated.

    - #### constraintMatchTotalMap

          protected final Map<String,​ConstraintMatchTotal> constraintMatchTotalMap

      Deprecated.

    - #### indictmentMap

          protected final Map<Object,​Indictment> indictmentMap

      Deprecated.

    - #### zeroScore

          protected final Score_ extends Score<Score_> zeroScore

      Deprecated.

  - ### Constructor Detail

    - #### AbstractScoreHolder

          protected AbstractScoreHolder​(boolean constraintMatchEnabled,
                                        Score_ zeroScore)

      Deprecated.

  - ### Method Detail

    - #### isConstraintMatchEnabled

          public boolean isConstraintMatchEnabled()

      Deprecated.
      Description copied from interface: `ScoreHolder`
      Must be in sync with `ScoreDirector.isConstraintMatchEnabled()` for the `ScoreDirector` which contains this `ScoreHolder`.

      Defaults to true.

      Specified by:
        `isConstraintMatchEnabled` in interface `ScoreHolder<Score_ extends Score<Score_>>`
      Returns:
        false if the `ConstraintMatch`s and `ConstraintMatchTotal`s do not need to be collected which is a performance boost
      See Also:
        `ScoreHolder.getConstraintMatchTotals()`

    - #### getConstraintMatchTotals

          public Collection<ConstraintMatchTotal> getConstraintMatchTotals()

      Deprecated.
      Description copied from interface: `ScoreHolder`
      Explains the `Score` of `ScoreHolder.extractScore(int)`.

      Should not be called directly, use `ScoreDirector.getConstraintMatchTotals()` instead.

      Specified by:
        `getConstraintMatchTotals` in interface `ScoreHolder<Score_ extends Score<Score_>>`
      Returns:
        never null
      See Also:
        `ScoreDirector.getConstraintMatchTotals()`

    - #### getConstraintMatchTotalMap

          public Map<String,​ConstraintMatchTotal> getConstraintMatchTotalMap()

      Deprecated.
      Description copied from interface: `ScoreHolder`
      Explains the `Score` of `ScoreHolder.extractScore(int)`.

      Should not be called directly, use `ScoreDirector.getConstraintMatchTotalMap()` instead.

      Specified by:
        `getConstraintMatchTotalMap` in interface `ScoreHolder<Score_ extends Score<Score_>>`
      Returns:
        never null
      See Also:
        `ScoreDirector.getConstraintMatchTotalMap()`

    - #### getIndictmentMap

          public Map<Object,​Indictment> getIndictmentMap()

      Deprecated.
      Description copied from interface: `ScoreHolder`
      Explains the impact of each planning entity or problem fact on the `Score`.

      Should not be called directly, use `ScoreDirector.getIndictmentMap()` instead.

      Specified by:
        `getIndictmentMap` in interface `ScoreHolder<Score_ extends Score<Score_>>`
      Returns:
        never null
      See Also:
        `ScoreDirector.getIndictmentMap()`

    - #### configureConstraintWeight

          public void configureConstraintWeight​(org.kie.api.definition.rule.Rule rule,
                                                Score_ constraintWeight)

      Deprecated.
      Description copied from interface: `ScoreHolder`
      Sets up a `ConstraintWeight` from the `ConstraintConfiguration` during initialization.
      Specified by:
        `configureConstraintWeight` in interface `ScoreHolder<Score_ extends Score<Score_>>`
      Parameters:
        `rule` - never null
        `constraintWeight` - never null, with `Score.getInitScore()` equal to 0.

    - #### registerConstraintMatch

          protected void registerConstraintMatch​(org.kie.api.runtime.rule.RuleContext kcontext,
                                                 Runnable constraintUndoListener,
                                                 Supplier<Score_> scoreSupplier)

      Deprecated.
      Requires @`OptaPlannerRuleEventListener` to be added as event listener on `KieSession`, otherwise the score changes caused by the constraint matches would not be undone. See `DroolsScoreDirector.resetKieSession()` for an example.
      Parameters:
        `kcontext` - The rule for which to register the match.
        `constraintUndoListener` - The operation to run to undo the match.
        `scoreSupplier` - The score change to be undone when constraint justification enabled.

    - #### impactScore

          public void impactScore​(org.kie.api.runtime.rule.RuleContext kcontext)

      Deprecated.
      For internal use only, use penalize() or reward() instead.
      Parameters:
        `kcontext` - never null

    - #### impactScore

          public void impactScore​(org.kie.api.runtime.rule.RuleContext kcontext,
                                  int weightMultiplier)

      Deprecated.
      For internal use only, use penalize() or reward() instead.
      Parameters:
        `kcontext` - never null
        `weightMultiplier` - any

    - #### impactScore

          public void impactScore​(org.kie.api.runtime.rule.RuleContext kcontext,
                                  long weightMultiplier)

      Deprecated.
      For internal use only, use penalize() or reward() instead.
      Parameters:
        `kcontext` - never null
        `weightMultiplier` - any

    - #### impactScore

          public void impactScore​(org.kie.api.runtime.rule.RuleContext kcontext,
                                  BigDecimal weightMultiplier)

      Deprecated.
      For internal use only, use penalize() or reward() instead.
      Parameters:
        `kcontext` - never null
        `weightMultiplier` - any

    - #### extractJustificationList

          protected List<Object> extractJustificationList​(org.kie.api.runtime.rule.RuleContext kcontext)

      Deprecated.

    - #### setJustificationListConverter

          @Deprecated
          public void setJustificationListConverter​(BiFunction<List<Object>,​org.kie.api.definition.rule.Rule,​List<Object>> converter)

      Deprecated.
      for removal from public API