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

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

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

import java.util.ArrayList;

/**
 * Set of com.queplix.core.modules.inbox.utils.InboxProvider
 * implementations
 *
 * @version $Revision$ $Date$
 */
public class Providers extends com.queplix.core.utils.jxb.JXBObject
        implements java.io.Serializable {

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

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

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

    public Providers() {
        super();
        _providerList = new ArrayList();
    } //-- com.queplix.core.modules.inbox.jxb.Providers()

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

    /**
     * Method addProvider
     *
     * @param vProvider
     */
    public void addProvider(
            com.queplix.core.modules.inbox.jxb.Provider vProvider)
            throws java.lang.IndexOutOfBoundsException {
        _providerList.add(vProvider);
    } //-- void addProvider(com.queplix.core.modules.inbox.jxb.Provider) 

    /**
     * Method addProvider
     *
     * @param index
     * @param vProvider
     */
    public void addProvider(int index,
                            com.queplix.core.modules.inbox.jxb.Provider vProvider)
            throws java.lang.IndexOutOfBoundsException {
        _providerList.add(index, vProvider);
    } //-- void addProvider(int, com.queplix.core.modules.inbox.jxb.Provider) 

    /**
     * Method clearProvider
     */
    public void clearProvider() {
        _providerList.clear();
    } //-- void clearProvider() 

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

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

        return (com.queplix.core.modules.inbox.jxb.Provider) _providerList.get(
                index);
    } //-- com.queplix.core.modules.inbox.jxb.Provider getProvider(int) 

    /**
     * Method getProvider
     *
     * @return Provider
     */
    public com.queplix.core.modules.inbox.jxb.Provider[] getProvider() {
        int size = _providerList.size();
        com.queplix.core.modules.inbox.jxb.Provider[] mArray
                = new com.queplix.core.modules.inbox.jxb.Provider[size];
        for(int index = 0; index < size; index++) {
            mArray[index]
                    = (com.queplix.core.modules.inbox.jxb.Provider) _providerList
                    .get(index);
        }
        return mArray;
    } //-- com.queplix.core.modules.inbox.jxb.Provider[] getProvider() 

    /**
     * Method getProviderCount
     *
     * @return int
     */
    public int getProviderCount() {
        return _providerList.size();
    } //-- int getProviderCount() 

    /**
     * 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 removeProvider
     *
     * @param vProvider
     * @return boolean
     */
    public boolean removeProvider(
            com.queplix.core.modules.inbox.jxb.Provider vProvider) {
        boolean removed = _providerList.remove(vProvider);
        return removed;
    } //-- boolean removeProvider(com.queplix.core.modules.inbox.jxb.Provider) 

    /**
     * Method setProvider
     *
     * @param index
     * @param vProvider
     */
    public void setProvider(int index,
                            com.queplix.core.modules.inbox.jxb.Provider vProvider)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _providerList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _providerList.set(index, vProvider);
    } //-- void setProvider(int, com.queplix.core.modules.inbox.jxb.Provider) 

    /**
     * Method setProvider
     *
     * @param providerArray
     */
    public void setProvider(
            com.queplix.core.modules.inbox.jxb.Provider[] providerArray) {
        //-- copy array
        _providerList.clear();
        for(int i = 0; i < providerArray.length; i++) {
            _providerList.add(providerArray[i]);
        }
    } //-- void setProvider(com.queplix.core.modules.inbox.jxb.Provider) 

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

}
