/** * Add this module to the sorted list. If current is the 'root' of a loop, then all elements of * that loops are added before. */ private void addToSortList(List sortedList) { for (Iterator it = loopElements.iterator(); it.hasNext(); ) { ModuleInSort moduleInLoop = (ModuleInSort) it.next(); moduleInLoop.addToSortList(sortedList); } if (!this.isSorted()) { sortedList.add(module); this.isSorted = true; } }
/** * Add this module to the sorted list except if this module is an intermediary element of a loop. * If this module is the 'root' of a loop, then all elements of that loops are added before. * * @param sorted The list of sorted elements on which this module will be added */ public void addToSortedListIfRequired(List sorted) { if (!isLoopIntermediateElement) { addToSortList(sorted); } }