/*
 * Decompiled with CFR 0_110.
 * 
 * Could not load the following classes:
 *  java.io.IOException
 *  java.io.ObjectInputStream
 *  java.io.ObjectOutputStream
 *  java.io.Serializable
 *  java.lang.Class
 *  java.lang.ClassNotFoundException
 *  java.lang.Exception
 *  java.lang.NoClassDefFoundError
 *  java.lang.Object
 *  java.lang.String
 *  java.lang.StringBuffer
 *  java.lang.System
 */
package org.dom4j;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import org.dom4j.DocumentFactory;
import org.dom4j.Namespace;
import org.dom4j.tree.QNameCache;
import org.dom4j.util.SingletonStrategy;

public class QName
implements Serializable {
    static Class class$org$dom4j$tree$QNameCache;
    private static SingletonStrategy singleton;
    private DocumentFactory documentFactory;
    private int hashCode;
    private String name;
    private transient Namespace namespace;
    private String qualifiedName;

    /*
     * 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.QName.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 = QName.singleton = (SingletonStrategy)class_.newInstance();
            if (class$org$dom4j$tree$QNameCache == null) {
                class$org$dom4j$tree$QNameCache = class_4 = QName.class$("org.dom4j.tree.QNameCache");
            } else {
                class_4 = class$org$dom4j$tree$QNameCache;
            }
            singletonStrategy.setSingletonClassName(class_4.getName());
            return;
        }
        catch (Exception var3_7) {
            return;
        }
    }

    public QName(String string2) {
        super(string2, Namespace.NO_NAMESPACE);
    }

    public QName(String string2, Namespace namespace) {
        if (string2 == null) {
            string2 = "";
        }
        this.name = string2;
        if (namespace == null) {
            namespace = Namespace.NO_NAMESPACE;
        }
        this.namespace = namespace;
    }

    public QName(String string2, Namespace namespace, String string3) {
        if (string2 == null) {
            string2 = "";
        }
        this.name = string2;
        this.qualifiedName = string3;
        if (namespace == null) {
            namespace = Namespace.NO_NAMESPACE;
        }
        this.namespace = namespace;
    }

    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 QName get(String string2) {
        return QName.getCache().get(string2);
    }

    public static QName get(String string2, String string3) {
        if (string3 == null) {
            return QName.getCache().get(string2);
        }
        return QName.getCache().get(string2, string3);
    }

    public static QName get(String string2, String string3, String string4) {
        if ((string3 == null || string3.length() == 0) && string4 == null) {
            return QName.get(string2);
        }
        if (string3 == null || string3.length() == 0) {
            return QName.getCache().get(string2, Namespace.get(string4));
        }
        if (string4 == null) {
            return QName.get(string2);
        }
        return QName.getCache().get(string2, Namespace.get(string3, string4));
    }

    public static QName get(String string2, Namespace namespace) {
        return QName.getCache().get(string2, namespace);
    }

    public static QName get(String string2, Namespace namespace, String string3) {
        return QName.getCache().get(string2, namespace, string3);
    }

    private static QNameCache getCache() {
        return (QNameCache)singleton.instance();
    }

    private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
        String string2 = (String)objectInputStream.readObject();
        String string3 = (String)objectInputStream.readObject();
        objectInputStream.defaultReadObject();
        this.namespace = Namespace.get(string2, string3);
    }

    private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
        objectOutputStream.writeObject((Object)this.namespace.getPrefix());
        objectOutputStream.writeObject((Object)this.namespace.getURI());
        objectOutputStream.defaultWriteObject();
    }

    /*
     * Enabled aggressive block sorting
     * Lifted jumps to return sites
     */
    public boolean equals(Object object) {
        if (this == object) {
            return true;
        }
        if (!(object instanceof QName)) return false;
        QName qName = (QName)object;
        if (this.hashCode() != qName.hashCode()) return false;
        if (!this.getName().equals((Object)qName.getName())) return false;
        if (this.getNamespaceURI().equals((Object)qName.getNamespaceURI())) return true;
        return false;
    }

    public DocumentFactory getDocumentFactory() {
        return this.documentFactory;
    }

    public String getName() {
        return this.name;
    }

    public Namespace getNamespace() {
        return this.namespace;
    }

    public String getNamespacePrefix() {
        if (this.namespace == null) {
            return "";
        }
        return this.namespace.getPrefix();
    }

    public String getNamespaceURI() {
        if (this.namespace == null) {
            return "";
        }
        return this.namespace.getURI();
    }

    /*
     * Enabled aggressive block sorting
     */
    public String getQualifiedName() {
        if (this.qualifiedName != null) return this.qualifiedName;
        String string2 = this.getNamespacePrefix();
        if (string2 != null && string2.length() > 0) {
            this.qualifiedName = new StringBuffer().append(string2).append(":").append(this.name).toString();
            return this.qualifiedName;
        }
        this.qualifiedName = this.name;
        return this.qualifiedName;
    }

    public int hashCode() {
        if (this.hashCode == 0) {
            this.hashCode = this.getName().hashCode() ^ this.getNamespaceURI().hashCode();
            if (this.hashCode == 0) {
                this.hashCode = 47806;
            }
        }
        return this.hashCode;
    }

    public void setDocumentFactory(DocumentFactory documentFactory) {
        this.documentFactory = documentFactory;
    }

    public String toString() {
        return new StringBuffer().append(super.toString()).append(" [name: ").append(this.getName()).append(" namespace: \"").append((Object)this.getNamespace()).append("\"]").toString();
    }
}

