Exemplo n.º 1
0
 private static void SetGroup(CourseGroup group, IEnumerable <ClassAcitivity> classAcitivities)
 {
     foreach (ClassAcitivity classAcitivity in classAcitivities)
     {
         classAcitivity.Group = group;
     }
 }
        public void BuildCoursePlacement(Course course, CourseGroup group)
        {
            if (!IsValid)
            {
                return;
            }

            CourseSchedulePlacement placement = CurrentCourseActivities.BuildCoursePlacement(course, group);

            CurrentPlacements.Add(placement);
        }
Exemplo n.º 3
0
        private bool CalculateSetup_EmptyKindOfClassActivities
        (
            ImmutableListEnumerator <Course> courses,
            CourseGroup group,
            ImmutableListEnumerator <ClassActivitiesInfo> classActivitiesOfKindEnumerator,
            ClassActivitiesInfo classActivitiesOfKind)
        {
            if (!classActivitiesOfKind.CanBeEmpty)
            {
                throw new InvalidScheduleException("The class activities cannot be empty");
            }

            return(CalculateSetup_NextClassActivity(courses, group, classActivitiesOfKindEnumerator, null));
        }
Exemplo n.º 4
0
        private bool CalculateSetup_NextClassActivity
        (
            ImmutableListEnumerator <Course> courses,
            CourseGroup group,
            ImmutableListEnumerator <ClassActivitiesInfo> classActivitiesOfKindEnumerator,
            IClassActivity classActivity
        )
        {
            bool added   = CurrentScheduleBuilder.AddClassActivity(classActivity);
            bool success = CalculateSetup_NextKindOfClassActivities(courses, group, classActivitiesOfKindEnumerator);

            CurrentScheduleBuilder.RemoveLastClassActivity();
            return(added && success);
        }
Exemplo n.º 5
0
        public CourseGroup Build()
        {
            if (Lecture == null)
            {
                throw new InvalidOperationException("The lecture must be set first.");
            }

            ClassAcitivity lecture = Lecture.CreateClassActivity();
            IEnumerable <ClassAcitivity> practicalClasses = BuildClassActivities(PracticalClasses);
            IEnumerable <ClassAcitivity> labs             = BuildClassActivities(Labs);
            var group = new CourseGroup(lecture, practicalClasses, labs);

            lecture.Group = group;
            SetGroup(group, practicalClasses);
            SetGroup(group, labs);
            return(group);
        }
Exemplo n.º 6
0
        private bool CalculateSetup_ClassActivitiesOfKind
        (
            ImmutableListEnumerator <Course> courses,
            CourseGroup group,
            ImmutableListEnumerator <ClassActivitiesInfo> classActivitiesOfKindEnumerator,
            ClassActivitiesInfo classActivitiesOfKind
        )
        {
            bool atLeastOne = false;

            foreach (IClassActivity classActivity in classActivitiesOfKind)
            {
                bool successs = CalculateSetup_NextClassActivity(courses, group, classActivitiesOfKindEnumerator, classActivity);
                if (successs)
                {
                    atLeastOne = true;
                }
            }

            return(atLeastOne);
        }
Exemplo n.º 7
0
        private bool CalculateSetup_NextKindOfClassActivities
        (
            ImmutableListEnumerator <Course> courses,
            CourseGroup group,
            ImmutableListEnumerator <ClassActivitiesInfo> classActivitiesOfKindEnumerator
        )
        {
            classActivitiesOfKindEnumerator = classActivitiesOfKindEnumerator.MoveNext();
            if (classActivitiesOfKindEnumerator.HasEnded)
            {
                return(CalculateSetup_BuildCoursePlacement(courses, group));
            }

            ClassActivitiesInfo classActivitiesOfKind = classActivitiesOfKindEnumerator.Current;

            if (classActivitiesOfKind.IsEmpty())
            {
                return(CalculateSetup_EmptyKindOfClassActivities(courses, group, classActivitiesOfKindEnumerator, classActivitiesOfKind));
            }

            return(CalculateSetup_ClassActivitiesOfKind(courses, group, classActivitiesOfKindEnumerator, classActivitiesOfKind));
        }
Exemplo n.º 8
0
 protected override IEnumerable <ClassActivitiesInfo> ClassActivitiesForGroup(Course course, CourseGroup group)
 {
     return(EnumerableExtensions.AsEnumerable
            (
                PraticeClasses[course],
                new ClassActivitiesInfo(group.Labs, true)
            ));
 }
Exemplo n.º 9
0
        private bool CalculateSetup_NextGroup(ImmutableListEnumerator <Course> courses, CourseGroup group)
        {
            IEnumerable <ClassActivitiesInfo> groupClassActivities = ClassActivitiesForGroup(courses.Current, group);
            var groupClassAcitivitiesEnumerator = ImmutableListEnumerator.FromEnumerable(groupClassActivities);

            return(CalculateSetup_NextClassActivity(courses, group, groupClassAcitivitiesEnumerator, group.Lecture));
        }
Exemplo n.º 10
0
 protected abstract IEnumerable <ClassActivitiesInfo> ClassActivitiesForGroup(Course course, CourseGroup group);
Exemplo n.º 11
0
        private bool CalculateSetup_BuildCoursePlacement(ImmutableListEnumerator <Course> courses, CourseGroup group)
        {
            CurrentScheduleBuilder.BuildCoursePlacement(courses.Current, group);
            bool success = CalculateSetup_NextCourse(courses);

            CurrentScheduleBuilder.RemoveLastCoursePlacement();
            return(success);
        }
Exemplo n.º 12
0
 public virtual CourseSchedulePlacement BuildCoursePlacement(Course course, CourseGroup group)
 {
     IClassActivity lab           = CurrentCourseActivities[^ 1];