/*
 * XML Type:  descriptionType
 * Namespace: http://xmlbeans.apache.org/samples/cursor/mixedcontent
 * Java type: org.apache.xmlbeans.samples.cursor.mixedcontent.DescriptionType
 *
 * Automatically generated - do not modify.
 */
package org.apache.xmlbeans.samples.cursor.mixedcontent.impl;
/**
 * An XML descriptionType(@http://xmlbeans.apache.org/samples/cursor/mixedcontent).
 *
 * This is a complex type.
 */
public class DescriptionTypeImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements org.apache.xmlbeans.samples.cursor.mixedcontent.DescriptionType
{
    private static final long serialVersionUID = 1L;
    
    public DescriptionTypeImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName LINK$0 = 
        new javax.xml.namespace.QName("http://xmlbeans.apache.org/samples/cursor/mixedcontent", "link");
    
    
    /**
     * Gets array of all "link" elements
     */
    public org.apache.xmlbeans.samples.cursor.mixedcontent.LinkType[] getLinkArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(LINK$0, targetList);
            org.apache.xmlbeans.samples.cursor.mixedcontent.LinkType[] result = new org.apache.xmlbeans.samples.cursor.mixedcontent.LinkType[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }
    
    /**
     * Gets ith "link" element
     */
    public org.apache.xmlbeans.samples.cursor.mixedcontent.LinkType getLinkArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.samples.cursor.mixedcontent.LinkType target = null;
            target = (org.apache.xmlbeans.samples.cursor.mixedcontent.LinkType)get_store().find_element_user(LINK$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }
    
    /**
     * Returns number of "link" element
     */
    public int sizeOfLinkArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(LINK$0);
        }
    }
    
    /**
     * Sets array of all "link" element  WARNING: This method is not atomicaly synchronized.
     */
    public void setLinkArray(org.apache.xmlbeans.samples.cursor.mixedcontent.LinkType[] linkArray)
    {
        check_orphaned();
        arraySetterHelper(linkArray, LINK$0);
    }
    
    /**
     * Sets ith "link" element
     */
    public void setLinkArray(int i, org.apache.xmlbeans.samples.cursor.mixedcontent.LinkType link)
    {
        generatedSetterHelperImpl(link, LINK$0, i, org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_ARRAYITEM);
    }
    
    /**
     * Inserts and returns a new empty value (as xml) as the ith "link" element
     */
    public org.apache.xmlbeans.samples.cursor.mixedcontent.LinkType insertNewLink(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.samples.cursor.mixedcontent.LinkType target = null;
            target = (org.apache.xmlbeans.samples.cursor.mixedcontent.LinkType)get_store().insert_element_user(LINK$0, i);
            return target;
        }
    }
    
    /**
     * Appends and returns a new empty value (as xml) as the last "link" element
     */
    public org.apache.xmlbeans.samples.cursor.mixedcontent.LinkType addNewLink()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.samples.cursor.mixedcontent.LinkType target = null;
            target = (org.apache.xmlbeans.samples.cursor.mixedcontent.LinkType)get_store().add_element_user(LINK$0);
            return target;
        }
    }
    
    /**
     * Removes the ith "link" element
     */
    public void removeLink(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(LINK$0, i);
        }
    }
}
