/*
 * 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 Java Script Group (JSG) description
 *
 * @version $Revision$ $Date$
 */
public class JsGroup extends com.queplix.core.utils.jxb.JXBObject
        implements java.io.Serializable {

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

    /**
     * Field _name
     */
    private java.lang.String _name;

    /**
     * Field _compile
     */
    private java.lang.Boolean _compile = new java.lang.Boolean("true");

    /**
     * Include JS file or directory or another JSG
     */
    private java.util.ArrayList _includeList;

    /**
     * Exclude JS file or directory
     */
    private java.util.ArrayList _excludeList;

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

    public JsGroup() {
        super();
        _includeList = new ArrayList();
        _excludeList = new ArrayList();
    } //-- com.queplix.core.modules.web.jxb.JsGroup()

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

    /**
     * Method addExclude
     *
     * @param vExclude
     */
    public void addExclude(com.queplix.core.modules.web.jxb.Exclude vExclude)
            throws java.lang.IndexOutOfBoundsException {
        _excludeList.add(vExclude);
    } //-- void addExclude(com.queplix.core.modules.web.jxb.Exclude) 

    /**
     * Method addExclude
     *
     * @param index
     * @param vExclude
     */
    public void addExclude(int index,
                           com.queplix.core.modules.web.jxb.Exclude vExclude)
            throws java.lang.IndexOutOfBoundsException {
        _excludeList.add(index, vExclude);
    } //-- void addExclude(int, com.queplix.core.modules.web.jxb.Exclude) 

    /**
     * Method addInclude
     *
     * @param vInclude
     */
    public void addInclude(com.queplix.core.modules.web.jxb.Include vInclude)
            throws java.lang.IndexOutOfBoundsException {
        _includeList.add(vInclude);
    } //-- void addInclude(com.queplix.core.modules.web.jxb.Include) 

    /**
     * Method addInclude
     *
     * @param index
     * @param vInclude
     */
    public void addInclude(int index,
                           com.queplix.core.modules.web.jxb.Include vInclude)
            throws java.lang.IndexOutOfBoundsException {
        _includeList.add(index, vInclude);
    } //-- void addInclude(int, com.queplix.core.modules.web.jxb.Include) 

    /**
     * Method clearExclude
     */
    public void clearExclude() {
        _excludeList.clear();
    } //-- void clearExclude() 

    /**
     * Method clearInclude
     */
    public void clearInclude() {
        _includeList.clear();
    } //-- void clearInclude() 

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

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

    /**
     * Returns the value of field 'compile'.
     *
     * @return the value of field 'compile'.
     */
    public java.lang.Boolean getCompile() {
        return this._compile;
    } //-- java.lang.Boolean getCompile() 

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

        return (com.queplix.core.modules.web.jxb.Exclude) _excludeList.get(
                index);
    } //-- com.queplix.core.modules.web.jxb.Exclude getExclude(int) 

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

    /**
     * Method getExcludeCount
     *
     * @return int
     */
    public int getExcludeCount() {
        return _excludeList.size();
    } //-- int getExcludeCount() 

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

        return (com.queplix.core.modules.web.jxb.Include) _includeList.get(
                index);
    } //-- com.queplix.core.modules.web.jxb.Include getInclude(int) 

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

    /**
     * Method getIncludeCount
     *
     * @return int
     */
    public int getIncludeCount() {
        return _includeList.size();
    } //-- int getIncludeCount() 

    /**
     * Returns the value of field 'name'.
     *
     * @return the value of field 'name'.
     */
    public java.lang.String getName() {
        return this._name;
    } //-- java.lang.String getName() 

    /**
     * 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 removeExclude
     *
     * @param vExclude
     * @return boolean
     */
    public boolean removeExclude(
            com.queplix.core.modules.web.jxb.Exclude vExclude) {
        boolean removed = _excludeList.remove(vExclude);
        return removed;
    } //-- boolean removeExclude(com.queplix.core.modules.web.jxb.Exclude) 

    /**
     * Method removeInclude
     *
     * @param vInclude
     * @return boolean
     */
    public boolean removeInclude(
            com.queplix.core.modules.web.jxb.Include vInclude) {
        boolean removed = _includeList.remove(vInclude);
        return removed;
    } //-- boolean removeInclude(com.queplix.core.modules.web.jxb.Include) 

    /**
     * Sets the value of field 'compile'.
     *
     * @param compile the value of field 'compile'.
     */
    public void setCompile(java.lang.Boolean compile) {
        this._compile = compile;
    } //-- void setCompile(java.lang.Boolean) 

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

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

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

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

    /**
     * Sets the value of field 'name'.
     *
     * @param name the value of field 'name'.
     */
    public void setName(java.lang.String name) {
        this._name = name;
    } //-- void setName(java.lang.String) 

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

}
