//------------------------------------------------------------------------------ // AN ERROR CHECKING METHOD TO PREVENT CLASSES FROM HAPPENING DURING THE SAME TIME // check to see if a job overlaps with another job's times in a single // MachineNode; can't be in 2 places at once you know? //------------------------------------------------------------------------------ protected bool Overlap(Job j, Machine goal, MachineNode mn) { bool flag = false; //Defaulted to continue //need list of all the start and end times from goal List <DayTime> dt = goal.GetDateTime(); List <Machine> myMachines = mn.GetAllScheduledMachines(); //Look for Scheduled Courses in All Quarters for (int i = 0; i < myMachines.Count; i++) { Machine m = myMachines[i]; List <DayTime> tempDT = m.GetDateTime(); //Each class is available for the same amount of days if (dt.Count == tempDT.Count) { for (int k = 0; k < dt.Count; k++) { //Checks to see if the start time or end time exists between the start and end of a scheduled course if ((dt[k].GetStartTime() >= tempDT[k].GetStartTime() && dt[k].GetStartTime() <= tempDT[k].GetEndTime()) || (dt[k].GetEndTime() >= tempDT[k].GetStartTime() && dt[k].GetEndTime() <= tempDT[k].GetEndTime())) { flag = true; } } } else { int min = Math.Min(dt.Count, tempDT.Count); //Which class starts earlier //Compares the courses for the day they are taken on if (dt.Count == min) { flag = compareDays(dt, tempDT); } else { flag = compareDays(tempDT, dt); } if (flag) { return(flag); } } } return(flag); }