/*
 * XML Type:  TimestampType
 * Namespace: http://schemas.xmlsoap.org/ws/2002/07/utility
 * Java type: org.xmlsoap.schemas.ws.x2002.x07.utility.TimestampType
 *
 * Automatically generated - do not modify.
 */
package org.xmlsoap.schemas.ws.x2002.x07.utility.impl;

/**
 * An XML TimestampType(@http://schemas.xmlsoap.org/ws/2002/07/utility).
 * <p/>
 * This is a complex type.
 */
public class TimestampTypeImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements org.xmlsoap.schemas.ws.x2002.x07.utility.TimestampType {

    public TimestampTypeImpl(org.apache.xmlbeans.SchemaType sType) {
        super(sType);
    }

    private static final javax.xml.namespace.QName CREATED$0 =
            new javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2002/07/utility", "Created");
    private static final javax.xml.namespace.QName EXPIRES$2 =
            new javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2002/07/utility", "Expires");
    private static final javax.xml.namespace.QName RECEIVED$4 =
            new javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2002/07/utility", "Received");
    private static final javax.xml.namespace.QName ID$6 =
            new javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2002/07/utility", "Id");


    /**
     * Gets the "Created" element
     */
    public org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime getCreated() {
        synchronized (monitor()) {
            check_orphaned();
            org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime target = null;
            target = (org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime) get_store().find_element_user(CREATED$0, 0);
            if (target == null) {
                return null;
            }
            return target;
        }
    }

    /**
     * True if has "Created" element
     */
    public boolean isSetCreated() {
        synchronized (monitor()) {
            check_orphaned();
            return get_store().count_elements(CREATED$0) != 0;
        }
    }

    /**
     * Sets the "Created" element
     */
    public void setCreated(org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime created) {
        synchronized (monitor()) {
            check_orphaned();
            org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime target = null;
            target = (org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime) get_store().find_element_user(CREATED$0, 0);
            if (target == null) {
                target = (org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime) get_store().add_element_user(CREATED$0);
            }
            target.set(created);
        }
    }

    /**
     * Appends and returns a new empty "Created" element
     */
    public org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime addNewCreated() {
        synchronized (monitor()) {
            check_orphaned();
            org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime target = null;
            target = (org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime) get_store().add_element_user(CREATED$0);
            return target;
        }
    }

    /**
     * Unsets the "Created" element
     */
    public void unsetCreated() {
        synchronized (monitor()) {
            check_orphaned();
            get_store().remove_element(CREATED$0, 0);
        }
    }

    /**
     * Gets the "Expires" element
     */
    public org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime getExpires() {
        synchronized (monitor()) {
            check_orphaned();
            org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime target = null;
            target = (org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime) get_store().find_element_user(EXPIRES$2, 0);
            if (target == null) {
                return null;
            }
            return target;
        }
    }

    /**
     * True if has "Expires" element
     */
    public boolean isSetExpires() {
        synchronized (monitor()) {
            check_orphaned();
            return get_store().count_elements(EXPIRES$2) != 0;
        }
    }

    /**
     * Sets the "Expires" element
     */
    public void setExpires(org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime expires) {
        synchronized (monitor()) {
            check_orphaned();
            org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime target = null;
            target = (org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime) get_store().find_element_user(EXPIRES$2, 0);
            if (target == null) {
                target = (org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime) get_store().add_element_user(EXPIRES$2);
            }
            target.set(expires);
        }
    }

    /**
     * Appends and returns a new empty "Expires" element
     */
    public org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime addNewExpires() {
        synchronized (monitor()) {
            check_orphaned();
            org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime target = null;
            target = (org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime) get_store().add_element_user(EXPIRES$2);
            return target;
        }
    }

    /**
     * Unsets the "Expires" element
     */
    public void unsetExpires() {
        synchronized (monitor()) {
            check_orphaned();
            get_store().remove_element(EXPIRES$2, 0);
        }
    }

