/*
 * Decompiled with CFR 0_110.
 * 
 * Could not load the following classes:
 *  java.lang.Class
 *  java.lang.ClassNotFoundException
 *  java.lang.Exception
 *  java.lang.NoClassDefFoundError
 *  java.lang.Object
 *  java.lang.String
 *  java.lang.System
 *  java.util.Map
 *  org.w3c.dom.DOMException
 *  org.w3c.dom.DOMImplementation
 *  org.w3c.dom.Document
 *  org.w3c.dom.DocumentType
 */
package org.dom4j.dom;

import java.util.Map;
import org.dom4j.Attribute;
import org.dom4j.CDATA;
import org.dom4j.Comment;
import org.dom4j.Document;
import org.dom4j.DocumentFactory;
import org.dom4j.DocumentType;
import org.dom4j.Element;
import org.dom4j.Entity;
import org.dom4j.Namespace;
import org.dom4j.ProcessingInstruction;
import org.dom4j.QName;
import org.dom4j.Text;
import org.dom4j.dom.DOMAttribute;
import org.dom4j.dom.DOMCDATA;
import org.dom4j.dom.DOMComment;
import org.dom4j.dom.DOMDocument;
import org.dom4j.dom.DOMDocumentType;
import org.dom4j.dom.DOMElement;
import org.dom4j.dom.DOMEntityReference;
import org.dom4j.dom.DOMNamespace;
import org.dom4j.dom.DOMProcessingInstruction;
import org.dom4j.dom.DOMText;
import org.dom4j.util.SingletonStrategy;
import org.w3c.dom.DOMException;
import org.w3c.dom.DOMImplementation;

public class DOMDocumentFactory
extends DocumentFactory
implements DOMImplementation {
    static Class class$org$dom4j$dom$DOMDocumentFactory;
    private static SingletonStrategy singleton;

    /*
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     */
    static {
        Class class_;
        singleton = null;
        try {
            Class class_2;
            class_ = class_2 = Class.forName((String)System.getProperty((String)"org.dom4j.dom.DOMDocumentFactory.singleton.strategy", (String)"org.dom4j.util.SimpleSingleton"));
        }
        catch (Exception var0_4) {
            try {
                Class class_3;
                class_ = class_3 = Class.forName((String)"org.dom4j.util.SimpleSingleton");
            }
            catch (Exception var1_6) {
                class_ = null;
            }
        }
        try {
            Class class_4;
            SingletonStrategy singletonStrategy = DOMDocumentFactory.singleton = (SingletonStrategy)class_.newInstance();
            if (class$org$dom4j$dom$DOMDocumentFactory == null) {
                class$org$dom4j$dom$DOMDocumentFactory = class_4 = DOMDocumentFactory.class$("org.dom4j.dom.DOMDocumentFactory");
            } else {
                class_4 = class$org$dom4j$dom$DOMDocumentFactory;
            }
            singletonStrategy.setSingletonClassName(class_4.getName());
            return;
        }
        catch (Exception var3_7) {
            return;
        }
    }

    static Class class$(String string2) {
        try {
            Class class_ = Class.forName((String)string2);
            return class_;
        }
        catch (ClassNotFoundException var1_2) {
            throw new NoClassDefFoundError(var1_2.getMessage());
        }
    }

    public static DocumentFactory getInstance() {
        return (DOMDocumentFactory)singleton.instance();
    }

    protected DOMDocumentType asDocumentType(org.w3c.dom.DocumentType documentType) {
        if (documentType instanceof DOMDocumentType) {
            return (DOMDocumentType)documentType;
        }
        return new DOMDocumentType(documentType.getName(), documentType.getPublicId(), documentType.getSystemId());
    }

    @Override
    public Attribute createAttribute(Element element, QName qName, String string2) {
        return new DOMAttribute(qName, string2);
    }

    @Override
    public CDATA createCDATA(String string2) {
        return new DOMCDATA(string2);
    }

    @Override
    public Comment createComment(String string2) {
        return new DOMComment(string2);
    }

    @Override
    public DocumentType createDocType(String string2, String string3, String string4) {
        return new DOMDocumentType(string2, string3, string4);
    }

    @Override
    public Document createDocument() {
        DOMDocument dOMDocument = new DOMDocument();
        dOMDocument.setDocumentFactory(this);
        return dOMDocument;
    }

    /*
     * Enabled aggressive block sorting
     */
    public org.w3c.dom.Document createDocument(String string2, String string3, org.w3c.dom.DocumentType documentType) throws DOMException {
        DOMDocument dOMDocument = documentType != null ? new DOMDocument(this.asDocumentType(documentType)) : new DOMDocument();
        dOMDocument.addElement(this.createQName(string3, string2));
        return dOMDocument;
    }

    public org.w3c.dom.DocumentType createDocumentType(String string2, String string3, String string4) throws DOMException {
        return new DOMDocumentType(string2, string3, string4);
    }

    @Override
    public Element createElement(QName qName) {
        return new DOMElement(qName);
    }

    public Element createElement(QName qName, int n) {
        return new DOMElement(qName, n);
    }

    public Entity createEntity(String string2) {
        return new DOMEntityReference(string2);
    }

    @Override
    public Entity createEntity(String string2, String string3) {
        return new DOMEntityReference(string2, string3);
    }

    @Override
    public Namespace createNamespace(String string2, String string3) {
        return new DOMNamespace(string2, string3);
    }

    @Override
    public ProcessingInstruction createProcessingInstruction(String string2, String string3) {
        return new DOMProcessingInstruction(string2, string3);
    }

    @Override
    public ProcessingInstruction createProcessingInstruction(String string2, Map map) {
        return new DOMProcessingInstruction(string2, map);
    }

    @Override
    public Text createText(String string2) {
        return new DOMText(string2);
    }

    /*
     * Enabled force condition propagation
     * Lifted jumps to return sites
     */
    public boolean hasFeature(String string2, String string3) {
        boolean bl;
        if (!"XML".equalsIgnoreCase(string2)) {
            boolean bl2 = "Core".equalsIgnoreCase(string2);
            bl = false;
            if (!bl2) return bl;
        }
        if (string3 == null) return true;
        if (string3.length() == 0) return true;
        if ("1.0".equals((Object)string3)) return true;
        boolean bl3 = "2.0".equals((Object)string3);
        bl = false;
        if (!bl3) return bl;
        return true;
    }
}

