public void initalizeExampleData()
        {
            if(organic_room_types == null)
            {
                organic_room_types = new HashSet<RoomType>();
                organic_room_types.Add(RoomType.Projector);
                organic_room_types.Add(RoomType.Komin);
            }

            if(available_timeslots == null)
            {
                var available_timeslot = new TimeSlot(DayOfWeek.Monday, 9, 22);
                available_timeslots = new List<TimeSlot>();
                available_timeslots.Add(available_timeslot);
            }

            if(rooms == null)
            {
                var room = new Room(organic_room_types, 150, available_timeslots, "ХФ210");
                rooms = new HashSet<Room>();
                rooms.Add(room);
            }

            if(requirements_list == null)
            {
                var requirements = new Requirements(10, available_timeslots, rooms);
                requirements_list = new List<Requirements>();
                requirements_list.Add(requirements);
                var organich_chemistry_teacher = new Teacher(requirements_list[0], "Prof. Hristo Hristov");
            }
            var organic_chemistry_teachers = new List<Teacher>();

            var s = new Subject(organic_room_types, organic_chemistry_teachers, "Organic Chemistry Lectures", 1);
        }
 public ScheduledTimeSlot(Subject subject, Room room, TimeSlot timeSlot, HashSet<Group> groups)
 {
     this.subject = subject;
     this.room = room;
     this.timeSlot = timeSlot;
     this.groups = groups;
 }
        public static void AddTimeSlotToAvailability(List<TimeSlot> availability, TimeSlot timeSlot)
        {
            foreach (var availableTimeSlot in availability.Where(a => a.Day == timeSlot.Day))
            {
                if (availableTimeSlot.EndHour == timeSlot.StartHour)
                {
                    availableTimeSlot.AddAfter(timeSlot);

                    var index = availability.FindIndex(a => a.Day == timeSlot.Day && a.StartHour == availableTimeSlot.EndHour);
                    if (index != -1)
                    {
                        availableTimeSlot.AddAfter(availability[index]);
                        availability.RemoveAt(index);
                    }
                    break;
                }
                if (availableTimeSlot.StartHour == timeSlot.EndHour)
                {
                    availableTimeSlot.AddBefore(timeSlot);

                    var index = availability.FindIndex(a => a.Day == timeSlot.Day && a.EndHour == availableTimeSlot.StartHour);
                    if (index != -1)
                    {
                        availableTimeSlot.AddBefore(availability[index]);
                        availability.RemoveAt(index);
                    }
                    break;
                }
            }
        }
 // TODO: make this list<timeslots> to a linked list
 public static void RemoveTimeSlotFromAvailability(List<TimeSlot> availability, TimeSlot timeSlot)
 {
     for (int i = 0; i < availability.Count; i++)
     {
         var availableTimeSlot = availability[i];
         if (availableTimeSlot.Includes(timeSlot))
         {
             availability.RemoveAt(i);
             availability.AddRange(availableTimeSlot.Remove(timeSlot));
             break;
         }
     }
 }
        internal IEnumerable<TimeSlot> Remove(TimeSlot timeSlot)
        {
            if (StartHour < timeSlot.StartHour)
            {
                yield return new TimeSlot(Day, StartHour, timeSlot.StartHour);
            }

            if (EndHour > timeSlot.EndHour)
            {
                yield return new TimeSlot(Day, timeSlot.EndHour, EndHour);
            }
        }
 internal void AddBefore(TimeSlot timeSlot)
 {
     StartHour = timeSlot.StartHour;
 }
 internal void AddAfter(TimeSlot timeSlot)
 {
     EndHour = timeSlot.EndHour;
 }
 public bool Overlaps(TimeSlot other)
 {
     return other.Day == Day && ((other.StartHour >= StartHour && other.StartHour < EndHour) ||
                                 (other.EndHour   > StartHour  && other.EndHour  <= EndHour));
 }
 public bool Includes(TimeSlot other)
 {
     return other.Day == Day && other.StartHour >= StartHour && other.EndHour <= EndHour;
 }