コード例 #1
0
 /// <summary>
 /// Determines if a section fits in this timetable
 /// </summary>
 /// <param name="section">A section</param>
 /// <returns>True if it fits; else false</returns>
 public bool DoesSectionFit(Section section)
 {
     foreach (Session session in section.Sessions)
     {
         if (!collection.CanAdd(session))
         {
             return(false);
         }
     }
     return(true);
 }
コード例 #2
0
        public bool CanAdd(T newItem)
        {
            if (IsEmpty)
            {
                return(true);
            }

            if (leftTree != null && newItem.CompareTo(content) < 0)
            {
                return(leftTree.CanAdd(newItem));
            }
            else if (rightTree != null && newItem.CompareTo(content) > 0)
            {
                return(rightTree.CanAdd(newItem));
            }
            else
            {
                return(false);
            }
        }