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

//---------------------------------/
//- 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 Dataschemas extends com.queplix.core.utils.jxb.JXBObject
        implements java.io.Serializable {

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

    /**
     * The dataschema description
     */
    private java.util.ArrayList _dataschemaList;

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

    public Dataschemas() {
        super();
        _dataschemaList = new ArrayList();
    } //-- com.queplix.core.jxb.entity.Dataschemas()

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

    /**
     * Method addDataschema
     *
     * @param vDataschema
     */
    public void addDataschema(
            com.queplix.core.jxb.entity.Dataschema vDataschema)
            throws java.lang.IndexOutOfBoundsException {
        _dataschemaList.add(vDataschema);
    } //-- void addDataschema(com.queplix.core.jxb.entity.Dataschema) 

    /**
     * Method addDataschema
     *
     * @param index
     * @param vDataschema
     */
    public void addDataschema(int index,
                              com.queplix.core.jxb.entity.Dataschema vDataschema)
            throws java.lang.IndexOutOfBoundsException {
        _dataschemaList.add(index, vDataschema);
    } //-- void addDataschema(int, com.queplix.core.jxb.entity.Dataschema) 

    /**
     * Method clearDataschema
     */
    public void clearDataschema() {
        _dataschemaList.clear();
    } //-- void clearDataschema() 

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

    /**
     * Method getDataschema
     *
     * @param index
     * @return Dataschema
     */
    public com.queplix.core.jxb.entity.Dataschema getDataschema(int index)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _dataschemaList.size())) {
            throw new IndexOutOfBoundsException();
        }

        return (com.queplix.core.jxb.entity.Dataschema) _dataschemaList.get(
                index);
    } //-- com.queplix.core.jxb.entity.Dataschema getDataschema(int) 

    /**
     * Method getDataschema
     *
     * @return Dataschema
     */
    public com.queplix.core.jxb.entity.Dataschema[] getDataschema() {
        int size = _dataschemaList.size();
        com.queplix.core.jxb.entity.Dataschema[] mArray
                = new com.queplix.core.jxb.entity.Dataschema[size];
        for(int index = 0; index < size; index++) {
            mArray[index]
                    = (com.queplix.core.jxb.entity.Dataschema) _dataschemaList
                    .get(index);
        }
        return mArray;
    } //-- com.queplix.core.jxb.entity.Dataschema[] getDataschema() 

    /**
     * Method getDataschemaCount
     *
     * @return int
     */
    public int getDataschemaCount() {
        return _dataschemaList.size();
    } //-- int getDataschemaCount() 

    /**
     * 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 removeDataschema
     *
     * @param vDataschema
     * @return boolean
     */
    public boolean removeDataschema(
            com.queplix.core.jxb.entity.Dataschema vDataschema) {
        boolean removed = _dataschemaList.remove(vDataschema);
        return removed;
    } //-- boolean removeDataschema(com.queplix.core.jxb.entity.Dataschema) 

    /**
     * Method setDataschema
     *
     * @param index
     * @param vDataschema
     */
    public void setDataschema(int index,
                              com.queplix.core.jxb.entity.Dataschema vDataschema)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _dataschemaList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _dataschemaList.set(index, vDataschema);
    } //-- void setDataschema(int, com.queplix.core.jxb.entity.Dataschema) 

    /**
     * Method setDataschema
     *
     * @param dataschemaArray
     */
    public void setDataschema(
            com.queplix.core.jxb.entity.Dataschema[] dataschemaArray) {
        //-- copy array
        _dataschemaList.clear();
        for(int i = 0; i < dataschemaArray.length; i++) {
            _dataschemaList.add(dataschemaArray[i]);
        }
    } //-- void setDataschema(com.queplix.core.jxb.entity.Dataschema) 

    /**
     * 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.jxb.entity.Dataschemas) Unmarshaller.unmarshal(
                com.queplix.core.jxb.entity.Dataschemas.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() 

}
