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:
matches- 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.matchCount-- For regular constraint analysis:
-1 if analysis not available,
0 if constraint has no matches,
positive if constraint has matches.
Equal to the size of the
matcheslist. - For a
diff of constraint analyses: positive if the constraint has more matches in the new analysis, zero if the number of matches is the same in both, negative otherwise. Need not be equal to the size of thematcheslist.
- For regular constraint analysis:
-1 if analysis not available,
0 if constraint has no matches,
positive if constraint has matches.
Equal to the size of the
public record ConstraintAnalysis<Score_ extends Score<Score_>>(@NonNull ConstraintRef constraintRef, @NonNull Score_ extends Score<Score_> weight, @NonNull Score_ extends Score<Score_> score, @Nullable List<MatchAnalysis<Score_ extends Score<Score_>>> matches, int matchCount)
extends Record
Note: Users should never create instances of this type directly.
It is available transitively via
SolutionManager.analyze(Object).-
Constructor Summary
ConstructorsConstructorDescriptionConstraintAnalysis(@NonNull ConstraintRef constraintRef, @NonNull Score_ weight, @NonNull Score_ score, @Nullable List<MatchAnalysis<Score_>> matches) ConstraintAnalysis(@NonNull ConstraintRef constraintRef, @NonNull Score_ weight, @NonNull Score_ score, @Nullable List<MatchAnalysis<Score_>> matches, int matchCount) Creates an instance of aConstraintAnalysisrecord class. -
Method Summary
Modifier and TypeMethodDescription@NonNull StringReturn 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.@NonNull ConstraintRefReturns 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.intReturns the value of thematchCountrecord component.@Nullable List<MatchAnalysis<Score_>>matches()Returns the value of thematchesrecord component.@NonNull Score_score()Returns the value of thescorerecord component.@NonNull StringReturns a diagnostic text that explains part of the score quality through theConstraintAnalysisAPI.toString()Returns a string representation of this record class.@NonNull Score_weight()Returns the value of theweightrecord component.
-
Constructor Details
-
ConstraintAnalysis
public ConstraintAnalysis(@NonNull ConstraintRef constraintRef, @NonNull Score_ weight, @NonNull Score_ score, @Nullable List<MatchAnalysis<Score_>> matches) -
ConstraintAnalysis
public ConstraintAnalysis(@NonNull ConstraintRef constraintRef, @NonNull Score_ weight, @NonNull Score_ score, @Nullable List<MatchAnalysis<Score_>> matches, int matchCount) 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 componentmatchCount- the value for thematchCountrecord component
-
-
Method Details
-
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. -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
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
-
matchCount
public int matchCount()Returns the value of thematchCountrecord component.- Returns:
- the value of the
matchCountrecord component
-