Пример #1
0
        public void Test_AreNotEqual_1()
        {
            var s1 = new SubjectSchema(true, false, true);
            var s2 = new SubjectSchema(false, false, true);

            Assert.IsFalse(s1.Equals(s2));
        }
Пример #2
0
        public List <List <Slot> > GetPossibleTimetables(Slot[] inputSlots)
        {
            var subjects = SubjectModel.Parse(inputSlots.ToList());
            Func <Slot[], List <List <Slot> > > permutator = Permutator.Run_v2_withoutConsideringWeekNumber;

            subjects = SortBySlotCount(subjects);
            var currentSlots        = subjects[0].Slots;
            var possibleCombination = permutator.Invoke(currentSlots.ToArray());
            var state = StateTable.GetStateOfDefinitelyOccupied(possibleCombination);
            int last  = subjects.Count - 1;

            for (int i = 1; i < subjects.Count; i++)
            {
                var originalSchema = new SubjectSchema(subjects[i].Slots);
                var filtrate       = StateTable.Filter(subjects[i].Slots, state);
                var newSchema      = new SubjectSchema(filtrate);
                if (!originalSchema.Equals(newSchema))
                {
                    return(null);
                }
                currentSlots.AddRange(filtrate);
                possibleCombination = permutator.Invoke(currentSlots.ToArray());
                if (i != last)
                {
                    state = StateTable.GetStateOfDefinitelyOccupied(possibleCombination);
                }
            }
            return(possibleCombination);
        }
Пример #3
0
        public void Test_AreEqual_2()
        {
            var s1 = new SubjectSchema(false, true, false);
            var s2 = new SubjectSchema(false, true, false);

            Assert.IsTrue(s1.Equals(s2));
        }