/*
 * 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.gr;

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

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

import java.util.ArrayList;

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

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

    /**
     * Field _listfield
     */
    private java.lang.String _listfield;

    /**
     * Field _hasExternalSets
     */
    private java.lang.Boolean _hasExternalSets = new java.lang.Boolean("false");

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

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

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

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

    public ResHeaderType() {
        super();
        _resHeaderDatasetList = new ArrayList();
        _resHeaderFieldList = new ArrayList();
        _resLinkedDatasetList = new ArrayList();
    } //-- com.queplix.core.modules.eqlext.jxb.gr.ResHeaderType()

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

    /**
     * Method addResHeaderDataset
     *
     * @param vResHeaderDataset
     */
    public void addResHeaderDataset(
            com.queplix.core.modules.eqlext.jxb.gr.ResHeaderDataset vResHeaderDataset)
            throws java.lang.IndexOutOfBoundsException {
        _resHeaderDatasetList.add(vResHeaderDataset);
    } //-- void addResHeaderDataset(com.queplix.core.modules.eqlext.jxb.gr.ResHeaderDataset) 

    /**
     * Method addResHeaderDataset
     *
     * @param index
     * @param vResHeaderDataset
     */
    public void addResHeaderDataset(int index,
                                    com.queplix.core.modules.eqlext.jxb.gr.ResHeaderDataset vResHeaderDataset)
            throws java.lang.IndexOutOfBoundsException {
        _resHeaderDatasetList.add(index, vResHeaderDataset);
    } //-- void addResHeaderDataset(int, com.queplix.core.modules.eqlext.jxb.gr.ResHeaderDataset) 

    /**
     * Method addResHeaderField
     *
     * @param vResHeaderField
     */
    public void addResHeaderField(
            com.queplix.core.modules.eqlext.jxb.gr.ResHeaderField vResHeaderField)
            throws java.lang.IndexOutOfBoundsException {
        _resHeaderFieldList.add(vResHeaderField);
    } //-- void addResHeaderField(com.queplix.core.modules.eqlext.jxb.gr.ResHeaderField) 

    /**
     * Method addResHeaderField
     *
     * @param index
     * @param vResHeaderField
     */
    public void addResHeaderField(int index,
                                  com.queplix.core.modules.eqlext.jxb.gr.ResHeaderField vResHeaderField)
            throws java.lang.IndexOutOfBoundsException {
        _resHeaderFieldList.add(index, vResHeaderField);
    } //-- void addResHeaderField(int, com.queplix.core.modules.eqlext.jxb.gr.ResHeaderField) 

    /**
     * Method addResLinkedDataset
     *
     * @param vResLinkedDataset
     */
    public void addResLinkedDataset(
            com.queplix.core.modules.eqlext.jxb.gr.ResLinkedDataset vResLinkedDataset)
            throws java.lang.IndexOutOfBoundsException {
        _resLinkedDatasetList.add(vResLinkedDataset);
    } //-- void addResLinkedDataset(com.queplix.core.modules.eqlext.jxb.gr.ResLinkedDataset) 

    /**
     * Method addResLinkedDataset
     *
     * @param index
     * @param vResLinkedDataset
     */
    public void addResLinkedDataset(int index,
                                    com.queplix.core.modules.eqlext.jxb.gr.ResLinkedDataset vResLinkedDataset)
            throws java.lang.IndexOutOfBoundsException {
        _resLinkedDatasetList.add(index, vResLinkedDataset);
    } //-- void addResLinkedDataset(int, com.queplix.core.modules.eqlext.jxb.gr.ResLinkedDataset) 

    /**
     * Method clearResHeaderDataset
     */
    public void clearResHeaderDataset() {
        _resHeaderDatasetList.clear();
    } //-- void clearResHeaderDataset() 

    /**
     * Method clearResHeaderField
     */
    public void clearResHeaderField() {
        _resHeaderFieldList.clear();
    } //-- void clearResHeaderField() 

    /**
     * Method clearResLinkedDataset
     */
    public void clearResLinkedDataset() {
        _resLinkedDatasetList.clear();
    } //-- void clearResLinkedDataset() 

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

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

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

    /**
     * Returns the value of field 'hasExternalSets'.
     *
     * @return the value of field 'hasExternalSets'.
     */
    public java.lang.Boolean getHasExternalSets() {
        return this._hasExternalSets;
    } //-- java.lang.Boolean getHasExternalSets() 

    /**
     * Returns the value of field 'listfield'.
     *
     * @return the value of field 'listfield'.
     */
    public java.lang.String getListfield() {
        return this._listfield;
    } //-- java.lang.String getListfield() 

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

        return (com.queplix.core.modules.eqlext.jxb.gr.ResHeaderDataset) _resHeaderDatasetList
                .get(index);
    } //-- com.queplix.core.modules.eqlext.jxb.gr.ResHeaderDataset getResHeaderDataset(int) 

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

    /**
     * Method getResHeaderDatasetCount
     *
     * @return int
     */
    public int getResHeaderDatasetCount() {
        return _resHeaderDatasetList.size();
    } //-- int getResHeaderDatasetCount() 

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

        return (com.queplix.core.modules.eqlext.jxb.gr.ResHeaderField) _resHeaderFieldList
                .get(index);
    } //-- com.queplix.core.modules.eqlext.jxb.gr.ResHeaderField getResHeaderField(int) 

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

    /**
     * Method getResHeaderFieldCount
     *
     * @return int
     */
    public int getResHeaderFieldCount() {
        return _resHeaderFieldList.size();
    } //-- int getResHeaderFieldCount() 

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

        return (com.queplix.core.modules.eqlext.jxb.gr.ResLinkedDataset) _resLinkedDatasetList
                .get(index);
    } //-- com.queplix.core.modules.eqlext.jxb.gr.ResLinkedDataset getResLinkedDataset(int) 

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

    /**
     * Method getResLinkedDatasetCount
     *
     * @return int
     */
    public int getResLinkedDatasetCount() {
        return _resLinkedDatasetList.size();
    } //-- int getResLinkedDatasetCount() 

    /**
     * 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 removeResHeaderDataset
     *
     * @param vResHeaderDataset
     * @return boolean
     */
    public boolean removeResHeaderDataset(
            com.queplix.core.modules.eqlext.jxb.gr.ResHeaderDataset vResHeaderDataset) {
        boolean removed = _resHeaderDatasetList.remove(vResHeaderDataset);
        return removed;
    } //-- boolean removeResHeaderDataset(com.queplix.core.modules.eqlext.jxb.gr.ResHeaderDataset) 

    /**
     * Method removeResHeaderField
     *
     * @param vResHeaderField
     * @return boolean
     */
    public boolean removeResHeaderField(
            com.queplix.core.modules.eqlext.jxb.gr.ResHeaderField vResHeaderField) {
        boolean removed = _resHeaderFieldList.remove(vResHeaderField);
        return removed;
    } //-- boolean removeResHeaderField(com.queplix.core.modules.eqlext.jxb.gr.ResHeaderField) 

    /**
     * Method removeResLinkedDataset
     *
     * @param vResLinkedDataset
     * @return boolean
     */
    public boolean removeResLinkedDataset(
            com.queplix.core.modules.eqlext.jxb.gr.ResLinkedDataset vResLinkedDataset) {
        boolean removed = _resLinkedDatasetList.remove(vResLinkedDataset);
        return removed;
    } //-- boolean removeResLinkedDataset(com.queplix.core.modules.eqlext.jxb.gr.ResLinkedDataset) 

    /**
     * Sets the value of field 'hasExternalSets'.
     *
     * @param hasExternalSets the value of field 'hasExternalSets'.
     */
    public void setHasExternalSets(java.lang.Boolean hasExternalSets) {
        this._hasExternalSets = hasExternalSets;
    } //-- void setHasExternalSets(java.lang.Boolean) 

    /**
     * Sets the value of field 'listfield'.
     *
     * @param listfield the value of field 'listfield'.
     */
    public void setListfield(java.lang.String listfield) {
        this._listfield = listfield;
    } //-- void setListfield(java.lang.String) 

    /**
     * Method setResHeaderDataset
     *
     * @param index
     * @param vResHeaderDataset
     */
    public void setResHeaderDataset(int index,
                                    com.queplix.core.modules.eqlext.jxb.gr.ResHeaderDataset vResHeaderDataset)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _resHeaderDatasetList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _resHeaderDatasetList.set(index, vResHeaderDataset);
    } //-- void setResHeaderDataset(int, com.queplix.core.modules.eqlext.jxb.gr.ResHeaderDataset) 

    /**
     * Method setResHeaderDataset
     *
     * @param resHeaderDatasetArray
     */
    public void setResHeaderDataset(
            com.queplix.core.modules.eqlext.jxb.gr.ResHeaderDataset[] resHeaderDatasetArray) {
        //-- copy array
        _resHeaderDatasetList.clear();
        for(int i = 0; i < resHeaderDatasetArray.length; i++) {
            _resHeaderDatasetList.add(resHeaderDatasetArray[i]);
        }
    } //-- void setResHeaderDataset(com.queplix.core.modules.eqlext.jxb.gr.ResHeaderDataset) 

    /**
     * Method setResHeaderField
     *
     * @param index
     * @param vResHeaderField
     */
    public void setResHeaderField(int index,
                                  com.queplix.core.modules.eqlext.jxb.gr.ResHeaderField vResHeaderField)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _resHeaderFieldList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _resHeaderFieldList.set(index, vResHeaderField);
    } //-- void setResHeaderField(int, com.queplix.core.modules.eqlext.jxb.gr.ResHeaderField) 

    /**
     * Method setResHeaderField
     *
     * @param resHeaderFieldArray
     */
    public void setResHeaderField(
            com.queplix.core.modules.eqlext.jxb.gr.ResHeaderField[] resHeaderFieldArray) {
        //-- copy array
        _resHeaderFieldList.clear();
        for(int i = 0; i < resHeaderFieldArray.length; i++) {
            _resHeaderFieldList.add(resHeaderFieldArray[i]);
        }
    } //-- void setResHeaderField(com.queplix.core.modules.eqlext.jxb.gr.ResHeaderField) 

    /**
     * Method setResLinkedDataset
     *
     * @param index
     * @param vResLinkedDataset
     */
    public void setResLinkedDataset(int index,
                                    com.queplix.core.modules.eqlext.jxb.gr.ResLinkedDataset vResLinkedDataset)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _resLinkedDatasetList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _resLinkedDatasetList.set(index, vResLinkedDataset);
    } //-- void setResLinkedDataset(int, com.queplix.core.modules.eqlext.jxb.gr.ResLinkedDataset) 

    /**
     * Method setResLinkedDataset
     *
     * @param resLinkedDatasetArray
     */
    public void setResLinkedDataset(
            com.queplix.core.modules.eqlext.jxb.gr.ResLinkedDataset[] resLinkedDatasetArray) {
        //-- copy array
        _resLinkedDatasetList.clear();
        for(int i = 0; i < resLinkedDatasetArray.length; i++) {
            _resLinkedDatasetList.add(resLinkedDatasetArray[i]);
        }
    } //-- void setResLinkedDataset(com.queplix.core.modules.eqlext.jxb.gr.ResLinkedDataset) 

    /**
     * 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.gr.ResHeaderType) Unmarshaller
                .unmarshal(
                        com.queplix.core.modules.eqlext.jxb.gr.ResHeaderType.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() 

}
