Package org.optaplanner.core.api.score.constraint

## Class ConstraintMatch<Score_ extends Score<Score_>>

- java.lang.Object
- - org.optaplanner.core.api.score.constraint.ConstraintMatch<Score_>

- Type Parameters:
    `Score_` - the actual score type
  All Implemented Interfaces:
    `Comparable<ConstraintMatch<Score_>>`

      public final class ConstraintMatch<Score_ extends Score<Score_>>
      extends Object
      implements Comparable<ConstraintMatch<Score_>>

  Retrievable from `ConstraintMatchTotal.getConstraintMatchSet()` and `Indictment.getConstraintMatchSet()`.

  This class has a `compareTo(ConstraintMatch)` method which is inconsistent with equals. (See `Comparable`.) Two different `ConstraintMatch` instances with the same justification list aren't `equal` because some ConstraintStream API methods can result in duplicate facts, which are treated as independent matches. Yet two instances may `compareTo(ConstraintMatch)` equal in case they come from the same constraint and their justifications are equal. This is for consistent ordering of constraint matches in visualizations.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ConstraintMatch​(String constraintPackage, String constraintName, List<Object> justificationList, Score_ score)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `compareTo​(ConstraintMatch<Score_> other)` |
    `String` | `getConstraintId()` |
    `String` | `getConstraintName()` |
    `String` | `getConstraintPackage()` |
    `String` | `getIdentificationString()` |
    `List<Object>` | `getJustificationList()` |
    `Score_` | `getScore()` |
    `String` | `toString()` |

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

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

- - ### Constructor Detail

    - #### ConstraintMatch

          public ConstraintMatch​(String constraintPackage,
                                 String constraintName,
                                 List<Object> justificationList,
                                 Score_ score)

      Parameters:
        `constraintPackage` - never null
        `constraintName` - never null
        `justificationList` - never null, sometimes empty
        `score` - never null

  - ### Method Detail

    - #### getConstraintPackage

          public String getConstraintPackage()

    - #### getConstraintName

          public String getConstraintName()

    - #### getJustificationList

          public List<Object> getJustificationList()

    - #### getScore

          public Score_ getScore()

    - #### getConstraintId

          public String getConstraintId()

    - #### getIdentificationString

          public String getIdentificationString()

    - #### compareTo

          public int compareTo​(ConstraintMatch<Score_> other)

      Specified by:
        `compareTo` in interface `Comparable<Score_ extends Score<Score_>>`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`