/*
 * Decompiled with CFR 0_110.
 * 
 * Could not load the following classes:
 *  java.lang.Cloneable
 *  java.lang.IllegalArgumentException
 *  java.lang.Integer
 *  java.lang.Object
 *  java.lang.String
 *  java.lang.StringBuffer
 */
package org.dom4j.io;

public class OutputFormat
implements Cloneable {
    protected static final String STANDARD_INDENT = "  ";
    private char attributeQuoteChar;
    private boolean doXHTML;
    private String encoding;
    private boolean expandEmptyElements;
    private String indent;
    private String lineSeparator;
    private boolean newLineAfterDeclaration;
    private int newLineAfterNTags;
    private boolean newlines;
    private boolean omitEncoding;
    private boolean padText;
    private boolean suppressDeclaration;
    private boolean trimText;

    public OutputFormat() {
        this.suppressDeclaration = false;
        this.newLineAfterDeclaration = true;
        this.encoding = "UTF-8";
        this.omitEncoding = false;
        this.indent = null;
        this.expandEmptyElements = false;
        this.newlines = false;
        this.lineSeparator = "\n";
        this.trimText = false;
        this.padText = false;
        this.doXHTML = false;
        this.newLineAfterNTags = 0;
        this.attributeQuoteChar = 34;
    }

    public OutputFormat(String string2) {
        this.suppressDeclaration = false;
        this.newLineAfterDeclaration = true;
        this.encoding = "UTF-8";
        this.omitEncoding = false;
        this.indent = null;
        this.expandEmptyElements = false;
        this.newlines = false;
        this.lineSeparator = "\n";
        this.trimText = false;
        this.padText = false;
        this.doXHTML = false;
        this.newLineAfterNTags = 0;
        this.attributeQuoteChar = 34;
        this.indent = string2;
    }

    public OutputFormat(String string2, boolean bl) {
        this.suppressDeclaration = false;
        this.newLineAfterDeclaration = true;
        this.encoding = "UTF-8";
        this.omitEncoding = false;
        this.indent = null;
        this.expandEmptyElements = false;
        this.newlines = false;
        this.lineSeparator = "\n";
        this.trimText = false;
        this.padText = false;
        this.doXHTML = false;
        this.newLineAfterNTags = 0;
        this.attributeQuoteChar = 34;
        this.indent = string2;
        this.newlines = bl;
    }

    public OutputFormat(String string2, boolean bl, String string3) {
        this.suppressDeclaration = false;
        this.newLineAfterDeclaration = true;
        this.encoding = "UTF-8";
        this.omitEncoding = false;
        this.indent = null;
        this.expandEmptyElements = false;
        this.newlines = false;
        this.lineSeparator = "\n";
        this.trimText = false;
        this.padText = false;
        this.doXHTML = false;
        this.newLineAfterNTags = 0;
        this.attributeQuoteChar = 34;
        this.indent = string2;
        this.newlines = bl;
        this.encoding = string3;
    }

    public static OutputFormat createCompactFormat() {
        OutputFormat outputFormat = new OutputFormat();
        outputFormat.setIndent(false);
        outputFormat.setNewlines(false);
        outputFormat.setTrimText(true);
        return outputFormat;
    }

    public static OutputFormat createPrettyPrint() {
        OutputFormat outputFormat = new OutputFormat();
        outputFormat.setIndentSize(2);
        outputFormat.setNewlines(true);
        outputFormat.setTrimText(true);
        outputFormat.setPadText(true);
        return outputFormat;
    }

    public char getAttributeQuoteCharacter() {
        return this.attributeQuoteChar;
    }

    public String getEncoding() {
        return this.encoding;
    }

    public String getIndent() {
        return this.indent;
    }

    public String getLineSeparator() {
        return this.lineSeparator;
    }

    public int getNewLineAfterNTags() {
        return this.newLineAfterNTags;
    }

    public boolean isExpandEmptyElements() {
        return this.expandEmptyElements;
    }

    public boolean isNewLineAfterDeclaration() {
        return this.newLineAfterDeclaration;
    }

    public boolean isNewlines() {
        return this.newlines;
    }

    public boolean isOmitEncoding() {
        return this.omitEncoding;
    }

    public boolean isPadText() {
        return this.padText;
    }

    public boolean isSuppressDeclaration() {
        return this.suppressDeclaration;
    }

    public boolean isTrimText() {
        return this.trimText;
    }

    public boolean isXHTML() {
        return this.doXHTML;
    }

    /*
     * Enabled aggressive block sorting
     */
    public int parseOptions(String[] arrstring, int n) {
        int n2 = arrstring.length;
        while (n < n2) {
            if (arrstring[n].equals((Object)"-suppressDeclaration")) {
                this.setSuppressDeclaration(true);
            } else if (arrstring[n].equals((Object)"-omitEncoding")) {
                this.setOmitEncoding(true);
            } else if (arrstring[n].equals((Object)"-indent")) {
                this.setIndent(arrstring[++n]);
            } else if (arrstring[n].equals((Object)"-indentSize")) {
                this.setIndentSize(Integer.parseInt((String)arrstring[++n]));
            } else if (arrstring[n].startsWith("-expandEmpty")) {
                this.setExpandEmptyElements(true);
            } else if (arrstring[n].equals((Object)"-encoding")) {
                this.setEncoding(arrstring[++n]);
            } else if (arrstring[n].equals((Object)"-newlines")) {
                this.setNewlines(true);
            } else if (arrstring[n].equals((Object)"-lineSeparator")) {
                this.setLineSeparator(arrstring[++n]);
            } else if (arrstring[n].equals((Object)"-trimText")) {
                this.setTrimText(true);
            } else if (arrstring[n].equals((Object)"-padText")) {
                this.setPadText(true);
            } else {
                if (!arrstring[n].startsWith("-xhtml")) break;
                this.setXHTML(true);
            }
            ++n;
        }
        return n;
    }

    public void setAttributeQuoteCharacter(char c) {
        if (c == '\'' || c == '\"') {
            this.attributeQuoteChar = c;
            return;
        }
        throw new IllegalArgumentException(new StringBuffer().append("Invalid attribute quote character (").append(c).append(")").toString());
    }

    public void setEncoding(String string2) {
        if (string2 != null) {
            this.encoding = string2;
        }
    }

    public void setExpandEmptyElements(boolean bl) {
        this.expandEmptyElements = bl;
    }

    public void setIndent(String string2) {
        if (string2 != null && string2.length() <= 0) {
            string2 = null;
        }
        this.indent = string2;
    }

    public void setIndent(boolean bl) {
        if (bl) {
            this.indent = "  ";
            return;
        }
        this.indent = null;
    }

    public void setIndentSize(int n) {
        StringBuffer stringBuffer = new StringBuffer();
        for (int i = 0; i < n; ++i) {
            stringBuffer.append(" ");
        }
        this.indent = stringBuffer.toString();
    }

    public void setLineSeparator(String string2) {
        this.lineSeparator = string2;
    }

    public void setNewLineAfterDeclaration(boolean bl) {
        this.newLineAfterDeclaration = bl;
    }

    public void setNewLineAfterNTags(int n) {
        this.newLineAfterNTags = n;
    }

    public void setNewlines(boolean bl) {
        this.newlines = bl;
    }

    public void setOmitEncoding(boolean bl) {
        this.omitEncoding = bl;
    }

    public void setPadText(boolean bl) {
        this.padText = bl;
    }

    public void setSuppressDeclaration(boolean bl) {
        this.suppressDeclaration = bl;
    }

    public void setTrimText(boolean bl) {
        this.trimText = bl;
    }

    public void setXHTML(boolean bl) {
        this.doXHTML = bl;
    }
}

