/*
 * 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 captions
 * 
 * @version $Revision$ $Date$
 */
public class CaptionsType extends com.queplix.core.modules.config.jxb.LocalizedObjectsId 
implements java.io.Serializable
{


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

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


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

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


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

    /**
     * Method addCaption
     * 
     * 
     * 
     * @param vCaption
     */
    public void addCaption(com.queplix.core.modules.config.jxb.Caption vCaption)
        throws java.lang.IndexOutOfBoundsException
    {
        _captionList.add(vCaption);
    } //-- void addCaption(com.queplix.core.modules.config.jxb.Caption) 

    /**
     * Method addCaption
     * 
     * 
     * 
     * @param index
     * @param vCaption
     */
    public void addCaption(int index, com.queplix.core.modules.config.jxb.Caption vCaption)
        throws java.lang.IndexOutOfBoundsException
    {
        _captionList.add(index, vCaption);
    } //-- void addCaption(int, com.queplix.core.modules.config.jxb.Caption) 

    /**
     * Method clearCaption
     * 
     */
    public void clearCaption()
    {
        _captionList.clear();
    } //-- void clearCaption() 

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

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

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

    /**
     * Method getCaptionCount
     * 
     * 
     * 
     * @return int
     */
    public int getCaptionCount()
    {
        return _captionList.size();
    } //-- int getCaptionCount() 

    /**
     * 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 removeCaption
     * 
     * 
     * 
     * @param vCaption
     * @return boolean
     */
    public boolean removeCaption(com.queplix.core.modules.config.jxb.Caption vCaption)
    {
        boolean removed = _captionList.remove(vCaption);
        return removed;
    } //-- boolean removeCaption(com.queplix.core.modules.config.jxb.Caption) 

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

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

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

}
