public ArrayList calculateAllAllowedRooms(Course dragedCourse, int indexRow, int indexCol) { ArrayList allowedRooms = HardConstraintChecks.getPossibleRoomsRelCapacity(dragedCourse); return(HardConstraintChecks.getPossibleRoomsRelTimeSlot(allowedRooms, indexRow, indexCol)); }
public static ArrayList findAllFreeTimeSlots(Course dragedCourse) { ArrayList notPossibleTimeSlots = new ArrayList(); Teacher dragedTeacher = dragedCourse.getTeacher(); EduProgram currEP = (EduProgram)dragedCourse.Parent; EduProgramGroup epg = (EduProgramGroup)currEP.Parent; ArrayList [,] currTimetable = currEP.getTimetable(); ArrayList possibleRooms = HardConstraintChecks.getPossibleRoomsRelCapacity(dragedCourse); foreach (TimeSlotPanel tsp in AppForm.getAppForm().getMainTimetablePanel().Controls) { //check if time slot is possible in relation with allowed time slots for EduProgramGroup markNotPossibleTimeSlotsRelEduProgramGroup(epg, tsp, notPossibleTimeSlots); if (dragedCourse.getCoursesToHoldTogetherList().Count > 0) { foreach (Course edu_program_group in dragedCourse.getCoursesToHoldTogetherList()) { EduProgram epHT = (EduProgram)edu_program_group.Parent; EduProgramGroup epgHT = (EduProgramGroup)epHT.Parent; markNotPossibleTimeSlotsRelEduProgramGroup(epgHT, tsp, notPossibleTimeSlots); } } //check if time slot is possible in relation with allowed time slots for EduProgram markNotPossibleTimeSlotsRelEduProgram(currEP, tsp, notPossibleTimeSlots); if (dragedCourse.getCoursesToHoldTogetherList().Count > 0) { foreach (Course edu_program_group in dragedCourse.getCoursesToHoldTogetherList()) { EduProgram epHT = (EduProgram)edu_program_group.Parent; markNotPossibleTimeSlotsRelEduProgram(epHT, tsp, notPossibleTimeSlots); } } //check in relation with groups ArrayList lessonsInOneTimeSlot = currTimetable[tsp.getIndexRow(), tsp.getIndexCol()]; markNotPossibleTimeSlotsRelGroup(lessonsInOneTimeSlot, tsp, dragedCourse, notPossibleTimeSlots); if (dragedCourse.getCoursesToHoldTogetherList().Count > 0) { foreach (Course edu_program_group in dragedCourse.getCoursesToHoldTogetherList()) { EduProgram epHT = (EduProgram)edu_program_group.Parent; ArrayList [,] myttHT = epHT.getTimetable(); ArrayList lessonsInOneTimeSlotHT = myttHT[tsp.getIndexRow(), tsp.getIndexCol()]; markNotPossibleTimeSlotsRelGroup(lessonsInOneTimeSlotHT, tsp, edu_program_group, notPossibleTimeSlots); } } //check if teacher is free for time slot markNotPossibleTimeSlotsRelTeacher(tsp, dragedTeacher, notPossibleTimeSlots); //check if there is any room with capacity greater than number //of enrolled students for draged edu_program_group, that is free for this time slot, // and with time slot allowed in definition of allowed time slots for room markNotPossibleTimeSlotsRelRoom(tsp, possibleRooms, notPossibleTimeSlots); } return(notPossibleTimeSlots); }