Class UniConstraintBuilderImpl<A,Score_ extends Score<Score_>>
java.lang.Object
ai.timefold.solver.core.impl.score.stream.common.AbstractConstraintBuilder<Score_>
ai.timefold.solver.core.impl.score.stream.common.uni.UniConstraintBuilderImpl<A,Score_>
- All Implemented Interfaces:
ConstraintBuilder,UniConstraintBuilder<A,Score_>
public final class UniConstraintBuilderImpl<A,Score_ extends Score<Score_>>
extends AbstractConstraintBuilder<Score_>
implements UniConstraintBuilder<A,Score_>
-
Constructor Summary
ConstructorsConstructorDescriptionUniConstraintBuilderImpl(UniConstraintConstructor<A, Score_> constraintConstructor, ScoreImpactType impactType, Score_ constraintWeight) -
Method Summary
Modifier and TypeMethodDescriptionprotected Function<A,Collection<Object>> protected BiFunction<A,Score_, ConstraintJustification> @NonNull UniConstraintBuilder<A,Score_> indictWith(@NonNull Function<A, Collection<Object>> indictedObjectsMapping) Sets a custom function to mark any object returned by it as responsible for causing the constraint to match.<ConstraintJustification_ extends ConstraintJustification>
@NonNull UniConstraintBuilder<A,Score_> justifyWith(@NonNull BiFunction<A, Score_, ConstraintJustification_> justificationMapping) Sets a custom function to apply on a constraint match to justify it.Methods inherited from class ai.timefold.solver.core.impl.score.stream.common.AbstractConstraintBuilder
asConstraint, asConstraintDescribedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ai.timefold.solver.core.api.score.stream.ConstraintBuilder
asConstraint, asConstraint, asConstraintDescribed, asConstraintDescribed
-
Constructor Details
-
UniConstraintBuilderImpl
public UniConstraintBuilderImpl(UniConstraintConstructor<A, Score_> constraintConstructor, ScoreImpactType impactType, Score_ constraintWeight)
-
-
Method Details
-
getJustificationMapping
- Specified by:
getJustificationMappingin classAbstractConstraintBuilder<Score_ extends Score<Score_>>
-
justifyWith
public <ConstraintJustification_ extends ConstraintJustification> @NonNull UniConstraintBuilder<A,Score_> justifyWith(@NonNull BiFunction<A, Score_, ConstraintJustification_> justificationMapping) Description copied from interface:UniConstraintBuilderSets a custom function to apply on a constraint match to justify it. That function must not return aCollection, elseIllegalStateExceptionwill be thrown during score calculation.- Specified by:
justifyWithin interfaceUniConstraintBuilder<A,Score_ extends Score<Score_>> - Returns:
- this
- See Also:
-
getIndictedObjectsMapping
- Specified by:
getIndictedObjectsMappingin classAbstractConstraintBuilder<Score_ extends Score<Score_>>
-
indictWith
public @NonNull UniConstraintBuilder<A,Score_> indictWith(@NonNull Function<A, Collection<Object>> indictedObjectsMapping) Description copied from interface:UniConstraintBuilderSets a custom function to mark any object returned by it as responsible for causing the constraint to match. Each object in the collection returned by this function will become anIndictmentand be available as a key inScoreExplanation.getIndictmentMap().- Specified by:
indictWithin interfaceUniConstraintBuilder<A,Score_ extends Score<Score_>> - Returns:
- this
-