Interface Constraint
- All Known Implementing Classes:
BalanceConstraint,ContinuousHoursConstraint,CustomConstraint,CustomDurationConstraint,NonePlacedBeforeConstraint,RoomConstraint,TeacherConstraint
public interface Constraint
This interface represents a constraint in a timetable.
A constraint is a condition that must be met when generating a timetable.
It provides a method to check if a given timetable, time slot, course, and set of teachers meet
the constraint.
It also provides a default method to update the state of the constraint when the check is
successful.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if the given timetable, time slot, course, and set of teachers meet this constraint.default booleandefault voidUpdates the state of this constraint when the check is successful.
-
Method Details
-
isRequired
default boolean isRequired() -
check
Checks if the given timetable, time slot, course, and set of teachers meet this constraint.- Parameters:
timetable- the timetable to checklesson- the lesson to checkteachers- the set of teachers to checkrooms- the set of room to check- Returns:
- true if the constraint is met, false otherwise
-
updateOnSuccess
default void updateOnSuccess(Timetable timetable, Lesson lesson, Set<Teacher> teachers, Map<String, Room> rooms) Updates the state of this constraint when the check is successful. This is a default method and does nothing unless overridden by a concrete implementation of this interface.- Parameters:
timetable- the timetable that met the constraintlesson- the lesson that met the constraintteachers- the set of teachers that met the constraintrooms- the set of rooms that met the constraint
-