/*
 * Decompiled with CFR 0_110.
 * 
 * Could not load the following classes:
 *  java.io.IOException
 *  java.io.Writer
 *  java.lang.Object
 *  java.lang.String
 *  java.lang.StringBuffer
 *  java.util.Iterator
 *  java.util.List
 */
package org.dom4j.tree;

import java.io.IOException;
import java.io.Writer;
import java.util.Iterator;
import java.util.List;
import org.dom4j.DocumentType;
import org.dom4j.Element;
import org.dom4j.Visitor;
import org.dom4j.tree.AbstractNode;

public abstract class AbstractDocumentType
extends AbstractNode
implements DocumentType {
    @Override
    public void accept(Visitor visitor) {
        visitor.visit((DocumentType)this);
    }

    @Override
    public String asXML() {
        String string2;
        StringBuffer stringBuffer = new StringBuffer("<!DOCTYPE ");
        stringBuffer.append(this.getElementName());
        String string3 = this.getPublicID();
        boolean bl = false;
        if (string3 != null) {
            int n = string3.length();
            bl = false;
            if (n > 0) {
                stringBuffer.append(" PUBLIC \"");
                stringBuffer.append(string3);
                stringBuffer.append("\"");
                bl = true;
            }
        }
        if ((string2 = this.getSystemID()) != null && string2.length() > 0) {
            if (!bl) {
                stringBuffer.append(" SYSTEM");
            }
            stringBuffer.append(" \"");
            stringBuffer.append(string2);
            stringBuffer.append("\"");
        }
        stringBuffer.append(">");
        return stringBuffer.toString();
    }

    @Override
    public String getName() {
        return this.getElementName();
    }

    @Override
    public short getNodeType() {
        return 10;
    }

    @Override
    public String getPath(Element element) {
        return "";
    }

    @Override
    public String getText() {
        List list = this.getInternalDeclarations();
        if (list != null && list.size() > 0) {
            StringBuffer stringBuffer = new StringBuffer();
            Iterator iterator = list.iterator();
            if (iterator.hasNext()) {
                stringBuffer.append(iterator.next().toString());
                while (iterator.hasNext()) {
                    Object object = iterator.next();
                    stringBuffer.append("\n");
                    stringBuffer.append(object.toString());
                }
            }
            return stringBuffer.toString();
        }
        return "";
    }

    @Override
    public String getUniquePath(Element element) {
        return "";
    }

    @Override
    public void setName(String string2) {
        this.setElementName(string2);
    }

    public String toString() {
        return new StringBuffer().append(super.toString()).append(" [DocumentType: ").append(this.asXML()).append("]").toString();
    }

    @Override
    public void write(Writer writer) throws IOException {
        List list;
        String string2;
        writer.write("<!DOCTYPE ");
        writer.write(this.getElementName());
        String string3 = this.getPublicID();
        boolean bl = false;
        if (string3 != null) {
            int n = string3.length();
            bl = false;
            if (n > 0) {
                writer.write(" PUBLIC \"");
                writer.write(string3);
                writer.write("\"");
                bl = true;
            }
        }
        if ((string2 = this.getSystemID()) != null && string2.length() > 0) {
            if (!bl) {
                writer.write(" SYSTEM");
            }
            writer.write(" \"");
            writer.write(string2);
            writer.write("\"");
        }
        if ((list = this.getInternalDeclarations()) != null && list.size() > 0) {
            writer.write(" [");
            for (Object object : list) {
                writer.write("\n  ");
                writer.write(object.toString());
            }
            writer.write("\n]");
        }
        writer.write(">");
    }
}

