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