Код: Выделить всё
public Constraint holiday(ConstraintFactory constraintFactory) {
return constraintFactory.forEach(Shift.class)
.filter((shift)-> shift.getRoster().getConstraintWeightOverrides().getConstraintWeight(ConstraintNames.HOLIDAY) == HardMediumSoftLongScore.of(0, 0, 0))
.join(
Absence.class,
Joiners.equal(Shift::getEmployee, Absence::getEmployee),
Joiners.greaterThanOrEqual(Shift::getDate, Absence::getStartDate),
Joiners.lessThanOrEqual(Shift::getDate, Absence::getEndDate)
)
.penalize(HardMediumSoftLongScore.ONE_HARD)
.asConstraint(ConstraintNames.HOLIDAY);
}
Подробнее здесь: https://stackoverflow.com/questions/794 ... score-of-0