checkIfBasicCompositesDisjunct(section);
checkIfAllProvidedCategoriesDefined(section);
Iterator<Field> iterator = section.getFieldIterator();
while (iterator.hasNext()) {
Field currField = iterator.next();
Set<String> value = new HashSet<String>();
value.add(currField.getName());
providingCatMap.put(currField.getName(), value);
}
// maps composite categories (Strings) to the count of
// not-yet-processed parents
Map<String, Integer> parentCounts = getParentCounts(section);
// all composite categories having zero parents now, being processed
// in the next iteration
Set<String> zeroCategories = getNotMentionedCompositeCategories(parentCounts, section);
while (zeroCategories.size() > 0) {
// composite categories that still need to be processed remain
// set of the composite categories where we process the last
// unprocessed parent within this iteration
Set<String> newZeroCategories = new HashSet<String>();
// for each category with zero unprocessed parents, add all its parents
// plus itself (stored within providingCatMap) to the providingCatMap-entries
// of all of its children. Update their parentCount-entries, subtracting one.
Iterator<String> zeroIterator = zeroCategories.iterator();
while (zeroIterator.hasNext()) {
String currCategory = zeroIterator.next();
Set<String> currCategoryProvides = providingCatMap.get(currCategory);
Field field = section.getField(currCategory);
for (int n = 0; n < field.getNumberOfValues(); n++) {
String currProvCategory = field.getStringValue(n);
Set<String> currProvSet = providingCatMap.get(currProvCategory);
currProvSet.addAll(currCategoryProvides);
if (parentCounts.containsKey(currProvCategory)) {
// This happens only for composite children.