code: private void addElementsToSortOrderMap(final Element element, int baseSortOrder) {
          elementSortOrderMap.addElement(element, baseSortOrder);
          final List<Element> castToChildElementList = castToChildElementList(element);
          // Increments the sort order index for each element
          int sortOrder = baseSortOrder;
          for (Element child : castToChildElementList) {
              sortOrder += SORT_ORDER_INCREMENT;
              addElementsToSortOrderMap(child, sortOrder);
          }
      }
docs: Processes the chosen sort order. Adds sort order element and sort index to
  a map.