Record Class ConstraintAnalysis<Score_ extends Score<Score_>>
java.lang.Object
java.lang.Record
ai.timefold.solver.core.api.score.analysis.ConstraintAnalysis<Score_>
- Type Parameters:
Score_-- Record Components:
constraintRef- never nullweight- never nullscore- never nullmatches- null if analysis not available; empty if constraint has no matches, but still non-zero constraint weight; non-empty if constraint has matches. This is aListto simplify access to individual elements, but it contains no duplicates just likeHashSetwouldn't.
public record ConstraintAnalysis<Score_ extends Score<Score_>>(ConstraintRef constraintRef, Score_ extends Score<Score_> weight, Score_ extends Score<Score_> score, List<MatchAnalysis<Score_ extends Score<Score_>>> matches)
extends Record
Note: Users should never create instances of this type directly.
It is available transitively via
SolutionManager.analyze(Object).-
Constructor Summary
ConstructorsConstructorDescriptionConstraintAnalysis(ConstraintRef constraintRef, Score_ weight, Score_ score, List<MatchAnalysis<Score_>> matches) Creates an instance of aConstraintAnalysisrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturn name of the constraint that this analysis is for.Deprecated, for removal: This API element is subject to removal in a future version.Do not rely on constraint package in user code.Returns the value of theconstraintRefrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturn the match count of the constraint.matches()Returns the value of thematchesrecord component.score()Returns the value of thescorerecord component.Returns a diagnostic text that explains part of the score quality through theConstraintAnalysisAPI.toString()Returns a string representation of this record class.weight()Returns the value of theweightrecord component.
-
Constructor Details
-
ConstraintAnalysis
public ConstraintAnalysis(ConstraintRef constraintRef, Score_ weight, Score_ score, List<MatchAnalysis<Score_>> matches) Creates an instance of aConstraintAnalysisrecord class.- Parameters:
constraintRef- the value for theconstraintRefrecord componentweight- the value for theweightrecord componentscore- the value for thescorerecord componentmatches- the value for thematchesrecord component
-
-
Method Details
-
matchCount
public int matchCount()Return the match count of the constraint.- Throws:
IllegalStateException- if thematches()is null
-
constraintPackage
Deprecated, for removal: This API element is subject to removal in a future version.Do not rely on constraint package in user code.Return package name of the constraint that this analysis is for.- Returns:
- equal to
constraintRef.packageName()
-
constraintName
Return name of the constraint that this analysis is for.- Returns:
- equal to
constraintRef.constraintName()
-
summarize
Returns a diagnostic text that explains part of the score quality through theConstraintAnalysisAPI. The string is built fresh every time the method is called.- Returns:
- never null
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
constraintRef
Returns the value of theconstraintRefrecord component.- Returns:
- the value of the
constraintRefrecord component
-
weight
Returns the value of theweightrecord component.- Returns:
- the value of the
weightrecord component
-
score
Returns the value of thescorerecord component.- Returns:
- the value of the
scorerecord component
-
matches
Returns the value of thematchesrecord component.- Returns:
- the value of the
matchesrecord component
-