/*
 * An XML document type.
 * Localname: statement
 * Namespace: http://statement
 * Java type: statement.StatementDocument
 *
 * Automatically generated - do not modify.
 */
package statement.impl;
/**
 * A document containing one statement(@http://statement) element.
 *
 * This is a complex type.
 */
public class StatementDocumentImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements statement.StatementDocument
{
    private static final long serialVersionUID = 1L;
    
    public StatementDocumentImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName STATEMENT$0 = 
        new javax.xml.namespace.QName("http://statement", "statement");
    
    
    /**
     * Gets the "statement" element
     */
    public statement.StatementDocument.Statement getStatement()
    {
        synchronized (monitor())
        {
            check_orphaned();
            statement.StatementDocument.Statement target = null;
            target = (statement.StatementDocument.Statement)get_store().find_element_user(STATEMENT$0, 0);
            if (target == null)
            {
                return null;
            }
            return target;
        }
    }
    
    /**
     * Sets the "statement" element
     */
    public void setStatement(statement.StatementDocument.Statement statement)
    {
        generatedSetterHelperImpl(statement, STATEMENT$0, 0, org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_SINGLETON);
    }
    
    /**
     * Appends and returns a new empty "statement" element
     */
    public statement.StatementDocument.Statement addNewStatement()
    {
        synchronized (monitor())
        {
            check_orphaned();
            statement.StatementDocument.Statement target = null;
            target = (statement.StatementDocument.Statement)get_store().add_element_user(STATEMENT$0);
            return target;
        }
    }
    /**
     * An XML statement(@http://statement).
     *
     * This is a complex type.
     */
    public static class StatementImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements statement.StatementDocument.Statement
    {
        private static final long serialVersionUID = 1L;
        
        public StatementImpl(org.apache.xmlbeans.SchemaType sType)
        {
            super(sType);
        }
        
        private static final javax.xml.namespace.QName DEPOSIT$0 = 
            new javax.xml.namespace.QName("http://statement", "deposit");
        private static final javax.xml.namespace.QName WITHDRAWAL$2 = 
            new javax.xml.namespace.QName("http://statement", "withdrawal");
        
        
        /**
         * Gets array of all "deposit" elements
         */
        public statement.Transaction[] getDepositArray()
        {
            synchronized (monitor())
            {
                check_orphaned();
                java.util.List targetList = new java.util.ArrayList();
                get_store().find_all_element_users(DEPOSIT$0, targetList);
                statement.Transaction[] result = new statement.Transaction[targetList.size()];
                targetList.toArray(result);
                return result;
            }
        }
        
        /**
         * Gets ith "deposit" element
         */
        public statement.Transaction getDepositArray(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                statement.Transaction target = null;
                target = (statement.Transaction)get_store().find_element_user(DEPOSIT$0, i);
                if (target == null)
                {
                    throw new IndexOutOfBoundsException();
                }
                return target;
            }
        }
        
        /**
         * Returns number of "deposit" element
         */
        public int sizeOfDepositArray()
        {
            synchronized (monitor())
            {
                check_orphaned();
                return get_store().count_elements(DEPOSIT$0);
            }
        }
        
        /**
         * Sets array of all "deposit" element  WARNING: This method is not atomicaly synchronized.
         */
        public void setDepositArray(statement.Transaction[] depositArray)
        {
            check_orphaned();
            arraySetterHelper(depositArray, DEPOSIT$0);
        }
        
        /**
         * Sets ith "deposit" element
         */
        public void setDepositArray(int i, statement.Transaction deposit)
        {
            generatedSetterHelperImpl(deposit, DEPOSIT$0, i, org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_ARRAYITEM);
        }
        
        /**
         * Inserts and returns a new empty value (as xml) as the ith "deposit" element
         */
        public statement.Transaction insertNewDeposit(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                statement.Transaction target = null;
                target = (statement.Transaction)get_store().insert_element_user(DEPOSIT$0, i);
                return target;
            }
        }
        
        /**
         * Appends and returns a new empty value (as xml) as the last "deposit" element
         */
        public statement.Transaction addNewDeposit()
        {
            synchronized (monitor())
            {
                check_orphaned();
                statement.Transaction target = null;
                target = (statement.Transaction)get_store().add_element_user(DEPOSIT$0);
                return target;
            }
        }
        
        /**
         * Removes the ith "deposit" element
         */
        public void removeDeposit(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                get_store().remove_element(DEPOSIT$0, i);
            }
        }
        
        /**
         * Gets array of all "withdrawal" elements
         */
        public statement.Transaction[] getWithdrawalArray()
        {
            synchronized (monitor())
            {
                check_orphaned();
                java.util.List targetList = new java.util.ArrayList();
                get_store().find_all_element_users(WITHDRAWAL$2, targetList);
                statement.Transaction[] result = new statement.Transaction[targetList.size()];
                targetList.toArray(result);
                return result;
            }
        }
        
        /**
         * Gets ith "withdrawal" element
         */
        public statement.Transaction getWithdrawalArray(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                statement.Transaction target = null;
                target = (statement.Transaction)get_store().find_element_user(WITHDRAWAL$2, i);
                if (target == null)
                {
                    throw new IndexOutOfBoundsException();
                }
                return target;
            }
        }
        
        /**
         * Returns number of "withdrawal" element
         */
        public int sizeOfWithdrawalArray()
        {
            synchronized (monitor())
            {
                check_orphaned();
                return get_store().count_elements(WITHDRAWAL$2);
            }
        }
        
        /**
         * Sets array of all "withdrawal" element  WARNING: This method is not atomicaly synchronized.
         */
        public void setWithdrawalArray(statement.Transaction[] withdrawalArray)
        {
            check_orphaned();
            arraySetterHelper(withdrawalArray, WITHDRAWAL$2);
        }
        
        /**
         * Sets ith "withdrawal" element
         */
        public void setWithdrawalArray(int i, statement.Transaction withdrawal)
        {
            generatedSetterHelperImpl(withdrawal, WITHDRAWAL$2, i, org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_ARRAYITEM);
        }
        
        /**
         * Inserts and returns a new empty value (as xml) as the ith "withdrawal" element
         */
        public statement.Transaction insertNewWithdrawal(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                statement.Transaction target = null;
                target = (statement.Transaction)get_store().insert_element_user(WITHDRAWAL$2, i);
                return target;
            }
        }
        
        /**
         * Appends and returns a new empty value (as xml) as the last "withdrawal" element
         */
        public statement.Transaction addNewWithdrawal()
        {
            synchronized (monitor())
            {
                check_orphaned();
                statement.Transaction target = null;
                target = (statement.Transaction)get_store().add_element_user(WITHDRAWAL$2);
                return target;
            }
        }
        
        /**
         * Removes the ith "withdrawal" element
         */
        public void removeWithdrawal(int i)
        {
            synchronized (monitor())
            {
                check_orphaned();
                get_store().remove_element(WITHDRAWAL$2, i);
            }
        }
    }
}
