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

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

    /**
     * How to chain child elements with each other
     */
    private com.queplix.core.modules.eqlext.jxb.gr.types.ConditionSType _type
            = com.queplix.core.modules.eqlext.jxb.gr.types.ConditionSType
            .valueOf("and");

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

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

    public ReqFiltersType() {
        super();
        setType(com.queplix.core.modules.eqlext.jxb.gr.types.ConditionSType.valueOf(
                "and"));
        _items = new ArrayList();
    } //-- com.queplix.core.modules.eqlext.jxb.gr.ReqFiltersType()

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

    /**
     * Method addReqFiltersTypeItem
     *
     * @param vReqFiltersTypeItem
     */
    public void addReqFiltersTypeItem(
            com.queplix.core.modules.eqlext.jxb.gr.ReqFiltersTypeItem vReqFiltersTypeItem)
            throws java.lang.IndexOutOfBoundsException {
        _items.add(vReqFiltersTypeItem);
    } //-- void addReqFiltersTypeItem(com.queplix.core.modules.eqlext.jxb.gr.ReqFiltersTypeItem) 

    /**
     * Method addReqFiltersTypeItem
     *
     * @param index
     * @param vReqFiltersTypeItem
     */
    public void addReqFiltersTypeItem(int index,
                                      com.queplix.core.modules.eqlext.jxb.gr.ReqFiltersTypeItem vReqFiltersTypeItem)
            throws java.lang.IndexOutOfBoundsException {
        _items.add(index, vReqFiltersTypeItem);
    } //-- void addReqFiltersTypeItem(int, com.queplix.core.modules.eqlext.jxb.gr.ReqFiltersTypeItem) 

    /**
     * Method clearReqFiltersTypeItem
     */
    public void clearReqFiltersTypeItem() {
        _items.clear();
    } //-- void clearReqFiltersTypeItem() 

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

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

        return (com.queplix.core.modules.eqlext.jxb.gr.ReqFiltersTypeItem) _items
                .get(index);
    } //-- com.queplix.core.modules.eqlext.jxb.gr.ReqFiltersTypeItem getReqFiltersTypeItem(int) 

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

    /**
     * Method getReqFiltersTypeItemCount
     *
     * @return int
     */
    public int getReqFiltersTypeItemCount() {
        return _items.size();
    } //-- int getReqFiltersTypeItemCount() 

    /**
     * Returns the value of field 'type'. The field 'type' has the
     * following description: How to chain child elements with each
     * other
     *
     * @return the value of field 'type'.
     */
    public com.queplix.core.modules.eqlext.jxb.gr.types.ConditionSType getType() {
        return this._type;
    } //-- com.queplix.core.modules.eqlext.jxb.gr.types.ConditionSType getType() 

    /**
     * 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 removeReqFiltersTypeItem
     *
     * @param vReqFiltersTypeItem
     * @return boolean
     */
    public boolean removeReqFiltersTypeItem(
            com.queplix.core.modules.eqlext.jxb.gr.ReqFiltersTypeItem vReqFiltersTypeItem) {
        boolean removed = _items.remove(vReqFiltersTypeItem);
        return removed;
    } //-- boolean removeReqFiltersTypeItem(com.queplix.core.modules.eqlext.jxb.gr.ReqFiltersTypeItem) 

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

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

    /**
     * Sets the value of field 'type'. The field 'type' has the
     * following description: How to chain child elements with each
     * other
     *
     * @param type the value of field 'type'.
     */
    public void setType(
            com.queplix.core.modules.eqlext.jxb.gr.types.ConditionSType type) {
        this._type = type;
    } //-- void setType(com.queplix.core.modules.eqlext.jxb.gr.types.ConditionSType) 

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

}
