/// <summary> /// Finds a class within a given time range. /// </summary> /// <returns>The first class found, or null if none were found.</returns> public Session FindClassDuring(Timeslot timeslot, bool selected) { return (ClassList.Where(session => !selected || session.Stream.Selected) .FirstOrDefault(session => session.ClashesWith(timeslot))); }
/// <summary> /// Check if there is a class within a given time range. /// </summary> public bool ClassDuring(Timeslot timeslot, bool selected) { return(FindClassDuring(timeslot, selected) != null); }
/// <summary> /// Find an unavailable timeslot within the given range. /// </summary> /// <returns>The first unavailable timeslot found within the range, or null if none were found.</returns> public Unavailability FindUnavailableDuring(Timeslot timeslot) { return(UnavailableList.FirstOrDefault(u => u.ClashesWith(timeslot))); }
/// <summary> /// Check if there is an unavailable timeslot within the given timeslot. /// </summary> public bool UnavailableDuring(Timeslot timeslot) { return(FindUnavailableDuring(timeslot) != null); }
/// <summary> /// Check if a given timeslot is free. /// </summary> /// <returns>True if there is nothing on during the timeslot.</returns> public bool FreeDuring(Timeslot timeslot, bool selected) { return(!ClassDuring(timeslot, selected) && !UnavailableDuring(timeslot)); }
public Unavailability(string name, Timeslot time) : base(time) { Name = name; }