/*
 * Decompiled with CFR 0_110.
 * 
 * Could not load the following classes:
 *  java.lang.Object
 *  java.lang.String
 *  java.lang.StringBuffer
 *  org.w3c.dom.Attr
 *  org.w3c.dom.DOMException
 *  org.w3c.dom.NamedNodeMap
 *  org.w3c.dom.Node
 */
package org.dom4j.dom;

import org.dom4j.Attribute;
import org.dom4j.dom.DOMElement;
import org.dom4j.dom.DOMNodeHelper;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMException;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

public class DOMAttributeNodeMap
implements NamedNodeMap {
    private DOMElement element;

    public DOMAttributeNodeMap(DOMElement dOMElement) {
        this.element = dOMElement;
    }

    public void foo() throws DOMException {
        DOMNodeHelper.notSupported();
    }

    public int getLength() {
        return this.element.attributeCount();
    }

    public Node getNamedItem(String string2) {
        return this.element.getAttributeNode(string2);
    }

    public Node getNamedItemNS(String string2, String string3) {
        return this.element.getAttributeNodeNS(string2, string3);
    }

    public Node item(int n) {
        return DOMNodeHelper.asDOMAttr(this.element.attribute(n));
    }

    public Node removeNamedItem(String string2) throws DOMException {
        Attr attr2 = this.element.getAttributeNode(string2);
        if (attr2 == null) {
            throw new DOMException(8, new StringBuffer().append("No attribute named ").append(string2).toString());
        }
        return this.element.removeAttributeNode(attr2);
    }

    public Node removeNamedItemNS(String string2, String string3) throws DOMException {
        Attr attr2 = this.element.getAttributeNodeNS(string2, string3);
        if (attr2 != null) {
            attr2 = this.element.removeAttributeNode(attr2);
        }
        return attr2;
    }

    public Node setNamedItem(Node node) throws DOMException {
        if (node instanceof Attr) {
            return this.element.setAttributeNode((Attr)node);
        }
        throw new DOMException(9, new StringBuffer().append("Node is not an Attr: ").append((Object)node).toString());
    }

    public Node setNamedItemNS(Node node) throws DOMException {
        if (node instanceof Attr) {
            return this.element.setAttributeNodeNS((Attr)node);
        }
        throw new DOMException(9, new StringBuffer().append("Node is not an Attr: ").append((Object)node).toString());
    }
}

