Class ConstraintMatch<Score_ extends Score<Score_>>
java.lang.Object
ai.timefold.solver.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 implements Comparable for consistent ordering of constraint matches in visualizations.
The details of this ordering are unspecified and are subject to change.
If possible, prefer using SolutionManager.analyze(Object) instead.
-
Constructor Summary
ConstructorsConstructorDescriptionConstraintMatch(ConstraintRef constraintRef, ConstraintJustification justification, Collection<Object> indictedObjectList, Score_ score) ConstraintMatch(Constraint constraint, ConstraintJustification justification, Collection<Object> indictedObjectList, Score_ score) Deprecated, for removal: This API element is subject to removal in a future version.ConstraintMatch(String constraintPackage, String constraintName, ConstraintJustification justification, Collection<Object> indictedObjectList, Score_ score) Deprecated, for removal: This API element is subject to removal in a future version.ConstraintMatch(String constraintId, String constraintPackage, String constraintName, ConstraintJustification justification, Collection<Object> indictedObjectList, Score_ score) Deprecated, for removal: This API element is subject to removal in a future version.ConstraintMatch(String constraintPackage, String constraintName, List<Object> justificationList, Score_ score) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(ConstraintMatch<Score_> other) Deprecated, for removal: This API element is subject to removal in a future version.PrefergetConstraintRef()instead.Deprecated, for removal: This API element is subject to removal in a future version.PrefergetConstraintRef()instead.Deprecated, for removal: This API element is subject to removal in a future version.PrefergetConstraintRef()instead.Returns a set of objects indicted for causing this constraint match.<Justification_ extends ConstraintJustification>
Justification_Return a singular justification for the constraint.Deprecated, for removal: This API element is subject to removal in a future version.PrefergetJustification()orgetIndictedObjectList().getScore()toString()
-
Constructor Details
-
ConstraintMatch
@Deprecated(forRemoval=true) public ConstraintMatch(String constraintPackage, String constraintName, List<Object> justificationList, Score_ score) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
constraintPackage- never nullconstraintName- never nulljustificationList- never null, sometimes emptyscore- never null
-
ConstraintMatch
@Deprecated(forRemoval=true, since="1.4.0") public ConstraintMatch(String constraintPackage, String constraintName, ConstraintJustification justification, Collection<Object> indictedObjectList, Score_ score) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
constraintPackage- never nullconstraintName- never nulljustification- never nullscore- never null
-
ConstraintMatch
@Deprecated(forRemoval=true, since="1.4.0") public ConstraintMatch(Constraint constraint, ConstraintJustification justification, Collection<Object> indictedObjectList, Score_ score) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
constraint- never nulljustification- never nullscore- never null
-
ConstraintMatch
@Deprecated(forRemoval=true, since="1.4.0") public ConstraintMatch(String constraintId, String constraintPackage, String constraintName, ConstraintJustification justification, Collection<Object> indictedObjectList, Score_ score) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
constraintId- never nullconstraintPackage- never nullconstraintName- never nulljustification- never nullscore- never null
-
ConstraintMatch
public ConstraintMatch(ConstraintRef constraintRef, ConstraintJustification justification, Collection<Object> indictedObjectList, Score_ score) - Parameters:
constraintRef- never nulljustification- never nullscore- never null
-
-
Method Details
-
getConstraintRef
-
getConstraintPackage
Deprecated, for removal: This API element is subject to removal in a future version.PrefergetConstraintRef()instead.- Returns:
- maybe null
-
getConstraintName
Deprecated, for removal: This API element is subject to removal in a future version.PrefergetConstraintRef()instead.- Returns:
- never null
-
getConstraintId
Deprecated, for removal: This API element is subject to removal in a future version.PrefergetConstraintRef()instead.- Returns:
- never null
-
getJustificationList
Deprecated, for removal: This API element is subject to removal in a future version.PrefergetJustification()orgetIndictedObjectList().Return a list of justifications for the constraint.This method has a different meaning based on which score director the constraint comes from.
- For constraint streams, it returns a list of facts from the matching tuple for backwards compatibility
(eg. [A, B] for a bi stream),
unless a custom justification mapping was provided, in which case it throws an exception,
pointing users towards
getJustification(). - For incremental score calculation, it returns what the calculator is implemented to return.
- Returns:
- never null
- For constraint streams, it returns a list of facts from the matching tuple for backwards compatibility
(eg. [A, B] for a bi stream),
unless a custom justification mapping was provided, in which case it throws an exception,
pointing users towards
-
getJustification
Return a singular justification for the constraint.This method has a different meaning based on which score director the constraint comes from.
- For constraint streams, it returns
DefaultConstraintJustificationfrom the matching tuple (eg. [A, B] for a bi stream), unless a custom justification mapping was provided, in which case it returns the return value of that function. - For incremental score calculation, it returns what the calculator is implemented to return.
- Returns:
- never null
- For constraint streams, it returns
-
getIndictedObjectList
Returns a set of objects indicted for causing this constraint match.This method has a different meaning based on which score director the constraint comes from.
- For constraint streams, it returns the facts from the matching tuple (eg. [A, B] for a bi stream), unless a custom indictment mapping was provided, in which case it returns the return value of that function.
- For incremental score calculation, it returns what the calculator is implemented to return.
- Returns:
- never null, may be empty or contain null
-
getScore
-
getIdentificationString
-
compareTo
- Specified by:
compareToin interfaceComparable<Score_ extends Score<Score_>>
-
toString
-
ConstraintMatch(ConstraintRef, ConstraintJustification, Collection, Score).