/*
 * This class was automatically generated with 
 * <a href="http://www.castor.org">Castor 0.9.4.3</a>, using an XML
 * Schema.
 * $Id$
 */

package nz.co.cks.tms.xml;

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

import java.io.Reader;
import java.io.Serializable;
import java.io.Writer;
import java.util.Enumeration;
import java.util.Vector;
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;
import org.exolab.castor.xml.ValidationException;

/**
 * Class EnquiryItemType.
 * 
 * @version $Revision$ $Date$
 */
public abstract class EnquiryItemType implements java.io.Serializable {


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

    /**
     * Field _ncbId
     */
    private int _ncbId;

    /**
     * keeps track of state for field: _ncbId
     */
    private boolean _has_ncbId;

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

    /**
     * Field _itemCodeList
     */
    private java.util.Vector _itemCodeList;


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

    public EnquiryItemType() {
        super();
        _itemCodeList = new Vector();
    } //-- nz.co.cks.tms.xml.EnquiryItemType()


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

    /**
     * Method addItemCode
     * 
     * @param vItemCode
     */
    public void addItemCode(java.lang.String vItemCode)
        throws java.lang.IndexOutOfBoundsException
    {
        _itemCodeList.addElement(vItemCode);
    } //-- void addItemCode(java.lang.String) 

    /**
     * Method addItemCode
     * 
     * @param index
     * @param vItemCode
     */
    public void addItemCode(int index, java.lang.String vItemCode)
        throws java.lang.IndexOutOfBoundsException
    {
        _itemCodeList.insertElementAt(vItemCode, index);
    } //-- void addItemCode(int, java.lang.String) 

    /**
     * Method enumerateItemCode
     */
    public java.util.Enumeration enumerateItemCode()
    {
        return _itemCodeList.elements();
    } //-- java.util.Enumeration enumerateItemCode() 

    /**
     * Method getItemCode
     * 
     * @param index
     */
    public java.lang.String getItemCode(int index)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _itemCodeList.size())) {
            throw new IndexOutOfBoundsException();
        }
        
        return (String)_itemCodeList.elementAt(index);
    } //-- java.lang.String getItemCode(int) 

    /**
     * Method getItemCode
     */
    public java.lang.String[] getItemCode()
    {
        int size = _itemCodeList.size();
        java.lang.String[] mArray = new java.lang.String[size];
        for (int index = 0; index < size; index++) {
            mArray[index] = (String)_itemCodeList.elementAt(index);
        }
        return mArray;
    } //-- java.lang.String[] getItemCode() 

    /**
     * Method getItemCodeCount
     */
    public int getItemCodeCount()
    {
        return _itemCodeList.size();
    } //-- int getItemCodeCount() 

    /**
     * Method getNcbIdReturns the value of field 'ncbId'.
     * 
     * @return the value of field 'ncbId'.
     */
    public int getNcbId()
    {
        return this._ncbId;
    } //-- int getNcbId() 

    /**
     * Method getServiceCodeReturns the value of field
     * 'serviceCode'.
     * 
     * @return the value of field 'serviceCode'.
     */
    public java.lang.String getServiceCode()
    {
        return this._serviceCode;
    } //-- java.lang.String getServiceCode() 

    /**
     * Method hasNcbId
     */
    public boolean hasNcbId()
    {
        return this._has_ncbId;
    } //-- boolean hasNcbId() 

    /**
     * Method isValid
     */
    public boolean isValid()
    {
        try {
            validate();
        }
        catch (org.exolab.castor.xml.ValidationException vex) {
            return false;
        }
        return true;
    } //-- boolean isValid() 

    /**
     * Method removeAllItemCode
     */
    public void removeAllItemCode()
    {
        _itemCodeList.removeAllElements();
    } //-- void removeAllItemCode() 

    /**
     * Method removeItemCode
     * 
     * @param index
     */
    public java.lang.String removeItemCode(int index)
    {
        java.lang.Object obj = _itemCodeList.elementAt(index);
        _itemCodeList.removeElementAt(index);
        return (String)obj;
    } //-- java.lang.String removeItemCode(int) 

    /**
     * Method setItemCode
     * 
     * @param index
     * @param vItemCode
     */
    public void setItemCode(int index, java.lang.String vItemCode)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _itemCodeList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _itemCodeList.setElementAt(vItemCode, index);
    } //-- void setItemCode(int, java.lang.String) 

    /**
     * Method setItemCode
     * 
     * @param itemCodeArray
     */
    public void setItemCode(java.lang.String[] itemCodeArray)
    {
        //-- copy array
        _itemCodeList.removeAllElements();
        for (int i = 0; i < itemCodeArray.length; i++) {
            _itemCodeList.addElement(itemCodeArray[i]);
        }
    } //-- void setItemCode(java.lang.String) 

    /**
     * Method setNcbIdSets the value of field 'ncbId'.
     * 
     * @param ncbId the value of field 'ncbId'.
     */
    public void setNcbId(int ncbId)
    {
        this._ncbId = ncbId;
        this._has_ncbId = true;
    } //-- void setNcbId(int) 

    /**
     * Method setServiceCodeSets the value of field 'serviceCode'.
     * 
     * @param serviceCode the value of field 'serviceCode'.
     */
    public void setServiceCode(java.lang.String serviceCode)
    {
        this._serviceCode = serviceCode;
    } //-- void setServiceCode(java.lang.String) 

    /**
     * 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() 

}
