org.optaplanner.core.api.score.constraint

## Class ConstraintMatchTotal

- java.lang.Object
- - org.optaplanner.core.api.score.constraint.ConstraintMatchTotal

- All Implemented Interfaces:
    Serializable, Comparable<ConstraintMatchTotal>

      public final class ConstraintMatchTotal
      extends Object
      implements Serializable, Comparable<ConstraintMatchTotal>

  Explains the `Score` of a `PlanningSolution`, from the opposite side than `Indictment`. Retrievable from `ScoreDirector.getConstraintMatchTotalMap()`.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConstraintMatchTotal(String constraintPackage, String constraintName, Score zeroScore)`
    `ConstraintMatchTotal(String constraintPackage, String constraintName, Score constraintWeight, Score zeroScore)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `ConstraintMatch` | `addConstraintMatch(List<Object> justificationList, Score score)`
    `int` | `compareTo(ConstraintMatchTotal other)`
    `static String` | `composeConstraintId(String constraintPackage, String constraintName)`
    `boolean` | `equals(Object o)`
    `String` | `getConstraintId()` To create a constraintId, use `composeConstraintId(String, String)`.
    `int` | `getConstraintMatchCount()`
    `Set<ConstraintMatch>` | `getConstraintMatchSet()`
    `String` | `getConstraintName()`
    `String` | `getConstraintPackage()`
    `Score` | `getConstraintWeight()` The value of the `ConstraintWeight` annotated member of the `ConstraintConfiguration`.
    `Score` | `getScore()` Sum of the `getConstraintMatchSet()`'s `ConstraintMatch.getScore()`.
    `Score` | `getScoreTotal()` Deprecated. in favor of `getScore()`
    `int` | `hashCode()`
    `void` | `removeConstraintMatch(ConstraintMatch constraintMatch)`
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### ConstraintMatchTotal

          public ConstraintMatchTotal(String constraintPackage,
                                      String constraintName,
                                      Score zeroScore)

      Parameters:
        `constraintPackage` - never null
        `constraintName` - never null
        `zeroScore` - never null

    - #### ConstraintMatchTotal

          public ConstraintMatchTotal(String constraintPackage,
                                      String constraintName,
                                      Score constraintWeight,
                                      Score zeroScore)

      Parameters:
        `constraintPackage` - never null
        `constraintName` - never null
        `constraintWeight` - null if `ConstraintWeight` isn't used for this constraint
        `zeroScore` - never null

  - ### Method Detail

    - #### composeConstraintId

          public static String composeConstraintId(String constraintPackage,
                                                   String constraintName)

      Parameters:
        `constraintPackage` - never null
        `constraintName` - never null
      Returns:
        never null

    - #### getConstraintPackage

          public String getConstraintPackage()

      Returns:
        never null

    - #### getConstraintName

          public String getConstraintName()

      Returns:
        never null

    - #### getConstraintWeight

          public Score getConstraintWeight()

      The value of the `ConstraintWeight` annotated member of the `ConstraintConfiguration`. It's independent to the state of the `planning variables`. Do not confuse with `getScore()`.
      Returns:
        null if `ConstraintWeight` isn't used for this constraint

    - #### getConstraintMatchSet

          public Set<ConstraintMatch> getConstraintMatchSet()

      Returns:
        never null

    - #### getConstraintMatchCount

          public int getConstraintMatchCount()

      Returns:
        `>= 0`

    - #### getScore

          public Score getScore()

      Sum of the `getConstraintMatchSet()`'s `ConstraintMatch.getScore()`.
      Returns:
        never null

    - #### getScoreTotal

          @Deprecated
          public Score getScoreTotal()

      Deprecated. in favor of `getScore()`
      Returns:
        never null

    - #### addConstraintMatch

          public ConstraintMatch addConstraintMatch(List<Object> justificationList,
                                                    Score score)

    - #### removeConstraintMatch

          public void removeConstraintMatch(ConstraintMatch constraintMatch)

    - #### getConstraintId

          public String getConstraintId()

      To create a constraintId, use `composeConstraintId(String, String)`.
      Returns:
        never null

    - #### compareTo

          public int compareTo(ConstraintMatchTotal other)

      Specified by:
        `compareTo` in interface `Comparable<ConstraintMatchTotal>`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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