/*
 * Decompiled with CFR 0_110.
 * 
 * Could not load the following classes:
 *  java.lang.String
 *  java.util.ArrayList
 *  java.util.List
 *  org.w3c.dom.Attr
 *  org.w3c.dom.CDATASection
 *  org.w3c.dom.Comment
 *  org.w3c.dom.DOMException
 *  org.w3c.dom.DOMImplementation
 *  org.w3c.dom.Document
 *  org.w3c.dom.DocumentFragment
 *  org.w3c.dom.DocumentType
 *  org.w3c.dom.Element
 *  org.w3c.dom.EntityReference
 *  org.w3c.dom.NamedNodeMap
 *  org.w3c.dom.Node
 *  org.w3c.dom.NodeList
 *  org.w3c.dom.ProcessingInstruction
 *  org.w3c.dom.Text
 */
package org.dom4j.dom;

import java.util.ArrayList;
import java.util.List;
import org.dom4j.Attribute;
import org.dom4j.Branch;
import org.dom4j.CDATA;
import org.dom4j.Comment;
import org.dom4j.DocumentFactory;
import org.dom4j.DocumentType;
import org.dom4j.Element;
import org.dom4j.Entity;
import org.dom4j.Node;
import org.dom4j.ProcessingInstruction;
import org.dom4j.QName;
import org.dom4j.Text;
import org.dom4j.dom.DOMDocumentFactory;
import org.dom4j.dom.DOMDocumentType;
import org.dom4j.dom.DOMElement;
import org.dom4j.dom.DOMNodeHelper;
import org.dom4j.tree.DefaultDocument;
import org.w3c.dom.Attr;
import org.w3c.dom.CDATASection;
import org.w3c.dom.DOMException;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.EntityReference;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.NodeList;

