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

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

import java.io.IOException;
import java.io.Reader;
import java.io.Serializable;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Enumeration;
import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;
import org.exolab.castor.xml.ValidationException;
import org.xml.sax.ContentHandler;

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


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

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


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

    public Filters() 
     {
        super();
        _filterList = new ArrayList();
    } //-- com.queplix.core.modules.config.jxb.Filters()


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

    /**
     * Method addFilter
     * 
     * 
     * 
     * @param vFilter
     */
    public void addFilter(com.queplix.core.modules.config.jxb.Filter vFilter)
        throws java.lang.IndexOutOfBoundsException
    {
        _filterList.add(vFilter);
    } //-- void addFilter(com.queplix.core.modules.config.jxb.Filter) 

    /**
     * Method addFilter
     * 
     * 
     * 
     * @param index
     * @param vFilter
     */
    public void addFilter(int index, com.queplix.core.modules.config.jxb.Filter vFilter)
        throws java.lang.IndexOutOfBoundsException
    {
        _filterList.add(index, vFilter);
    } //-- void addFilter(int, com.queplix.core.modules.config.jxb.Filter) 

    /**
     * Method clearFilter
     * 
     */
    public void clearFilter()
    {
        _filterList.clear();
    } //-- void clearFilter() 

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

    /**
     * Method getFilter
     * 
     * 
     * 
     * @param index
     * @return Filter
     */
    public com.queplix.core.modules.config.jxb.Filter getFilter(int index)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _filterList.size())) {
            throw new IndexOutOfBoundsException();
        }
        
        return (com.queplix.core.modules.config.jxb.Filter) _filterList.get(index);
    } //-- com.queplix.core.modules.config.jxb.Filter getFilter(int) 

    /**
     * Method getFilter
     * 
     * 
     * 
     * @return Filter
     */
    public com.queplix.core.modules.config.jxb.Filter[] getFilter()
    {
        int size = _filterList.size();
        com.queplix.core.modules.config.jxb.Filter[] mArray = new com.queplix.core.modules.config.jxb.Filter[size];
        for (int index = 0; index < size; index++) {
            mArray[index] = (com.queplix.core.modules.config.jxb.Filter) _filterList.get(index);
        }
        return mArray;
    } //-- com.queplix.core.modules.config.jxb.Filter[] getFilter() 

    /**
     * Method getFilterCount
     * 
     * 
     * 
     * @return int
     */
    public int getFilterCount()
    {
        return _filterList.size();
    } //-- int getFilterCount() 

    /**
     * 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 removeFilter
     * 
     * 
     * 
     * @param vFilter
     * @return boolean
     */
    public boolean removeFilter(com.queplix.core.modules.config.jxb.Filter vFilter)
    {
        boolean removed = _filterList.remove(vFilter);
        return removed;
    } //-- boolean removeFilter(com.queplix.core.modules.config.jxb.Filter) 

    /**
     * Method setFilter
     * 
     * 
     * 
     * @param index
     * @param vFilter
     */
    public void setFilter(int index, com.queplix.core.modules.config.jxb.Filter vFilter)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _filterList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _filterList.set(index, vFilter);
    } //-- void setFilter(int, com.queplix.core.modules.config.jxb.Filter) 

    /**
     * Method setFilter
     * 
     * 
     * 
     * @param filterArray
     */
    public void setFilter(com.queplix.core.modules.config.jxb.Filter[] filterArray)
    {
        //-- copy array
        _filterList.clear();
        for (int i = 0; i < filterArray.length; i++) {
            _filterList.add(filterArray[i]);
        }
    } //-- void setFilter(com.queplix.core.modules.config.jxb.Filter) 

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

}
