/*
 * 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.lang.UnsupportedOperationException
 */
package org.dom4j.tree;

import java.io.IOException;
import java.io.Writer;
import org.dom4j.Attribute;
import org.dom4j.Element;
import org.dom4j.Namespace;
import org.dom4j.Node;
import org.dom4j.QName;
import org.dom4j.Visitor;
import org.dom4j.tree.AbstractNode;
import org.dom4j.tree.DefaultAttribute;

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

    @Override
    public String asXML() {
        return new StringBuffer().append(this.getQualifiedName()).append("=\"").append(this.getValue()).append("\"").toString();
    }

    @Override
    protected Node createXPathResult(Element element) {
        return new DefaultAttribute(element, this.getQName(), this.getValue());
    }

    @Override
    public Object getData() {
        return this.getValue();
    }

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

    @Override
    public Namespace getNamespace() {
        return this.getQName().getNamespace();
    }

    @Override
    public String getNamespacePrefix() {
        return this.getQName().getNamespacePrefix();
    }

    @Override
    public String getNamespaceURI() {
        return this.getQName().getNamespaceURI();
    }

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

    /*
     * Enabled force condition propagation
     * Lifted jumps to return sites
     */
    @Override
    public String getPath(Element element) {
        StringBuffer stringBuffer = new StringBuffer();
        Element element2 = this.getParent();
        if (element2 != null && element2 != element) {
            stringBuffer.append(element2.getPath(element));
            stringBuffer.append("/");
        }
        stringBuffer.append("@");
        String string2 = this.getNamespaceURI();
        String string3 = this.getNamespacePrefix();
        if (string2 == null || string2.length() == 0 || string3 == null || string3.length() == 0) {
            stringBuffer.append(this.getName());
            do {
                return stringBuffer.toString();
                break;
            } while (true);
        }
        stringBuffer.append(this.getQualifiedName());
        return stringBuffer.toString();
    }

    @Override
    public String getQualifiedName() {
        return this.getQName().getQualifiedName();
    }

    @Override
    public String getText() {
        return this.getValue();
    }

    /*
     * Enabled force condition propagation
     * Lifted jumps to return sites
     */
    @Override
    public String getUniquePath(Element element) {
        StringBuffer stringBuffer = new StringBuffer();
        Element element2 = this.getParent();
        if (element2 != null && element2 != element) {
            stringBuffer.append(element2.getUniquePath(element));
            stringBuffer.append("/");
        }
        stringBuffer.append("@");
        String string2 = this.getNamespaceURI();
        String string3 = this.getNamespacePrefix();
        if (string2 == null || string2.length() == 0 || string3 == null || string3.length() == 0) {
            stringBuffer.append(this.getName());
            do {
                return stringBuffer.toString();
                break;
            } while (true);
        }
        stringBuffer.append(this.getQualifiedName());
        return stringBuffer.toString();
    }

    /*
     * Enabled aggressive block sorting
     */
    @Override
    public void setData(Object object) {
        String string2 = object == null ? null : object.toString();
        this.setValue(string2);
    }

    @Override
    public void setNamespace(Namespace namespace) {
        throw new UnsupportedOperationException("This Attribute is read only and cannot be changed");
    }

    @Override
    public void setText(String string2) {
        this.setValue(string2);
    }

    @Override
    public void setValue(String string2) {
        throw new UnsupportedOperationException("This Attribute is read only and cannot be changed");
    }

    public String toString() {
        return new StringBuffer().append(super.toString()).append(" [Attribute: name ").append(this.getQualifiedName()).append(" value \"").append(this.getValue()).append("\"]").toString();
    }

    @Override
    public void write(Writer writer) throws IOException {
        writer.write(this.getQualifiedName());
        writer.write("=\"");
        writer.write(this.getValue());
        writer.write("\"");
    }
}

