/*
 * XML Type:  TopicSpaceType
 * Namespace: http://docs.oasis-open.org/wsn/2004/06/wsn-WS-Topics-1.2-draft-01.xsd
 * Java type: org.activemq.ws.xmlbeans.notification.topics.TopicSpaceType
 *
 * Automatically generated - do not modify.
 */
package org.activemq.ws.xmlbeans.notification.topics.impl;
/**
 * An XML TopicSpaceType(@http://docs.oasis-open.org/wsn/2004/06/wsn-WS-Topics-1.2-draft-01.xsd).
 *
 * This is a complex type.
 */
public class TopicSpaceTypeImpl extends org.activemq.ws.xmlbeans.notification.topics.impl.ExtensibleDocumentedImpl implements org.activemq.ws.xmlbeans.notification.topics.TopicSpaceType
{
    
    public TopicSpaceTypeImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName TOPIC$0 = 
        new javax.xml.namespace.QName("http://docs.oasis-open.org/wsn/2004/06/wsn-WS-Topics-1.2-draft-01.xsd", "Topic");
    private static final javax.xml.namespace.QName NAME$2 = 
        new javax.xml.namespace.QName("", "name");
    private static final javax.xml.namespace.QName TARGETNAMESPACE$4 = 
        new javax.xml.namespace.QName("", "targetNamespace");
    
    
    /**
     * Gets array of all "Topic" elements
     */
    public org.activemq.ws.xmlbeans.notification.topics.TopicType[] getTopicArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(TOPIC$0, targetList);
            org.activemq.ws.xmlbeans.notification.topics.TopicType[] result = new org.activemq.ws.xmlbeans.notification.topics.TopicType[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }
    
    /**
     * Gets ith "Topic" element
     */
    public org.activemq.ws.xmlbeans.notification.topics.TopicType getTopicArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.activemq.ws.xmlbeans.notification.topics.TopicType target = null;
            target = (org.activemq.ws.xmlbeans.notification.topics.TopicType)get_store().find_element_user(TOPIC$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }
    
    /**
     * Returns number of "Topic" element
     */
    public int sizeOfTopicArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(TOPIC$0);
        }
    }
    
    /**
     * Sets array of all "Topic" element
     */
    public void setTopicArray(org.activemq.ws.xmlbeans.notification.topics.TopicType[] topicArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(topicArray, TOPIC$0);
        }
    }
    
    /**
     * Sets ith "Topic" element
     */
    public void setTopicArray(int i, org.activemq.ws.xmlbeans.notification.topics.TopicType topic)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.activemq.ws.xmlbeans.notification.topics.TopicType target = null;
            target = (org.activemq.ws.xmlbeans.notification.topics.TopicType)get_store().find_element_user(TOPIC$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(topic);
        }
    }
    
    /**
     * Inserts and returns a new empty value (as xml) as the ith "Topic" element
     */
    public org.activemq.ws.xmlbeans.notification.topics.TopicType insertNewTopic(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.activemq.ws.xmlbeans.notification.topics.TopicType target = null;
            target = (org.activemq.ws.xmlbeans.notification.topics.TopicType)get_store().insert_element_user(TOPIC$0, i);
            return target;
        }
    }
    
    /**
     * Appends and returns a new empty value (as xml) as the last "Topic" element
     */
    public org.activemq.ws.xmlbeans.notification.topics.TopicType addNewTopic()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.activemq.ws.xmlbeans.notification.topics.TopicType target = null;
            target = (org.activemq.ws.xmlbeans.notification.topics.TopicType)get_store().add_element_user(TOPIC$0);
            return target;
        }
    }
    
    /**
     * Removes the ith "Topic" element
     */
    public void removeTopic(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(TOPIC$0, i);
        }
    }
    
    /**
     * Gets the "name" attribute
     */
    public java.lang.String getName()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(NAME$2);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }
    
    /**
     * Gets (as xml) the "name" attribute
     */
    public org.apache.xmlbeans.XmlNCName xgetName()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlNCName target = null;
            target = (org.apache.xmlbeans.XmlNCName)get_store().find_attribute_user(NAME$2);
            return target;
        }
    }
    
    /**
     * True if has "name" attribute
     */
    public boolean isSetName()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(NAME$2) != null;
        }
    }
    
    /**
     * Sets the "name" attribute
     */
    public void setName(java.lang.String name)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(NAME$2);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(NAME$2);
            }
            target.setStringValue(name);
        }
    }
    
    /**
     * Sets (as xml) the "name" attribute
     */
    public void xsetName(org.apache.xmlbeans.XmlNCName name)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlNCName target = null;
            target = (org.apache.xmlbeans.XmlNCName)get_store().find_attribute_user(NAME$2);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlNCName)get_store().add_attribute_user(NAME$2);
            }
            target.set(name);
        }
    }
    
    /**
     * Unsets the "name" attribute
     */
    public void unsetName()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(NAME$2);
        }
    }
    
    /**
     * Gets the "targetNamespace" attribute
     */
    public java.lang.String getTargetNamespace()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(TARGETNAMESPACE$4);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }
    
    /**
     * Gets (as xml) the "targetNamespace" attribute
     */
    public org.apache.xmlbeans.XmlAnyURI xgetTargetNamespace()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlAnyURI target = null;
            target = (org.apache.xmlbeans.XmlAnyURI)get_store().find_attribute_user(TARGETNAMESPACE$4);
            return target;
        }
    }
    
    /**
     * Sets the "targetNamespace" attribute
     */
    public void setTargetNamespace(java.lang.String targetNamespace)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(TARGETNAMESPACE$4);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(TARGETNAMESPACE$4);
            }
            target.setStringValue(targetNamespace);
        }
    }
    
    /**
     * Sets (as xml) the "targetNamespace" attribute
     */
    public void xsetTargetNamespace(org.apache.xmlbeans.XmlAnyURI targetNamespace)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlAnyURI target = null;
            target = (org.apache.xmlbeans.XmlAnyURI)get_store().find_attribute_user(TARGETNAMESPACE$4);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlAnyURI)get_store().add_attribute_user(TARGETNAMESPACE$4);
            }
            target.set(targetNamespace);
        }
    }
}
