public int sizeLessonComparator(Lesson l1, Lesson l2)
 {
     if (l1.getSize() > l2.getSize())
     {
         return(1);
     }
     else if (l1.getSize() < l2.getSize())
     {
         return(-1);
     }
     else
     {
         return(amountLessonComparator(l1, l2));
     }
 }
Exemple #2
0
        public List <TimeSlot> getFreeSlots(Lesson lesson)
        {
            List <TimeSlot> freeSlots = new List <TimeSlot>();

            for (int h = 0; h < numberOfSlots - (lesson.getSize() - 1); ++h)
            {
                for (int d = 0; d < numberOfDays; ++d)
                {
                    bool result = true;

                    for (int i = 0; i < lesson.getSize(); ++i)
                    {
                        result = result && days[d].getSlot(h + i).isEmpty() && !days[d].getSlot(h + i).isLocked();
                    }

                    if (result)
                    {
                        freeSlots.Add(new TimeSlot(d, h));
                    }
                }
            }

            return(freeSlots);
        }