    /**
     * Gets array of all "Received" elements
     */
    public org.xmlsoap.schemas.ws.x2002.x07.utility.ReceivedType[] getReceivedArray() {
        synchronized (monitor()) {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(RECEIVED$4, targetList);
            org.xmlsoap.schemas.ws.x2002.x07.utility.ReceivedType[] result = new org.xmlsoap.schemas.ws.x2002.x07.utility.ReceivedType[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }

    /**
     * Gets ith "Received" element
     */
    public org.xmlsoap.schemas.ws.x2002.x07.utility.ReceivedType getReceivedArray(int i) {
        synchronized (monitor()) {
            check_orphaned();
            org.xmlsoap.schemas.ws.x2002.x07.utility.ReceivedType target = null;
            target = (org.xmlsoap.schemas.ws.x2002.x07.utility.ReceivedType) get_store().find_element_user(RECEIVED$4, i);
            if (target == null) {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }

    /**
     * Returns number of "Received" element
     */
    public int sizeOfReceivedArray() {
        synchronized (monitor()) {
            check_orphaned();
            return get_store().count_elements(RECEIVED$4);
        }
    }

    /**
     * Sets array of all "Received" element
     */
    public void setReceivedArray(org.xmlsoap.schemas.ws.x2002.x07.utility.ReceivedType[] receivedArray) {
        synchronized (monitor()) {
            check_orphaned();
            arraySetterHelper(receivedArray, RECEIVED$4);
        }
    }

    /**
     * Sets ith "Received" element
     */
    public void setReceivedArray(int i, org.xmlsoap.schemas.ws.x2002.x07.utility.ReceivedType received) {
        synchronized (monitor()) {
            check_orphaned();
            org.xmlsoap.schemas.ws.x2002.x07.utility.ReceivedType target = null;
            target = (org.xmlsoap.schemas.ws.x2002.x07.utility.ReceivedType) get_store().find_element_user(RECEIVED$4, i);
            if (target == null) {
                throw new IndexOutOfBoundsException();
            }
            target.set(received);
        }
    }

    /**
     * Inserts and returns a new empty value (as xml) as the ith "Received" element
     */
    public org.xmlsoap.schemas.ws.x2002.x07.utility.ReceivedType insertNewReceived(int i) {
        synchronized (monitor()) {
            check_orphaned();
            org.xmlsoap.schemas.ws.x2002.x07.utility.ReceivedType target = null;
            target = (org.xmlsoap.schemas.ws.x2002.x07.utility.ReceivedType) get_store().insert_element_user(RECEIVED$4, i);
            return target;
        }
    }

    /**
     * Appends and returns a new empty value (as xml) as the last "Received" element
     */
    public org.xmlsoap.schemas.ws.x2002.x07.utility.ReceivedType addNewReceived() {
        synchronized (monitor()) {
            check_orphaned();
            org.xmlsoap.schemas.ws.x2002.x07.utility.ReceivedType target = null;
            target = (org.xmlsoap.schemas.ws.x2002.x07.utility.ReceivedType) get_store().add_element_user(RECEIVED$4);
            return target;
        }
    }

    /**
     * Removes the ith "Received" element
     */
    public void removeReceived(int i) {
        synchronized (monitor()) {
            check_orphaned();
            get_store().remove_element(RECEIVED$4, i);
        }
    }

    /**
     * Gets the "Id" attribute
     */
    public java.lang.String getId() {
        synchronized (monitor()) {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue) get_store().find_attribute_user(ID$6);
            if (target == null) {
                return null;
            }
            return target.getStringValue();
        }
    }

    /**
     * Gets (as xml) the "Id" attribute
     */
    public org.apache.xmlbeans.XmlID xgetId() {
        synchronized (monitor()) {
            check_orphaned();
            org.apache.xmlbeans.XmlID target = null;
            target = (org.apache.xmlbeans.XmlID) get_store().find_attribute_user(ID$6);
            return target;
        }
    }

    /**
     * True if has "Id" attribute
     */
    public boolean isSetId() {
        synchronized (monitor()) {
            check_orphaned();
            return get_store().find_attribute_user(ID$6) != null;
        }
    }

    /**
     * Sets the "Id" attribute
     */
    public void setId(java.lang.String id) {
        synchronized (monitor()) {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue) get_store().find_attribute_user(ID$6);
            if (target == null) {
                target = (org.apache.xmlbeans.SimpleValue) get_store().add_attribute_user(ID$6);
            }
            target.setStringValue(id);
        }
    }

    /**
     * Sets (as xml) the "Id" attribute
     */
    public void xsetId(org.apache.xmlbeans.XmlID id) {
        synchronized (monitor()) {
            check_orphaned();
            org.apache.xmlbeans.XmlID target = null;
            target = (org.apache.xmlbeans.XmlID) get_store().find_attribute_user(ID$6);
            if (target == null) {
                target = (org.apache.xmlbeans.XmlID) get_store().add_attribute_user(ID$6);
            }
            target.set(id);
        }
    }

    /**
     * Unsets the "Id" attribute
     */
    public void unsetId() {
        synchronized (monitor()) {
            check_orphaned();
            get_store().remove_attribute(ID$6);
        }
    }
}
