/*
 * Copyright 2006-2007 Queplix Corp.
 *
 * Licensed under the Queplix Public License, Version 1.1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.queplix.com/solutions/commercial-open-source/queplix-public-license/
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 *
 */

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

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

    /**
     * The Java Script Group (JSG) description
     */
    private java.util.ArrayList _jsGroupList;

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

    public JsGroups() {
        super();
        _jsGroupList = new ArrayList();
    } //-- com.queplix.core.modules.web.jxb.JsGroups()

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

    /**
     * Method addJsGroup
     *
     * @param vJsGroup
     */
    public void addJsGroup(com.queplix.core.modules.web.jxb.JsGroup vJsGroup)
            throws java.lang.IndexOutOfBoundsException {
        _jsGroupList.add(vJsGroup);
    } //-- void addJsGroup(com.queplix.core.modules.web.jxb.JsGroup) 

    /**
     * Method addJsGroup
     *
     * @param index
     * @param vJsGroup
     */
    public void addJsGroup(int index,
                           com.queplix.core.modules.web.jxb.JsGroup vJsGroup)
            throws java.lang.IndexOutOfBoundsException {
        _jsGroupList.add(index, vJsGroup);
    } //-- void addJsGroup(int, com.queplix.core.modules.web.jxb.JsGroup) 

    /**
     * Method clearJsGroup
     */
    public void clearJsGroup() {
        _jsGroupList.clear();
    } //-- void clearJsGroup() 

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

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

        return (com.queplix.core.modules.web.jxb.JsGroup) _jsGroupList.get(
                index);
    } //-- com.queplix.core.modules.web.jxb.JsGroup getJsGroup(int) 

    /**
     * Method getJsGroup
     *
     * @return JsGroup
     */
    public com.queplix.core.modules.web.jxb.JsGroup[] getJsGroup() {
        int size = _jsGroupList.size();
        com.queplix.core.modules.web.jxb.JsGroup[] mArray
                = new com.queplix.core.modules.web.jxb.JsGroup[size];
        for(int index = 0; index < size; index++) {
            mArray[index]
                    = (com.queplix.core.modules.web.jxb.JsGroup) _jsGroupList
                    .get(index);
        }
        return mArray;
    } //-- com.queplix.core.modules.web.jxb.JsGroup[] getJsGroup() 

    /**
     * Method getJsGroupCount
     *
     * @return int
     */
    public int getJsGroupCount() {
        return _jsGroupList.size();
    } //-- int getJsGroupCount() 

    /**
     * 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 removeJsGroup
     *
     * @param vJsGroup
     * @return boolean
     */
    public boolean removeJsGroup(
            com.queplix.core.modules.web.jxb.JsGroup vJsGroup) {
        boolean removed = _jsGroupList.remove(vJsGroup);
        return removed;
    } //-- boolean removeJsGroup(com.queplix.core.modules.web.jxb.JsGroup) 

    /**
     * Method setJsGroup
     *
     * @param index
     * @param vJsGroup
     */
    public void setJsGroup(int index,
                           com.queplix.core.modules.web.jxb.JsGroup vJsGroup)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _jsGroupList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _jsGroupList.set(index, vJsGroup);
    } //-- void setJsGroup(int, com.queplix.core.modules.web.jxb.JsGroup) 

    /**
     * Method setJsGroup
     *
     * @param jsGroupArray
     */
    public void setJsGroup(
            com.queplix.core.modules.web.jxb.JsGroup[] jsGroupArray) {
        //-- copy array
        _jsGroupList.clear();
        for(int i = 0; i < jsGroupArray.length; i++) {
            _jsGroupList.add(jsGroupArray[i]);
        }
    } //-- void setJsGroup(com.queplix.core.modules.web.jxb.JsGroup) 

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

}
