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

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

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

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

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

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

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

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

    /**
     * Method addHistoryField
     *
     * @param vHistoryField
     */
    public void addHistoryField(
            com.queplix.core.modules.eql.jxb.history.HistoryField vHistoryField)
            throws java.lang.IndexOutOfBoundsException {
        _historyFieldList.add(vHistoryField);
    } //-- void addHistoryField(com.queplix.core.modules.eql.jxb.history.HistoryField) 

    /**
     * Method addHistoryField
     *
     * @param index
     * @param vHistoryField
     */
    public void addHistoryField(int index,
                                com.queplix.core.modules.eql.jxb.history.HistoryField vHistoryField)
            throws java.lang.IndexOutOfBoundsException {
        _historyFieldList.add(index, vHistoryField);
    } //-- void addHistoryField(int, com.queplix.core.modules.eql.jxb.history.HistoryField) 

    /**
     * Method addPkeyField
     *
     * @param vPkeyField
     */
    public void addPkeyField(
            com.queplix.core.modules.eql.jxb.history.PkeyField vPkeyField)
            throws java.lang.IndexOutOfBoundsException {
        _pkeyFieldList.add(vPkeyField);
    } //-- void addPkeyField(com.queplix.core.modules.eql.jxb.history.PkeyField) 

    /**
     * Method addPkeyField
     *
     * @param index
     * @param vPkeyField
     */
    public void addPkeyField(int index,
                             com.queplix.core.modules.eql.jxb.history.PkeyField vPkeyField)
            throws java.lang.IndexOutOfBoundsException {
        _pkeyFieldList.add(index, vPkeyField);
    } //-- void addPkeyField(int, com.queplix.core.modules.eql.jxb.history.PkeyField) 

    /**
     * Method clearHistoryField
     */
    public void clearHistoryField() {
        _historyFieldList.clear();
    } //-- void clearHistoryField() 

    /**
     * Method clearPkeyField
     */
    public void clearPkeyField() {
        _pkeyFieldList.clear();
    } //-- void clearPkeyField() 

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

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

    /**
     * Returns the value of field 'action'.
     *
     * @return the value of field 'action'.
     */
    public java.lang.String getAction() {
        return this._action;
    } //-- java.lang.String getAction() 

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

        return (com.queplix.core.modules.eql.jxb.history.HistoryField) _historyFieldList
                .get(index);
    } //-- com.queplix.core.modules.eql.jxb.history.HistoryField getHistoryField(int) 

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

    /**
     * Method getHistoryFieldCount
     *
     * @return int
     */
    public int getHistoryFieldCount() {
        return _historyFieldList.size();
    } //-- int getHistoryFieldCount() 

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

        return (com.queplix.core.modules.eql.jxb.history.PkeyField) _pkeyFieldList
                .get(index);
    } //-- com.queplix.core.modules.eql.jxb.history.PkeyField getPkeyField(int) 

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

    /**
     * Method getPkeyFieldCount
     *
     * @return int
     */
    public int getPkeyFieldCount() {
        return _pkeyFieldList.size();
    } //-- int getPkeyFieldCount() 

    /**
     * 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 removeHistoryField
     *
     * @param vHistoryField
     * @return boolean
     */
    public boolean removeHistoryField(
            com.queplix.core.modules.eql.jxb.history.HistoryField vHistoryField) {
        boolean removed = _historyFieldList.remove(vHistoryField);
        return removed;
    } //-- boolean removeHistoryField(com.queplix.core.modules.eql.jxb.history.HistoryField) 

    /**
     * Method removePkeyField
     *
     * @param vPkeyField
     * @return boolean
     */
    public boolean removePkeyField(
            com.queplix.core.modules.eql.jxb.history.PkeyField vPkeyField) {
        boolean removed = _pkeyFieldList.remove(vPkeyField);
        return removed;
    } //-- boolean removePkeyField(com.queplix.core.modules.eql.jxb.history.PkeyField) 

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

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

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

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

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

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

}
