Package org.optaplanner.core.impl.score.definition

## Class AbstractBendableScoreDefinition<S extends FeasibilityScore<S>>

- java.lang.Object
- - org.optaplanner.core.impl.score.definition.AbstractScoreDefinition<S>
  - - org.optaplanner.core.impl.score.definition.AbstractBendableScoreDefinition<S>

- All Implemented Interfaces:
    `Serializable`, `ScoreDefinition<S>`
  Direct Known Subclasses:
    `BendableBigDecimalScoreDefinition`, `BendableLongScoreDefinition`, `BendableScoreDefinition`

      public abstract class AbstractBendableScoreDefinition<S extends FeasibilityScore<S>>
      extends AbstractScoreDefinition<S>
      implements ScoreDefinition<S>

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected int` | `hardLevelsSize` |
    `protected int` | `softLevelsSize` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `AbstractBendableScoreDefinition​(int hardLevelsSize, int softLevelsSize)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected static String[]` | `generateLevelLabels​(int hardLevelsSize, int softLevelsSize)` |
    `int` | `getFeasibleLevelsSize()` | Returns the number of levels of `Score.toLevelNumbers()`.
    `int` | `getHardLevelsSize()` |
    `int` | `getLevelsSize()` | Returns the length of `Score.toLevelNumbers()` for every `Score` of this definition.
    `int` | `getSoftLevelsSize()` |
    `boolean` | `isCompatibleArithmeticArgument​(Score score)` |

    - ### Methods inherited from class org.optaplanner.core.impl.score.definition.AbstractScoreDefinition

      `divide, divide, divide, divide, formatScore, getInitLabel, getLevelLabels, sanitize, sanitize, sanitize, sanitize, toString`

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

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

    - ### Methods inherited from interface org.optaplanner.core.impl.score.definition.ScoreDefinition

      `buildOptimisticBound, buildPessimisticBound, buildScoreHolder, buildScoreInliner, divideBySanitizedDivisor, formatScore, fromLevelNumbers, getInitLabel, getLevelLabels, getOneSoftestScore, getScoreClass, getZeroScore, isNegativeOrZero, isPositiveOrZero, parseScore`

- - ### Field Detail

    - #### hardLevelsSize

          protected final int hardLevelsSize

    - #### softLevelsSize

          protected final int softLevelsSize

  - ### Constructor Detail

    - #### AbstractBendableScoreDefinition

          public AbstractBendableScoreDefinition​(int hardLevelsSize,
                                                 int softLevelsSize)

  - ### Method Detail

    - #### generateLevelLabels

          protected static String[] generateLevelLabels​(int hardLevelsSize,
                                                        int softLevelsSize)

    - #### getHardLevelsSize

          public int getHardLevelsSize()

    - #### getSoftLevelsSize

          public int getSoftLevelsSize()

    - #### getLevelsSize

          public int getLevelsSize()

      Description copied from interface: `ScoreDefinition`
      Returns the length of `Score.toLevelNumbers()` for every `Score` of this definition. For example: returns 2 on `HardSoftScoreDefinition`.
      Specified by:
        `getLevelsSize` in interface `ScoreDefinition<S extends FeasibilityScore<S>>`
      Overrides:
        `getLevelsSize` in class `AbstractScoreDefinition<S extends FeasibilityScore<S>>`
      Returns:
        at least 1

    - #### getFeasibleLevelsSize

          public int getFeasibleLevelsSize()

      Description copied from interface: `ScoreDefinition`
      Returns the number of levels of `Score.toLevelNumbers()`. that are used to determine `Score.isFeasible()`.
      Specified by:
        `getFeasibleLevelsSize` in interface `ScoreDefinition<S extends FeasibilityScore<S>>`
      Returns:
        at least 0, at most `ScoreDefinition.getLevelsSize()`

    - #### isCompatibleArithmeticArgument

          public boolean isCompatibleArithmeticArgument​(Score score)

      Specified by:
        `isCompatibleArithmeticArgument` in interface `ScoreDefinition<S extends FeasibilityScore<S>>`
      Overrides:
        `isCompatibleArithmeticArgument` in class `AbstractScoreDefinition<S extends FeasibilityScore<S>>`
      Parameters:
        `score` - never null
      Returns:
        true if the otherScore is accepted as a parameter of `Score.add(Score)`, `Score.subtract(Score)` and `Comparable.compareTo(Object)` for scores of this score definition.