} } else { for (final DegreeModuleScope degreeModuleScope : degreeModuleScopes) { final GenericPair<Integer,Integer> yearSemester = new GenericPair<Integer,Integer>(degreeModuleScope.getCurricularYear(), degreeModuleScope.getCurricularSemester());  final Set<Enrolment> enrolmentsCurricularPeriod = orphanEnrolments.get(yearSemester); if (enrolmentsCurricularPeriod == null) { orphanEnrolments.put(yearSemester, new HashSet<Enrolment>()); } orphanEnrolments.get(yearSemester).add(enrolment);
	private void generateEnrolmentsCurricularPeriods() {	    final Map<GenericPair<Integer,Integer>, Set<Enrolment>> enrolmentsCurricularPeriods = new HashMap<GenericPair<Integer,Integer>, Set<Enrolment>>();	    final Map<GenericPair<Integer,Integer>, Set<Enrolment>> undefinedEnrolments = new HashMap<GenericPair<Integer,Integer>, Set<Enrolment>>();	    final Map<GenericPair<Integer,Integer>, Set<Enrolment>> orphanEnrolments = new HashMap<GenericPair<Integer,Integer>, Set<Enrolment>>();	    	    for (final Enrolment enrolment : studentCurricularPlan.getEnrolmentsSet()) {		if (enrolment.getDegreeModule().isLeaf()) {		    final CurricularCourse curricularCourse = (CurricularCourse) enrolment.getDegreeModule();		    		    List<DegreeModuleScope> degreeModuleScopes = curricularCourse.getActiveDegreeModuleScopesInExecutionPeriod(enrolment.getExecutionPeriod());		    if (degreeModuleScopes.size() == 1) {			final DegreeModuleScope degreeModuleScope = degreeModuleScopes.iterator().next();			final GenericPair<Integer,Integer> yearSemester = new GenericPair<Integer,Integer>(degreeModuleScope.getCurricularYear(), degreeModuleScope.getCurricularSemester());						final Set<Enrolment> enrolmentsCurricularPeriod = enrolmentsCurricularPeriods.get(yearSemester);			if (enrolmentsCurricularPeriod == null) {			    enrolmentsCurricularPeriods.put(yearSemester, new HashSet<Enrolment>());			}			enrolmentsCurricularPeriods.get(yearSemester).add(enrolment);		    } else if (degreeModuleScopes.isEmpty()) {			for (final DegreeModuleScope degreeModuleScope : degreeModuleScopes) {			    final GenericPair<Integer,Integer> yearSemester = new GenericPair<Integer,Integer>(degreeModuleScope.getCurricularYear(), degreeModuleScope.getCurricularSemester());							    final Set<Enrolment> enrolmentsCurricularPeriod = undefinedEnrolments.get(yearSemester);			    if (enrolmentsCurricularPeriod == null) {				undefinedEnrolments.put(yearSemester, new HashSet<Enrolment>());			    }			    undefinedEnrolments.get(yearSemester).add(enrolment);			}		    } else {			for (final DegreeModuleScope degreeModuleScope : degreeModuleScopes) {			    final GenericPair<Integer,Integer> yearSemester = new GenericPair<Integer,Integer>(degreeModuleScope.getCurricularYear(), degreeModuleScope.getCurricularSemester());							    final Set<Enrolment> enrolmentsCurricularPeriod = orphanEnrolments.get(yearSemester);			    if (enrolmentsCurricularPeriod == null) {				orphanEnrolments.put(yearSemester, new HashSet<Enrolment>());			    }			    orphanEnrolments.get(yearSemester).add(enrolment);			}		    }		}	    }	    	    List<GenericPair<Integer, Integer>> curricularPeriods = new ArrayList(enrolmentsCurricularPeriods.keySet());	    final ComparatorChain comparatorChain = new ComparatorChain();	    comparatorChain.addComparator(new BeanComparator("left"));	    comparatorChain.addComparator(new BeanComparator("right"));	    Collections.sort(curricularPeriods, comparatorChain);	    for (final GenericPair<Integer, Integer> yearSemester : curricularPeriods) {		generateEnrolmentCurricularPeriod(yearSemester, enrolmentsCurricularPeriods.get(yearSemester));	    }	    final HtmlText orphansInfo = new HtmlText("\nSem Scopes:\n");	    scpDiv.addChild(orphansInfo);	    	    List<GenericPair<Integer, Integer>> orphanCurricularPeriods = new ArrayList(orphanEnrolments.keySet());	    Collections.sort(orphanCurricularPeriods, comparatorChain);	    for (final GenericPair<Integer, Integer> yearSemester : orphanCurricularPeriods) {		generateEnrolmentCurricularPeriod(yearSemester, orphanEnrolments.get(yearSemester));	    }	    final HtmlText undefinedInfo = new HtmlText("\nMais do que um:\n");	    scpDiv.addChild(undefinedInfo);	    	    List<GenericPair<Integer, Integer>> undefinedCurricularPeriods = new ArrayList(undefinedEnrolments.keySet());	    Collections.sort(undefinedCurricularPeriods, comparatorChain);	    for (final GenericPair<Integer, Integer> yearSemester : undefinedCurricularPeriods) {		generateEnrolmentCurricularPeriod(yearSemester, undefinedEnrolments.get(yearSemester));	    }	}