/*
 * 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;

/**
 * The sequence of descriptions
 * 
 * @version $Revision$ $Date$
 */
public class DescriptionsType extends com.queplix.core.modules.config.jxb.LocalizedObjectsId 
implements java.io.Serializable
{


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

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


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

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


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

    /**
     * Method addDescription
     * 
     * 
     * 
     * @param vDescription
     */
    public void addDescription(com.queplix.core.modules.config.jxb.Description vDescription)
        throws java.lang.IndexOutOfBoundsException
    {
        _descriptionList.add(vDescription);
    } //-- void addDescription(com.queplix.core.modules.config.jxb.Description) 

    /**
     * Method addDescription
     * 
     * 
     * 
     * @param index
     * @param vDescription
     */
    public void addDescription(int index, com.queplix.core.modules.config.jxb.Description vDescription)
        throws java.lang.IndexOutOfBoundsException
    {
        _descriptionList.add(index, vDescription);
    } //-- void addDescription(int, com.queplix.core.modules.config.jxb.Description) 

    /**
     * Method clearDescription
     * 
     */
    public void clearDescription()
    {
        _descriptionList.clear();
    } //-- void clearDescription() 

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

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

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

    /**
     * Method getDescriptionCount
     * 
     * 
     * 
     * @return int
     */
    public int getDescriptionCount()
    {
        return _descriptionList.size();
    } //-- int getDescriptionCount() 

    /**
     * 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 removeDescription
     * 
     * 
     * 
     * @param vDescription
     * @return boolean
     */
    public boolean removeDescription(com.queplix.core.modules.config.jxb.Description vDescription)
    {
        boolean removed = _descriptionList.remove(vDescription);
        return removed;
    } //-- boolean removeDescription(com.queplix.core.modules.config.jxb.Description) 

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

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

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

}
