// 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.Wrapper;
import java.util.List;
package sortpom.wrapper.operation;



/**
 * Xml hierarchy operation that returns xml content as readable text. Used by
 * Used in HierarchyWrapper.processOperation(HierarchyWrapperOperation operation)
 *
 * @author bjorn
 * @since 2013-11-02
 */
class ToStringOperation implements HierarchyWrapperOperation {
    private static final String INDENT = "  ";
    private static final int INDENT_LENGTH = INDENT.length();
    private final StringBuilder builder;
    private final String baseIndent;
    private boolean processFirstOtherContent;

    ToStringOperation() {
        builder = new StringBuilder();
        baseIndent = INDENT;
    }

    private ToStringOperation(StringBuilder builder, String baseIndent) {
        this.builder = builder;
        this.baseIndent = INDENT + baseIndent;
    }

    /** Add text before each element */
    @Override
    public void startOfProcess() {
        String previousBaseIndent = baseIndent.substring(INDENT_LENGTH);
        builder.append(previousBaseIndent).append("HierarchyWrapper{\n");
        processFirstOtherContent = true;
    }

    /** Add each 'other element' to string */
    @Override
// 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/ToStringOperation.java
import org.jdom.Content;
import org.jdom.Element;
import sortpom.wrapper.content.Wrapper;
import java.util.List;

package sortpom.wrapper.operation;



/**
 * Xml hierarchy operation that returns xml content as readable text. Used by
 * Used in HierarchyWrapper.processOperation(HierarchyWrapperOperation operation)
 *
 * @author bjorn
 * @since 2013-11-02
 */
class ToStringOperation implements HierarchyWrapperOperation {
    private static final String INDENT = "  ";
    private static final int INDENT_LENGTH = INDENT.length();
    private final StringBuilder builder;
    private final String baseIndent;
    private boolean processFirstOtherContent;

    ToStringOperation() {
        builder = new StringBuilder();
        baseIndent = INDENT;
    }

    private ToStringOperation(StringBuilder builder, String baseIndent) {
        this.builder = builder;
        this.baseIndent = INDENT + baseIndent;
    }

    /** Add text before each element */
    @Override
    public void startOfProcess() {
        String previousBaseIndent = baseIndent.substring(INDENT_LENGTH);
        builder.append(previousBaseIndent).append("HierarchyWrapper{\n");
        processFirstOtherContent = true;
    }

    /** Add each 'other element' to string */
    @Override
    public void processOtherContent(Wrapper<Content> content) {