/*
 * 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 ExtRess.
 *
 * @version $Revision$ $Date$
 */
public class ExtRess extends com.queplix.core.utils.jxb.JXBObject
        implements java.io.Serializable {

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

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

    /**
     * Field _extReqs
     */
    private com.queplix.core.modules.eqlext.jxb.gr.ExtReqs _extReqs;

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

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

    public ExtRess() {
        super();
        _ressList = new ArrayList();
    } //-- com.queplix.core.modules.eqlext.jxb.gr.ExtRess()

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

    /**
     * Method addRess
     *
     * @param vRess
     */
    public void addRess(com.queplix.core.modules.eqlext.jxb.gr.Ress vRess)
            throws java.lang.IndexOutOfBoundsException {
        _ressList.add(vRess);
    } //-- void addRess(com.queplix.core.modules.eqlext.jxb.gr.Ress) 

    /**
     * Method addRess
     *
     * @param index
     * @param vRess
     */
    public void addRess(int index,
                        com.queplix.core.modules.eqlext.jxb.gr.Ress vRess)
            throws java.lang.IndexOutOfBoundsException {
        _ressList.add(index, vRess);
    } //-- void addRess(int, com.queplix.core.modules.eqlext.jxb.gr.Ress) 

    /**
     * Method clearRess
     */
    public void clearRess() {
        _ressList.clear();
    } //-- void clearRess() 

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

    /**
     * Returns the value of field 'extReqs'.
     *
     * @return the value of field 'extReqs'.
     */
    public com.queplix.core.modules.eqlext.jxb.gr.ExtReqs getExtReqs() {
        return this._extReqs;
    } //-- com.queplix.core.modules.eqlext.jxb.gr.ExtReqs getExtReqs() 

    /**
     * Returns the value of field 'formid'.
     *
     * @return the value of field 'formid'.
     */
    public java.lang.String getFormid() {
        return this._formid;
    } //-- java.lang.String getFormid() 

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

        return (com.queplix.core.modules.eqlext.jxb.gr.Ress) _ressList.get(
                index);
    } //-- com.queplix.core.modules.eqlext.jxb.gr.Ress getRess(int) 

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

    /**
     * Method getRessCount
     *
     * @return int
     */
    public int getRessCount() {
        return _ressList.size();
    } //-- int getRessCount() 

    /**
     * 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 removeRess
     *
     * @param vRess
     * @return boolean
     */
    public boolean removeRess(
            com.queplix.core.modules.eqlext.jxb.gr.Ress vRess) {
        boolean removed = _ressList.remove(vRess);
        return removed;
    } //-- boolean removeRess(com.queplix.core.modules.eqlext.jxb.gr.Ress) 

    /**
     * Sets the value of field 'extReqs'.
     *
     * @param extReqs the value of field 'extReqs'.
     */
    public void setExtReqs(
            com.queplix.core.modules.eqlext.jxb.gr.ExtReqs extReqs) {
        this._extReqs = extReqs;
    } //-- void setExtReqs(com.queplix.core.modules.eqlext.jxb.gr.ExtReqs) 

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

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

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

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

}
