/*
 * This class was automatically generated with 
 * <a href="http://www.castor.org">Castor 0.9.5.3</a>, using an XML
 * Schema.
 * $Id$
 */

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

import java.io.IOException;
import java.io.Reader;
import java.io.Serializable;
import java.io.Writer;
import java.util.Enumeration;
import java.util.Vector;
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 Moduletypes.
 * 
 * @version $Revision$ $Date$
 */
public class Moduletypes implements java.io.Serializable {


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

    /**
     * Field _moduletypeList
     */
    private java.util.Vector _moduletypeList;


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

    public Moduletypes() {
        super();
        _moduletypeList = new Vector();
    } //-- Moduletypes()


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

    /**
     * Method addModuletype
     * 
     * @param vModuletype
     */
    public void addModuletype(Moduletype vModuletype)
        throws java.lang.IndexOutOfBoundsException
    {
        _moduletypeList.addElement(vModuletype);
    } //-- void addModuletype(Moduletype) 

    /**
     * Method addModuletype
     * 
     * @param index
     * @param vModuletype
     */
    public void addModuletype(int index, Moduletype vModuletype)
        throws java.lang.IndexOutOfBoundsException
    {
        _moduletypeList.insertElementAt(vModuletype, index);
    } //-- void addModuletype(int, Moduletype) 

    /**
     * Method enumerateModuletype
     */
    public java.util.Enumeration enumerateModuletype()
    {
        return _moduletypeList.elements();
    } //-- java.util.Enumeration enumerateModuletype() 

    /**
     * Method getModuletype
     * 
     * @param index
     */
    public Moduletype getModuletype(int index)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _moduletypeList.size())) {
            throw new IndexOutOfBoundsException();
        }
        
        return (Moduletype) _moduletypeList.elementAt(index);
    } //-- Moduletype getModuletype(int) 

    /**
     * Method getModuletype
     */
    public Moduletype[] getModuletype()
    {
        int size = _moduletypeList.size();
        Moduletype[] mArray = new Moduletype[size];
        for (int index = 0; index < size; index++) {
            mArray[index] = (Moduletype) _moduletypeList.elementAt(index);
        }
        return mArray;
    } //-- Moduletype[] getModuletype() 

    /**
     * Method getModuletypeCount
     */
    public int getModuletypeCount()
    {
        return _moduletypeList.size();
    } //-- int getModuletypeCount() 

    /**
     * Method isValid
     */
    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 removeAllModuletype
     */
    public void removeAllModuletype()
    {
        _moduletypeList.removeAllElements();
    } //-- void removeAllModuletype() 

    /**
     * Method removeModuletype
     * 
     * @param index
     */
    public Moduletype removeModuletype(int index)
    {
        java.lang.Object obj = _moduletypeList.elementAt(index);
        _moduletypeList.removeElementAt(index);
        return (Moduletype) obj;
    } //-- Moduletype removeModuletype(int) 

    /**
     * Method setModuletype
     * 
     * @param index
     * @param vModuletype
     */
    public void setModuletype(int index, Moduletype vModuletype)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _moduletypeList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _moduletypeList.setElementAt(vModuletype, index);
    } //-- void setModuletype(int, Moduletype) 

    /**
     * Method setModuletype
     * 
     * @param moduletypeArray
     */
    public void setModuletype(Moduletype[] moduletypeArray)
    {
        //-- copy array
        _moduletypeList.removeAllElements();
        for (int i = 0; i < moduletypeArray.length; i++) {
            _moduletypeList.addElement(moduletypeArray[i]);
        }
    } //-- void setModuletype(Moduletype) 

    /**
     * Method unmarshal
     * 
     * @param reader
     */
    public static java.lang.Object unmarshal(java.io.Reader reader)
        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        return (Moduletypes) Unmarshaller.unmarshal(Moduletypes.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() 

}
