// Path: sorter/src/main/java/sortpom/wrapper/content/SingleNewlineInTextWrapper.java
// public final class SingleNewlineInTextWrapper implements Wrapper<Content> {
//     public static final SingleNewlineInTextWrapper INSTANCE = new SingleNewlineInTextWrapper();
// 
//     /** Instantiates a new wrapper, whose content will be thrown away. */
//     private SingleNewlineInTextWrapper() {
//     }
// 
//     @Override
//     public Text getContent() {
//         throw new UnsupportedOperationException();
//     }
// 
//     @Override
//     public boolean isBefore(final Wrapper<? extends Content> wrapper) {
//         throw new UnsupportedOperationException();
//     }
// 
//     @Override
//     public boolean isContentElement() {
//         throw new UnsupportedOperationException();
//     }
// 
//     @Override
//     public boolean isSortable() {
//         throw new UnsupportedOperationException();
//     }
// 
//     @Override
//     public String toString() {
//         return "SingleNewlineInTextWrapper";
//     }
// }
// 
// Path: sorter/src/main/java/sortpom/wrapper/content/Wrapper.java
// public interface Wrapper<T extends Content> {
// 
//     /**
//      * Gets the wrapped content.
//      *
//      * @return the content
//      */
//     T getContent();
// 
//     /**
//      * Checks if wrapper should be placed before another wrapper.
//      *
//      * @param wrapper the wrapper
//      * @return true, if is before
//      */
//     boolean isBefore(Wrapper<? extends Content> wrapper);
// 
//     /**
//      * Checks if is content is of type Element. Default behaviour is that it contains an element.
//      *
//      * @return true, if is content element
//      */
//     default boolean isContentElement() {
//         return true;
//     }
// 
//     /**
//      * Checks if wrapper should be sorted. Default behaviour is that it that the Wrapper is sortable.
//      *
//      * @return true, if is sortable
//      */
//     default boolean isSortable() {
//         return true;
//     }
// 
//     /**
//      * Output debug-friendly string
//      *
//      * @param indent The indentation indicates nested elements
//      * @return The debug string
//      */
//     default String toString(String indent) {
//         return indent + toString();
//     }
// 
// }


import org.jdom.Content;
import org.jdom.Element;
import sortpom.wrapper.content.SingleNewlineInTextWrapper;
import sortpom.wrapper.content.Wrapper;
import java.util.ArrayList;
import java.util.List;
package sortpom.wrapper.operation;



/**
 * Aggregates a number of wrappers, so that they can be treated as a recursive hierarchy.
 *
 * @author Bjorn
 */
class HierarchyWrapper {
    private Wrapper<Element> elementContent;
    private final List<Wrapper<Content>> otherContentList = new ArrayList<>();
    private final List<HierarchyWrapper> children = new ArrayList<>();

    HierarchyWrapper(final Wrapper<? extends Content> wrapper) {
        addContent(wrapper);
    }

    @SuppressWarnings("unchecked")
    private void addContent(final Wrapper<? extends Content> wrapper) {
        if (wrapper.isContentElement()) {
            elementContent = (Wrapper<Element>) wrapper;
        } else {
            otherContentList.add((Wrapper<Content>) wrapper);
        }

    }

    /** Traverses the initial xml element wrapper and builds hierarchy */
    void createWrappedStructure(final WrapperFactory factory) {
        HierarchyWrapper currentWrapper = null;
        for (Content child : castToContentList(elementContent)) {
            Wrapper<?> wrapper = factory.create(child);
// Path: sorter/src/main/java/sortpom/wrapper/content/SingleNewlineInTextWrapper.java
// public final class SingleNewlineInTextWrapper implements Wrapper<Content> {
//     public static final SingleNewlineInTextWrapper INSTANCE = new SingleNewlineInTextWrapper();
// 
//     /** Instantiates a new wrapper, whose content will be thrown away. */
//     private SingleNewlineInTextWrapper() {
//     }
// 
//     @Override
//     public Text getContent() {
//         throw new UnsupportedOperationException();
//     }
// 
//     @Override
//     public boolean isBefore(final Wrapper<? extends Content> wrapper) {
//         throw new UnsupportedOperationException();
//     }
// 
//     @Override
//     public boolean isContentElement() {
//         throw new UnsupportedOperationException();
//     }
// 
//     @Override
//     public boolean isSortable() {
//         throw new UnsupportedOperationException();
//     }
// 
//     @Override
//     public String toString() {
//         return "SingleNewlineInTextWrapper";
//     }
// }
// 
// Path: sorter/src/main/java/sortpom/wrapper/content/Wrapper.java
// public interface Wrapper<T extends Content> {
// 
//     /**
//      * Gets the wrapped content.
//      *
//      * @return the content
//      */
//     T getContent();
// 
//     /**
//      * Checks if wrapper should be placed before another wrapper.
//      *
//      * @param wrapper the wrapper
//      * @return true, if is before
//      */
//     boolean isBefore(Wrapper<? extends Content> wrapper);
// 
//     /**
//      * Checks if is content is of type Element. Default behaviour is that it contains an element.
//      *
//      * @return true, if is content element
//      */
//     default boolean isContentElement() {
//         return true;
//     }
// 
//     /**
//      * Checks if wrapper should be sorted. Default behaviour is that it that the Wrapper is sortable.
//      *
//      * @return true, if is sortable
//      */
//     default boolean isSortable() {
//         return true;
//     }
// 
//     /**
//      * Output debug-friendly string
//      *
//      * @param indent The indentation indicates nested elements
//      * @return The debug string
//      */
//     default String toString(String indent) {
//         return indent + toString();
//     }
// 
// }


// Path: sorter/src/main/java/sortpom/wrapper/operation/HierarchyWrapper.java
import org.jdom.Content;
import org.jdom.Element;
import sortpom.wrapper.content.SingleNewlineInTextWrapper;
import sortpom.wrapper.content.Wrapper;
import java.util.ArrayList;
import java.util.List;

package sortpom.wrapper.operation;



/**
 * Aggregates a number of wrappers, so that they can be treated as a recursive hierarchy.
 *
 * @author Bjorn
 */
class HierarchyWrapper {
    private Wrapper<Element> elementContent;
    private final List<Wrapper<Content>> otherContentList = new ArrayList<>();
    private final List<HierarchyWrapper> children = new ArrayList<>();

    HierarchyWrapper(final Wrapper<? extends Content> wrapper) {
        addContent(wrapper);
    }

    @SuppressWarnings("unchecked")
    private void addContent(final Wrapper<? extends Content> wrapper) {
        if (wrapper.isContentElement()) {
            elementContent = (Wrapper<Element>) wrapper;
        } else {
            otherContentList.add((Wrapper<Content>) wrapper);
        }

    }

    /** Traverses the initial xml element wrapper and builds hierarchy */
    void createWrappedStructure(final WrapperFactory factory) {
        HierarchyWrapper currentWrapper = null;
        for (Content child : castToContentList(elementContent)) {
            Wrapper<?> wrapper = factory.create(child);
            if (wrapper instanceof SingleNewlineInTextWrapper) {