/*
 * This class was automatically generated with 
 * <a href="http://www.castor.org">Castor 0.9.7</a>, using an XML
 * Schema.
 * $Id$
 */

package com.queplix.core.modules.eqlext.jxb.sr;

//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/

import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;

import java.util.ArrayList;

/**
 * Class SreqRecordType.
 *
 * @version $Revision$ $Date$
 */
public class SreqRecordType extends com.queplix.core.utils.jxb.JXBObject
        implements java.io.Serializable {

    //--------------------------/
    //- Class/Member Variables -/
    //--------------------------/

    /**
     * Field _todo
     */
    private com.queplix.core.modules.eqlext.jxb.sr.types.TodoSType _todo = com
            .queplix.core.modules.eqlext.jxb.sr.types.TodoSType.valueOf(
            "insert");

    /**
     * Field _sreqFieldList
     */
    private java.util.ArrayList _sreqFieldList;

    /**
     * Field _sreqDatasetList
     */
    private java.util.ArrayList _sreqDatasetList;

    //----------------/
    //- Constructors -/
    //----------------/

    public SreqRecordType() {
        super();
        setTodo(com.queplix.core.modules.eqlext.jxb.sr.types.TodoSType.valueOf(
                "insert"));
        _sreqFieldList = new ArrayList();
        _sreqDatasetList = new ArrayList();
    } //-- com.queplix.core.modules.eqlext.jxb.sr.SreqRecordType()

    //-----------/
    //- Methods -/
    //-----------/

    /**
     * Method addSreqDataset
     *
     * @param vSreqDataset
     */
    public void addSreqDataset(
            com.queplix.core.modules.eqlext.jxb.sr.SreqDataset vSreqDataset)
            throws java.lang.IndexOutOfBoundsException {
        _sreqDatasetList.add(vSreqDataset);
    } //-- void addSreqDataset(com.queplix.core.modules.eqlext.jxb.sr.SreqDataset) 

    /**
     * Method addSreqDataset
     *
     * @param index
     * @param vSreqDataset
     */
    public void addSreqDataset(int index,
                               com.queplix.core.modules.eqlext.jxb.sr.SreqDataset vSreqDataset)
            throws java.lang.IndexOutOfBoundsException {
        _sreqDatasetList.add(index, vSreqDataset);
    } //-- void addSreqDataset(int, com.queplix.core.modules.eqlext.jxb.sr.SreqDataset) 

    /**
     * Method addSreqField
     *
     * @param vSreqField
     */
    public void addSreqField(
            com.queplix.core.modules.eqlext.jxb.sr.SreqField vSreqField)
            throws java.lang.IndexOutOfBoundsException {
        _sreqFieldList.add(vSreqField);
    } //-- void addSreqField(com.queplix.core.modules.eqlext.jxb.sr.SreqField) 

    /**
     * Method addSreqField
     *
     * @param index
     * @param vSreqField
     */
    public void addSreqField(int index,
                             com.queplix.core.modules.eqlext.jxb.sr.SreqField vSreqField)
            throws java.lang.IndexOutOfBoundsException {
        _sreqFieldList.add(index, vSreqField);
    } //-- void addSreqField(int, com.queplix.core.modules.eqlext.jxb.sr.SreqField) 

    /**
     * Method clearSreqDataset
     */
    public void clearSreqDataset() {
        _sreqDatasetList.clear();
    } //-- void clearSreqDataset() 

    /**
     * Method clearSreqField
     */
    public void clearSreqField() {
        _sreqFieldList.clear();
    } //-- void clearSreqField() 

    /**
     * Method enumerateSreqDataset
     *
     * @return Enumeration
     */
    public java.util.Enumeration enumerateSreqDataset() {
        return new org.exolab.castor.util.IteratorEnumeration(
                _sreqDatasetList.iterator());
    } //-- java.util.Enumeration enumerateSreqDataset() 

    /**
     * Method enumerateSreqField
     *
     * @return Enumeration
     */
    public java.util.Enumeration enumerateSreqField() {
        return new org.exolab.castor.util.IteratorEnumeration(
                _sreqFieldList.iterator());
    } //-- java.util.Enumeration enumerateSreqField() 

    /**
     * Method getSreqDataset
     *
     * @param index
     * @return SreqDataset
     */
    public com.queplix.core.modules.eqlext.jxb.sr.SreqDataset getSreqDataset(
            int index)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _sreqDatasetList.size())) {
            throw new IndexOutOfBoundsException();
        }

        return (com.queplix.core.modules.eqlext.jxb.sr.SreqDataset) _sreqDatasetList
                .get(index);
    } //-- com.queplix.core.modules.eqlext.jxb.sr.SreqDataset getSreqDataset(int) 

    /**
     * Method getSreqDataset
     *
     * @return SreqDataset
     */
    public com.queplix.core.modules.eqlext.jxb.sr.SreqDataset[] getSreqDataset() {
        int size = _sreqDatasetList.size();
        com.queplix.core.modules.eqlext.jxb.sr.SreqDataset[] mArray
                = new com.queplix.core.modules.eqlext.jxb.sr.SreqDataset[size];
        for(int index = 0; index < size; index++) {
            mArray[index]
                    = (com.queplix.core.modules.eqlext.jxb.sr.SreqDataset) _sreqDatasetList
                    .get(index);
        }
        return mArray;
    } //-- com.queplix.core.modules.eqlext.jxb.sr.SreqDataset[] getSreqDataset() 

    /**
     * Method getSreqDatasetCount
     *
     * @return int
     */
    public int getSreqDatasetCount() {
        return _sreqDatasetList.size();
    } //-- int getSreqDatasetCount() 

    /**
     * Method getSreqField
     *
     * @param index
     * @return SreqField
     */
    public com.queplix.core.modules.eqlext.jxb.sr.SreqField getSreqField(
            int index)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _sreqFieldList.size())) {
            throw new IndexOutOfBoundsException();
        }

        return (com.queplix.core.modules.eqlext.jxb.sr.SreqField) _sreqFieldList
                .get(index);
    } //-- com.queplix.core.modules.eqlext.jxb.sr.SreqField getSreqField(int) 

    /**
     * Method getSreqField
     *
     * @return SreqField
     */
    public com.queplix.core.modules.eqlext.jxb.sr.SreqField[] getSreqField() {
        int size = _sreqFieldList.size();
        com.queplix.core.modules.eqlext.jxb.sr.SreqField[] mArray
                = new com.queplix.core.modules.eqlext.jxb.sr.SreqField[size];
        for(int index = 0; index < size; index++) {
            mArray[index]
                    = (com.queplix.core.modules.eqlext.jxb.sr.SreqField) _sreqFieldList
                    .get(index);
        }
        return mArray;
    } //-- com.queplix.core.modules.eqlext.jxb.sr.SreqField[] getSreqField() 

    /**
     * Method getSreqFieldCount
     *
     * @return int
     */
    public int getSreqFieldCount() {
        return _sreqFieldList.size();
    } //-- int getSreqFieldCount() 

    /**
     * Returns the value of field 'todo'.
     *
     * @return the value of field 'todo'.
     */
    public com.queplix.core.modules.eqlext.jxb.sr.types.TodoSType getTodo() {
        return this._todo;
    } //-- com.queplix.core.modules.eqlext.jxb.sr.types.TodoSType getTodo() 

    /**
     * Method isValid
     *
     * @return boolean
     */
    public boolean isValid() {
        try {
            validate();
        }
        catch (org.exolab.castor.xml.ValidationException vex) {
            return false;
        }
        return true;
    } //-- boolean isValid() 

    /**
     * Method marshal
     *
     * @param out
     */
    public void marshal(java.io.Writer out)
            throws org.exolab.castor.xml.MarshalException,
            org.exolab.castor.xml.ValidationException {

        Marshaller.marshal(this, out);
    } //-- void marshal(java.io.Writer) 

    /**
     * Method marshal
     *
     * @param handler
     */
    public void marshal(org.xml.sax.ContentHandler handler)
            throws java.io.IOException, org.exolab.castor.xml.MarshalException,
            org.exolab.castor.xml.ValidationException {

        Marshaller.marshal(this, handler);
    } //-- void marshal(org.xml.sax.ContentHandler) 

    /**
     * Method removeSreqDataset
     *
     * @param vSreqDataset
     * @return boolean
     */
    public boolean removeSreqDataset(
            com.queplix.core.modules.eqlext.jxb.sr.SreqDataset vSreqDataset) {
        boolean removed = _sreqDatasetList.remove(vSreqDataset);
        return removed;
    } //-- boolean removeSreqDataset(com.queplix.core.modules.eqlext.jxb.sr.SreqDataset) 

    /**
     * Method removeSreqField
     *
     * @param vSreqField
     * @return boolean
     */
    public boolean removeSreqField(
            com.queplix.core.modules.eqlext.jxb.sr.SreqField vSreqField) {
        boolean removed = _sreqFieldList.remove(vSreqField);
        return removed;
    } //-- boolean removeSreqField(com.queplix.core.modules.eqlext.jxb.sr.SreqField) 

    /**
     * Method setSreqDataset
     *
     * @param index
     * @param vSreqDataset
     */
    public void setSreqDataset(int index,
                               com.queplix.core.modules.eqlext.jxb.sr.SreqDataset vSreqDataset)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _sreqDatasetList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _sreqDatasetList.set(index, vSreqDataset);
    } //-- void setSreqDataset(int, com.queplix.core.modules.eqlext.jxb.sr.SreqDataset) 

    /**
     * Method setSreqDataset
     *
     * @param sreqDatasetArray
     */
    public void setSreqDataset(
            com.queplix.core.modules.eqlext.jxb.sr.SreqDataset[] sreqDatasetArray) {
        //-- copy array
        _sreqDatasetList.clear();
        for(int i = 0; i < sreqDatasetArray.length; i++) {
            _sreqDatasetList.add(sreqDatasetArray[i]);
        }
    } //-- void setSreqDataset(com.queplix.core.modules.eqlext.jxb.sr.SreqDataset) 

    /**
     * Method setSreqField
     *
     * @param index
     * @param vSreqField
     */
    public void setSreqField(int index,
                             com.queplix.core.modules.eqlext.jxb.sr.SreqField vSreqField)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _sreqFieldList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _sreqFieldList.set(index, vSreqField);
    } //-- void setSreqField(int, com.queplix.core.modules.eqlext.jxb.sr.SreqField) 

    /**
     * Method setSreqField
     *
     * @param sreqFieldArray
     */
    public void setSreqField(
            com.queplix.core.modules.eqlext.jxb.sr.SreqField[] sreqFieldArray) {
        //-- copy array
        _sreqFieldList.clear();
        for(int i = 0; i < sreqFieldArray.length; i++) {
            _sreqFieldList.add(sreqFieldArray[i]);
        }
    } //-- void setSreqField(com.queplix.core.modules.eqlext.jxb.sr.SreqField) 

    /**
     * Sets the value of field 'todo'.
     *
     * @param todo the value of field 'todo'.
     */
    public void setTodo(
            com.queplix.core.modules.eqlext.jxb.sr.types.TodoSType todo) {
        this._todo = todo;
    } //-- void setTodo(com.queplix.core.modules.eqlext.jxb.sr.types.TodoSType) 

    /**
     * Method unmarshal
     *
     * @param reader
     * @return Object
     */
    public static java.lang.Object unmarshal(java.io.Reader reader)
            throws org.exolab.castor.xml.MarshalException,
            org.exolab.castor.xml.ValidationException {
        return (com.queplix.core.modules.eqlext.jxb.sr.SreqRecordType) Unmarshaller
                .unmarshal(
                        com.queplix.core.modules.eqlext.jxb.sr.SreqRecordType.class,
                        reader);
    } //-- java.lang.Object unmarshal(java.io.Reader) 

    /**
     * Method validate
     */
    public void validate()
            throws org.exolab.castor.xml.ValidationException {
        org.exolab.castor.xml.Validator validator
                = new org.exolab.castor.xml.Validator();
        validator.validate(this);
    } //-- void validate() 

}
