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

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

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

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

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

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

    /**
     * Method addIfg
     *
     * @param vIfg
     */
    public void addIfg(com.queplix.core.modules.eql.jxb.history.Ifg vIfg)
            throws java.lang.IndexOutOfBoundsException {
        _ifgList.add(vIfg);
    } //-- void addIfg(com.queplix.core.modules.eql.jxb.history.Ifg) 

    /**
     * Method addIfg
     *
     * @param index
     * @param vIfg
     */
    public void addIfg(int index,
                       com.queplix.core.modules.eql.jxb.history.Ifg vIfg)
            throws java.lang.IndexOutOfBoundsException {
        _ifgList.add(index, vIfg);
    } //-- void addIfg(int, com.queplix.core.modules.eql.jxb.history.Ifg) 

    /**
     * Method clearIfg
     */
    public void clearIfg() {
        _ifgList.clear();
    } //-- void clearIfg() 

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

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

        return (com.queplix.core.modules.eql.jxb.history.Ifg) _ifgList.get(
                index);
    } //-- com.queplix.core.modules.eql.jxb.history.Ifg getIfg(int) 

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

    /**
     * Method getIfgCount
     *
     * @return int
     */
    public int getIfgCount() {
        return _ifgList.size();
    } //-- int getIfgCount() 

    /**
     * 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 removeIfg
     *
     * @param vIfg
     * @return boolean
     */
    public boolean removeIfg(
            com.queplix.core.modules.eql.jxb.history.Ifg vIfg) {
        boolean removed = _ifgList.remove(vIfg);
        return removed;
    } //-- boolean removeIfg(com.queplix.core.modules.eql.jxb.history.Ifg) 

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

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

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

}
