public Link(Competency init, Competency result, Course course) { this.initialCompetency = init; this.resultingCompetency = result; this.linkingCourses = new List <Course>(); this.LinkingCourses.Add(course); }
private void addCompetencyAndLinksToDomain(Domain domain, Course course, Competency compOfCourse, Competency prevComp) { bool compFound = false; foreach (Competency compOfDomain in domain.Competencies) { if (compOfCourse.Name == compOfDomain.Name) { compFound = true; break; } } if (!compFound) { domain.AddCompetency(compOfCourse); } if (prevComp != null) { bool linkFound = false; foreach (Link link in domain.Links) { if ((link.InitialCompetency.Name == prevComp.Name) && (link.ResultingCompetency.Name == compOfCourse.Name)) { linkFound = true; bool linkingCourseFound = false; foreach (Course linkingCourse in link.LinkingCourses) { if (linkingCourse.Name == course.Name) { linkingCourseFound = true; break; } } if (!linkingCourseFound) { link.LinkingCourses.Add(course); } } } if (!linkFound) { Link link = new Link(prevComp, compOfCourse, course); domain.AddLink(link); } } if (prevComp == null) { foreach (Competency postComp in course.PostrequisiteCompetencies) { addCompetencyAndLinksToDomain(domain, course, postComp, compOfCourse); } } }
public Course generateCourse(int qtyOfPreCompetencies, int qtyOfPostCompetencies) { for (int i = 1; i <= qtyOfPreCompetencies; i++) { Competency comp = new Competency("Competency" + i); this.addPrerequisite(comp); } for (int i = 1; i <= qtyOfPostCompetencies; i++) { Competency comp = new Competency("Competency" + i); this.addPostrequisite(comp); } printCourse(this); return(this); }
private void addCompetencyAndLinksToDomain(Domain domain, Course course, Competency compOfCourse, Competency prevComp, List <Competency> postCompetencies) { bool compFound = false; foreach (Competency compOfDomain in domain.Competencies) { if (compOfCourse == compOfDomain) { compFound = true; break; } if (!compFound) { domain.AddCompetency(compOfCourse); if (prevComp != null) { bool linkFound = false; foreach (Link link in domain.Links) { if ((link.InitialCompetency == prevComp) && (link.ResultingCompetency == compOfCourse)) { linkFound = true; } } if (!linkFound) { Link link = new Link(prevComp, compOfCourse, course); } } } if (prevComp == null) { foreach (Competency postComp in postCompetencies) { addCompetencyAndLinksToDomain(domain, course, postComp, compOfCourse, null); } } } }
public void AddCompetency(Competency comp) { this.competencies.Add(comp); }
public void addPostrequisite(Competency comp) { this.PostrequisiteCompetencies.Add(comp); }