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

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

import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;

import java.util.ArrayList;

/**
 * This branch is reserved for future use. Not implemented.
 *
 * @version $Revision$ $Date$
 */
public class Tasks extends com.queplix.core.utils.jxb.JXBObject
        implements java.io.Serializable {

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

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

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

    public Tasks() {
        super();
        _taskList = new ArrayList();
    } //-- com.queplix.core.modules.services.jxb.Tasks()

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

    /**
     * Method addTask
     *
     * @param vTask
     */
    public void addTask(com.queplix.core.modules.services.jxb.Task vTask)
            throws java.lang.IndexOutOfBoundsException {
        _taskList.add(vTask);
    } //-- void addTask(com.queplix.core.modules.services.jxb.Task) 

    /**
     * Method addTask
     *
     * @param index
     * @param vTask
     */
    public void addTask(int index,
                        com.queplix.core.modules.services.jxb.Task vTask)
            throws java.lang.IndexOutOfBoundsException {
        _taskList.add(index, vTask);
    } //-- void addTask(int, com.queplix.core.modules.services.jxb.Task) 

    /**
     * Method clearTask
     */
    public void clearTask() {
        _taskList.clear();
    } //-- void clearTask() 

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

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

        return (com.queplix.core.modules.services.jxb.Task) _taskList.get(
                index);
    } //-- com.queplix.core.modules.services.jxb.Task getTask(int) 

    /**
     * Method getTask
     *
     * @return Task
     */
    public com.queplix.core.modules.services.jxb.Task[] getTask() {
        int size = _taskList.size();
        com.queplix.core.modules.services.jxb.Task[] mArray
                = new com.queplix.core.modules.services.jxb.Task[size];
        for(int index = 0; index < size; index++) {
            mArray[index]
                    = (com.queplix.core.modules.services.jxb.Task) _taskList
                    .get(index);
        }
        return mArray;
    } //-- com.queplix.core.modules.services.jxb.Task[] getTask() 

    /**
     * Method getTaskCount
     *
     * @return int
     */
    public int getTaskCount() {
        return _taskList.size();
    } //-- int getTaskCount() 

    /**
     * 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 removeTask
     *
     * @param vTask
     * @return boolean
     */
    public boolean removeTask(
            com.queplix.core.modules.services.jxb.Task vTask) {
        boolean removed = _taskList.remove(vTask);
        return removed;
    } //-- boolean removeTask(com.queplix.core.modules.services.jxb.Task) 

    /**
     * Method setTask
     *
     * @param index
     * @param vTask
     */
    public void setTask(int index,
                        com.queplix.core.modules.services.jxb.Task vTask)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _taskList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _taskList.set(index, vTask);
    } //-- void setTask(int, com.queplix.core.modules.services.jxb.Task) 

    /**
     * Method setTask
     *
     * @param taskArray
     */
    public void setTask(
            com.queplix.core.modules.services.jxb.Task[] taskArray) {
        //-- copy array
        _taskList.clear();
        for(int i = 0; i < taskArray.length; i++) {
            _taskList.add(taskArray[i]);
        }
    } //-- void setTask(com.queplix.core.modules.services.jxb.Task) 

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

}
