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

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

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

import java.util.ArrayList;

/**
 * Class History.
 *
 * @version $Revision$ $Date$
 */
public class History extends com.queplix.core.utils.jxb.JXBObject
        implements java.io.Serializable {

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

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

    /**
     * Field _historyUnparsedTopic
     */
    private com.queplix.core.modules.eql.jxb.history.HistoryUnparsedTopic _historyUnparsedTopic;

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

    public History() {
        super();
        _historyTopicList = new ArrayList();
    } //-- com.queplix.core.modules.eql.jxb.history.History()

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

    /**
     * Method addHistoryTopic
     *
     * @param vHistoryTopic
     */
    public void addHistoryTopic(
            com.queplix.core.modules.eql.jxb.history.HistoryTopic vHistoryTopic)
            throws java.lang.IndexOutOfBoundsException {
        _historyTopicList.add(vHistoryTopic);
    } //-- void addHistoryTopic(com.queplix.core.modules.eql.jxb.history.HistoryTopic) 

    /**
     * Method addHistoryTopic
     *
     * @param index
     * @param vHistoryTopic
     */
    public void addHistoryTopic(int index,
                                com.queplix.core.modules.eql.jxb.history.HistoryTopic vHistoryTopic)
            throws java.lang.IndexOutOfBoundsException {
        _historyTopicList.add(index, vHistoryTopic);
    } //-- void addHistoryTopic(int, com.queplix.core.modules.eql.jxb.history.HistoryTopic) 

    /**
     * Method clearHistoryTopic
     */
    public void clearHistoryTopic() {
        _historyTopicList.clear();
    } //-- void clearHistoryTopic() 

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

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

        return (com.queplix.core.modules.eql.jxb.history.HistoryTopic) _historyTopicList
                .get(index);
    } //-- com.queplix.core.modules.eql.jxb.history.HistoryTopic getHistoryTopic(int) 

    /**
     * Method getHistoryTopic
     *
     * @return HistoryTopic
     */
    public com.queplix.core.modules.eql.jxb.history.HistoryTopic[] getHistoryTopic() {
        int size = _historyTopicList.size();
        com.queplix.core.modules.eql.jxb.history.HistoryTopic[] mArray
                = new com.queplix.core.modules.eql.jxb.history.HistoryTopic[size];
        for(int index = 0; index < size; index++) {
            mArray[index]
                    = (com.queplix.core.modules.eql.jxb.history.HistoryTopic) _historyTopicList
                    .get(index);
        }
        return mArray;
    } //-- com.queplix.core.modules.eql.jxb.history.HistoryTopic[] getHistoryTopic() 

    /**
     * Method getHistoryTopicCount
     *
     * @return int
     */
    public int getHistoryTopicCount() {
        return _historyTopicList.size();
    } //-- int getHistoryTopicCount() 

    /**
     * Returns the value of field 'historyUnparsedTopic'.
     *
     * @return the value of field 'historyUnparsedTopic'.
     */
    public com.queplix.core.modules.eql.jxb.history.HistoryUnparsedTopic getHistoryUnparsedTopic() {
        return this._historyUnparsedTopic;
    } //-- com.queplix.core.modules.eql.jxb.history.HistoryUnparsedTopic getHistoryUnparsedTopic() 

    /**
     * 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 removeHistoryTopic
     *
     * @param vHistoryTopic
     * @return boolean
     */
    public boolean removeHistoryTopic(
            com.queplix.core.modules.eql.jxb.history.HistoryTopic vHistoryTopic) {
        boolean removed = _historyTopicList.remove(vHistoryTopic);
        return removed;
    } //-- boolean removeHistoryTopic(com.queplix.core.modules.eql.jxb.history.HistoryTopic) 

    /**
     * Method setHistoryTopic
     *
     * @param index
     * @param vHistoryTopic
     */
    public void setHistoryTopic(int index,
                                com.queplix.core.modules.eql.jxb.history.HistoryTopic vHistoryTopic)
            throws java.lang.IndexOutOfBoundsException {
        //-- check bounds for index
        if((index < 0) || (index > _historyTopicList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _historyTopicList.set(index, vHistoryTopic);
    } //-- void setHistoryTopic(int, com.queplix.core.modules.eql.jxb.history.HistoryTopic) 

    /**
     * Method setHistoryTopic
     *
     * @param historyTopicArray
     */
    public void setHistoryTopic(
            com.queplix.core.modules.eql.jxb.history.HistoryTopic[] historyTopicArray) {
        //-- copy array
        _historyTopicList.clear();
        for(int i = 0; i < historyTopicArray.length; i++) {
            _historyTopicList.add(historyTopicArray[i]);
        }
    } //-- void setHistoryTopic(com.queplix.core.modules.eql.jxb.history.HistoryTopic) 

    /**
     * Sets the value of field 'historyUnparsedTopic'.
     *
     * @param historyUnparsedTopic the value of field
     *                             'historyUnparsedTopic'.
     */
    public void setHistoryUnparsedTopic(
            com.queplix.core.modules.eql.jxb.history.HistoryUnparsedTopic historyUnparsedTopic) {
        this._historyUnparsedTopic = historyUnparsedTopic;
    } //-- void setHistoryUnparsedTopic(com.queplix.core.modules.eql.jxb.history.HistoryUnparsedTopic) 

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

}
