@Override
public void configureConstraintWeight(Rule rule, HardSoftScore constraintWeight) {
super.configureConstraintWeight(rule, constraintWeight);
BiConsumer<RuleContext, Integer> matchExecutor;
if (constraintWeight.equals(HardSoftScore.ZERO)) {
matchExecutor = (RuleContext kcontext, Integer matchWeight) -> {};
} else if (constraintWeight.getSoftScore() == 0) {
matchExecutor = (RuleContext kcontext, Integer matchWeight)
-> addHardConstraintMatch(kcontext, constraintWeight.getHardScore() * matchWeight);
} else if (constraintWeight.getHardScore() == 0) {
matchExecutor = (RuleContext kcontext, Integer matchWeight)
-> addSoftConstraintMatch(kcontext, constraintWeight.getSoftScore() * matchWeight);
} else {
matchExecutor = (RuleContext kcontext, Integer matchWeight)
-> addMultiConstraintMatch(kcontext,
constraintWeight.getHardScore() * matchWeight,
constraintWeight.getSoftScore() * matchWeight);
}
matchExecutorByNumberMap.put(rule, matchExecutor);
matchExecutorByScoreMap.put(rule, (RuleContext kcontext,
HardSoftScore weightMultiplier) -> addMultiConstraintMatch(kcontext,
constraintWeight.getHardScore() * weightMultiplier.getHardScore(),
constraintWeight.getSoftScore() * weightMultiplier.getSoftScore()));
}