Esempio n. 1
0
        /// <summary>
        /// Make a hardcopy of this timetable
        /// </summary>
        /// <returns>A hard copy of this timetable</returns>
        public ITimetable MakeCopy()
        {
            YearlyTimetable copy = new YearlyTimetable();

            copy.fallTimetable   = (SeasonalTimetable)fallTimetable.MakeCopy();
            copy.winterTimetable = (SeasonalTimetable)winterTimetable.MakeCopy();
            return(copy);
        }
        private List <Tuple <int, int> > GetAvailableSessions(int[] curTable)
        {
            // Make the timetable equivalent
            YearlyTimetable timetable = new YearlyTimetable();

            for (int i = 0; i < curTable.Length; i++)
            {
                if (curTable[i] != -1)
                {
                    Section section = requiredActivities[i][curTable[i]];
                    timetable.AddSection(section);
                }
            }

            // Each tuple represent a potential next session to be added to the table
            // Tuple.item1 refers to the required activity to add
            // Tuple.item2 refers to the specific session in the activity to add
            List <Tuple <int, int> > nextSessions = new List <Tuple <int, int> >();

            for (int i = 0; i < curTable.Length; i++)
            {
                if (curTable[i] == -1)
                {
                    Section[] potentialSections = requiredActivities[i];

                    List <Section> distinctSections = potentialSections.ToList(); //GetDistinctSections(potentialSections);

                    for (int j = 0; j < potentialSections.Length; j++)
                    {
                        if (timetable.DoesSectionFit(potentialSections[j]))
                        {
                            nextSessions.Add(new Tuple <int, int>(i, j));
                        }
                    }
                }
            }

            return(nextSessions);
        }