44
55import ai .timefold .solver .core .api .score .Score ;
66
7+ import org .jspecify .annotations .NullMarked ;
8+ import org .jspecify .annotations .Nullable ;
9+
710/**
811 * There are several valid ways how an impacter could be called from a constraint stream:
912 *
2124 * for the method types it doesn't support. The CS API guarantees no types are mixed. For example,
2225 * a {@link BigDecimal} parameter method won't be called on an instance built with an {@link IntImpactFunction}.
2326 */
27+ @ NullMarked
2428public interface WeightedScoreImpacter <Score_ extends Score <Score_ >, Context_ extends ScoreContext <Score_ , ?>> {
2529
2630 static <Score_ extends Score <Score_ >, Context_ extends ScoreContext <Score_ , ?>> WeightedScoreImpacter <Score_ , Context_ >
@@ -40,46 +44,51 @@ public interface WeightedScoreImpacter<Score_ extends Score<Score_>, Context_ ex
4044
4145 /**
4246 * @param matchWeight never null
43- * @param constraintMatchSupplier ignored unless constraint match enableds
47+ * @param constraintMatchSupplier ignored unless constraint match enabled
4448 * @return never null
4549 */
46- ScoreImpact <Score_ > impactScore (int matchWeight , ConstraintMatchSupplier <Score_ > constraintMatchSupplier );
50+ ScoreImpact <Score_ > impactScore (int matchWeight , @ Nullable ConstraintMatchSupplier <Score_ > constraintMatchSupplier );
4751
4852 /**
4953 * @param matchWeight never null
5054 * @param constraintMatchSupplier ignored unless constraint match enabled
5155 * @return never null
5256 */
53- ScoreImpact <Score_ > impactScore (long matchWeight , ConstraintMatchSupplier <Score_ > constraintMatchSupplier );
57+ ScoreImpact <Score_ > impactScore (long matchWeight , @ Nullable ConstraintMatchSupplier <Score_ > constraintMatchSupplier );
5458
5559 /**
5660 * @param matchWeight never null
5761 * @param constraintMatchSupplier ignored unless constraint match enabled
5862 * @return never null
5963 */
60- ScoreImpact <Score_ > impactScore (BigDecimal matchWeight , ConstraintMatchSupplier <Score_ > constraintMatchSupplier );
64+ ScoreImpact <Score_ > impactScore (BigDecimal matchWeight , @ Nullable ConstraintMatchSupplier <Score_ > constraintMatchSupplier );
6165
6266 Context_ getContext ();
6367
68+ @ NullMarked
6469 @ FunctionalInterface
6570 interface IntImpactFunction <Score_ extends Score <Score_ >, Context_ extends ScoreContext <Score_ , ?>> {
6671
67- ScoreImpact <Score_ > impact (Context_ context , int matchWeight , ConstraintMatchSupplier <Score_ > constraintMatchSupplier );
72+ ScoreImpact <Score_ > impact (Context_ context , int matchWeight ,
73+ @ Nullable ConstraintMatchSupplier <Score_ > constraintMatchSupplier );
6874
6975 }
7076
77+ @ NullMarked
7178 @ FunctionalInterface
7279 interface LongImpactFunction <Score_ extends Score <Score_ >, Context_ extends ScoreContext <Score_ , ?>> {
7380
74- ScoreImpact <Score_ > impact (Context_ context , long matchWeight , ConstraintMatchSupplier <Score_ > constraintMatchSupplier );
81+ ScoreImpact <Score_ > impact (Context_ context , long matchWeight ,
82+ @ Nullable ConstraintMatchSupplier <Score_ > constraintMatchSupplier );
7583
7684 }
7785
86+ @ NullMarked
7887 @ FunctionalInterface
7988 interface BigDecimalImpactFunction <Score_ extends Score <Score_ >, Context_ extends ScoreContext <Score_ , ?>> {
8089
8190 ScoreImpact <Score_ > impact (Context_ context , BigDecimal matchWeight ,
82- ConstraintMatchSupplier <Score_ > constraintMatchSupplier );
91+ @ Nullable ConstraintMatchSupplier <Score_ > constraintMatchSupplier );
8392
8493 }
8594
0 commit comments