/*
 * 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 org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;

import java.util.ArrayList;

/**
 * The root element
 *
 * @version $Revision$ $Date$
 */
public class Customs extends com.queplix.core.utils.jxb.JXBObject
        implements java.io.Serializable {

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

    /**
     * The entity customization description
     */
    private java.util.ArrayList _customList;

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

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

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

    /**
     * Method addCustom
     *
     * @param vCustom
     */
    public void addCustom(com.queplix.core.modules.config.jxb.Custom vCustom)
            throws java.lang.IndexOutOfBoundsException {
        _customList.add(vCustom);
    } //-- void addCustom(com.queplix.core.modules.config.jxb.Custom) 

    /**
     * Method addCustom
     *
     * @param index
     * @param vCustom
     */
    public void addCustom(int index,
                          com.queplix.core.modules.config.jxb.Custom vCustom)
            throws java.lang.IndexOutOfBoundsException {
        _customList.add(index, vCustom);
    } //-- void addCustom(int, com.queplix.core.modules.config.jxb.Custom) 

    /**
     * Method clearCustom
     */
    public void clearCustom() {
        _customList.clear();
    } //-- void clearCustom() 

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

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

        return (com.queplix.core.modules.config.jxb.Custom) _customList.get(
                index);
    } //-- com.queplix.core.modules.config.jxb.Custom getCustom(int) 

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

    /**
     * Method getCustomCount
     *
     * @return int
     */
    public int getCustomCount() {
        return _customList.size();
    } //-- int getCustomCount() 

    /**
     * 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 removeCustom
     *
     * @param vCustom
     * @return boolean
     */
    public boolean removeCustom(
            com.queplix.core.modules.config.jxb.Custom vCustom) {
        boolean removed = _customList.remove(vCustom);
        return removed;
    } //-- boolean removeCustom(com.queplix.core.modules.config.jxb.Custom) 

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

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

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

}