public class DOMDocument
extends DefaultDocument
implements Document {
    private static final DOMDocumentFactory DOCUMENT_FACTORY = (DOMDocumentFactory)DOMDocumentFactory.getInstance();

    public DOMDocument() {
        this.init();
    }

    public DOMDocument(String string2) {
        super(string2);
        super.init();
    }

    public DOMDocument(String string2, DOMElement dOMElement, DOMDocumentType dOMDocumentType) {
        super(string2, dOMElement, dOMDocumentType);
        super.init();
    }

    public DOMDocument(DOMDocumentType dOMDocumentType) {
        super(dOMDocumentType);
        super.init();
    }

    public DOMDocument(DOMElement dOMElement) {
        super(dOMElement);
        super.init();
    }

    public DOMDocument(DOMElement dOMElement, DOMDocumentType dOMDocumentType) {
        super(dOMElement, dOMDocumentType);
        super.init();
    }

    private void checkNewChildNode(org.w3c.dom.Node node) throws DOMException {
        short s = node.getNodeType();
        if (s != 1 && s != 8 && s != 7 && s != 10) {
            throw new DOMException(3, "Given node cannot be a child of document");
        }
    }

    private void init() {
        this.setDocumentFactory(DOCUMENT_FACTORY);
    }

    public org.w3c.dom.Node appendChild(org.w3c.dom.Node node) throws DOMException {
        super.checkNewChildNode(node);
        return DOMNodeHelper.appendChild((Node)this, node);
    }

    public org.w3c.dom.Node cloneNode(boolean bl) {
        return DOMNodeHelper.cloneNode((Node)this, bl);
    }

    public Attr createAttribute(String string2) throws DOMException {
        QName qName = this.getDocumentFactory().createQName(string2);
        return (Attr)this.getDocumentFactory().createAttribute(null, qName, "");
    }

    public Attr createAttributeNS(String string2, String string3) throws DOMException {
        QName qName = this.getDocumentFactory().createQName(string3, string2);
        return (Attr)this.getDocumentFactory().createAttribute(null, qName, null);
    }

    public CDATASection createCDATASection(String string2) throws DOMException {
        return (CDATASection)this.getDocumentFactory().createCDATA(string2);
    }

    public org.w3c.dom.Comment createComment(String string2) {
        return (org.w3c.dom.Comment)this.getDocumentFactory().createComment(string2);
    }

    public DocumentFragment createDocumentFragment() {
        DOMNodeHelper.notSupported();
        return null;
    }

    public org.w3c.dom.Element createElement(String string2) throws DOMException {
        return (org.w3c.dom.Element)this.getDocumentFactory().createElement(string2);
    }

    public org.w3c.dom.Element createElementNS(String string2, String string3) throws DOMException {
        QName qName = this.getDocumentFactory().createQName(string3, string2);
        return (org.w3c.dom.Element)this.getDocumentFactory().createElement(qName);
    }

    public EntityReference createEntityReference(String string2) throws DOMException {
        return (EntityReference)this.getDocumentFactory().createEntity(string2, null);
    }

    public org.w3c.dom.ProcessingInstruction createProcessingInstruction(String string2, String string3) throws DOMException {
        return (org.w3c.dom.ProcessingInstruction)this.getDocumentFactory().createProcessingInstruction(string2, string3);
    }

    public org.w3c.dom.Text createTextNode(String string2) {
        return (org.w3c.dom.Text)this.getDocumentFactory().createText(string2);
    }

    public NamedNodeMap getAttributes() {
        return null;
    }

    public NodeList getChildNodes() {
        return DOMNodeHelper.createNodeList(this.content());
    }

    public org.w3c.dom.DocumentType getDoctype() {
        return DOMNodeHelper.asDOMDocumentType(this.getDocType());
    }

    public org.w3c.dom.Element getDocumentElement() {
        return DOMNodeHelper.asDOMElement(this.getRootElement());
    }

    @Override
    protected DocumentFactory getDocumentFactory() {
        if (super.getDocumentFactory() == null) {
            return DOCUMENT_FACTORY;
        }
        return super.getDocumentFactory();
    }

    public org.w3c.dom.Element getElementById(String string2) {
        return DOMNodeHelper.asDOMElement(this.elementByID(string2));
    }

    public NodeList getElementsByTagName(String string2) {
        ArrayList arrayList = new ArrayList();
        DOMNodeHelper.appendElementsByTagName((List)arrayList, (Branch)this, string2);
        return DOMNodeHelper.createNodeList((List)arrayList);
    }

    public NodeList getElementsByTagNameNS(String string2, String string3) {
        ArrayList arrayList = new ArrayList();
        DOMNodeHelper.appendElementsByTagNameNS((List)arrayList, (Branch)this, string2, string3);
        return DOMNodeHelper.createNodeList((List)arrayList);
    }

    public org.w3c.dom.Node getFirstChild() {
        return DOMNodeHelper.asDOMNode(this.node(0));
    }

    public DOMImplementation getImplementation() {
        if (this.getDocumentFactory() instanceof DOMImplementation) {
            return (DOMImplementation)this.getDocumentFactory();
        }
        return DOCUMENT_FACTORY;
    }

    public org.w3c.dom.Node getLastChild() {
        return DOMNodeHelper.asDOMNode(this.node(-1 + this.nodeCount()));
    }

    public String getLocalName() {
        return DOMNodeHelper.getLocalName(this);
    }

    public String getNamespaceURI() {
        return DOMNodeHelper.getNamespaceURI(this);
    }

    public org.w3c.dom.Node getNextSibling() {
        return DOMNodeHelper.getNextSibling(this);
    }

    public String getNodeName() {
        return "#document";
    }

    public String getNodeValue() throws DOMException {
        return null;
    }

    public Document getOwnerDocument() {
        return null;
    }

    public org.w3c.dom.Node getParentNode() {
        return DOMNodeHelper.getParentNode(this);
    }

    public String getPrefix() {
        return DOMNodeHelper.getPrefix(this);
    }

    public org.w3c.dom.Node getPreviousSibling() {
        return DOMNodeHelper.getPreviousSibling(this);
    }

    public boolean hasAttributes() {
        return DOMNodeHelper.hasAttributes(this);
    }

    public boolean hasChildNodes() {
        if (this.nodeCount() > 0) {
            return true;
        }
        return false;
    }

    public org.w3c.dom.Node importNode(org.w3c.dom.Node node, boolean bl) throws DOMException {
        DOMNodeHelper.notSupported();
        return null;
    }

    public org.w3c.dom.Node insertBefore(org.w3c.dom.Node node, org.w3c.dom.Node node2) throws DOMException {
        super.checkNewChildNode(node);
        return DOMNodeHelper.insertBefore((Node)this, node, node2);
    }

    public boolean isSupported(String string2, String string3) {
        return DOMNodeHelper.isSupported((Node)this, string2, string3);
    }

    public org.w3c.dom.Node removeChild(org.w3c.dom.Node node) throws DOMException {
        return DOMNodeHelper.removeChild((Node)this, node);
    }

    public org.w3c.dom.Node replaceChild(org.w3c.dom.Node node, org.w3c.dom.Node node2) throws DOMException {
        super.checkNewChildNode(node);
        return DOMNodeHelper.replaceChild((Node)this, node, node2);
    }

    public void setNodeValue(String string2) throws DOMException {
    }

    public void setPrefix(String string2) throws DOMException {
        DOMNodeHelper.setPrefix((Node)this, string2);
    }

    public boolean supports(String string2, String string3) {
        return DOMNodeHelper.supports((Node)this, string2, string3);
    }
}

