/*
 * 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 Ifg.
 *
 * @version $Revision$ $Date$
 */
public class Ifg extends com.queplix.core.utils.jxb.JXBObject
        implements java.io.Serializable {

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

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

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

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

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

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

    /**
     * Method addIfgRecord
     *
     * @param vIfgRecord
     */
    public void addIfgRecord(
            com.queplix.core.modules.eql.jxb.history.IfgRecord vIfgRecord)
            throws java.lang.IndexOutOfBoundsException {
        _ifgRecordList.add(vIfgRecord);
    } //-- void addIfgRecord(com.queplix.core.modules.eql.jxb.history.IfgRecord) 

    /**
     * Method addIfgRecord
     *
     * @param index
     * @param vIfgRecord
     */
    public void addIfgRecord(int index,
                             com.queplix.core.modules.eql.jxb.history.IfgRecord vIfgRecord)
            throws java.lang.IndexOutOfBoundsException {
        _ifgRecordList.add(index, vIfgRecord);
    } //-- void addIfgRecord(int, com.queplix.core.modules.eql.jxb.history.IfgRecord) 

    /**
     * Method clearIfgRecord
     */
    public void clearIfgRecord() {
        _ifgRecordList.clear();
    } //-- void clearIfgRecord() 

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

    /**
     * Returns the value of field 'caption'.
     *
     * @return the value of field 'caption'.
     */
    public java.lang.String getCaption() {
        return this._caption;
    } //-- java.lang.String getCaption() 

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

        return (com.queplix.core.modules.eql.jxb.history.IfgRecord) _ifgRecordList
                .get(index);
    } //-- com.queplix.core.modules.eql.jxb.history.IfgRecord getIfgRecord(int) 

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

    /**
     * Method getIfgRecordCount
     *
     * @return int
     */
    public int getIfgRecordCount() {
        return _ifgRecordList.size();
    } //-- int getIfgRecordCount() 

    /**
     * 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 removeIfgRecord
     *
     * @param vIfgRecord
     * @return boolean
     */
    public boolean removeIfgRecord(
            com.queplix.core.modules.eql.jxb.history.IfgRecord vIfgRecord) {
        boolean removed = _ifgRecordList.remove(vIfgRecord);
        return removed;
    } //-- boolean removeIfgRecord(com.queplix.core.modules.eql.jxb.history.IfgRecord) 

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

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

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

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

}
