/*
 * 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 ResponseEnquiryItemType.
 * 
 * @version $Revision$ $Date$
 */
public abstract class ResponseEnquiryItemType 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 _itemCostList
     */
    private java.util.Vector _itemCostList;


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

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


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

    /**
     * Method addItemCost
     * 
     * @param vItemCost
     */
    public void addItemCost(nz.co.cks.tms.xml.ItemCost vItemCost)
        throws java.lang.IndexOutOfBoundsException
    {
        _itemCostList.addElement(vItemCost);
    } //-- void addItemCost(nz.co.cks.tms.xml.ItemCost) 

    /**
     * Method addItemCost
     * 
     * @param index
     * @param vItemCost
     */
    public void addItemCost(int index, nz.co.cks.tms.xml.ItemCost vItemCost)
        throws java.lang.IndexOutOfBoundsException
    {
        _itemCostList.insertElementAt(vItemCost, index);
    } //-- void addItemCost(int, nz.co.cks.tms.xml.ItemCost) 

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

    /**
     * Method getItemCost
     * 
     * @param index
     */
    public nz.co.cks.tms.xml.ItemCost getItemCost(int index)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _itemCostList.size())) {
            throw new IndexOutOfBoundsException();
        }
        
        return (nz.co.cks.tms.xml.ItemCost) _itemCostList.elementAt(index);
    } //-- nz.co.cks.tms.xml.ItemCost getItemCost(int) 

    /**
     * Method getItemCost
     */
    public nz.co.cks.tms.xml.ItemCost[] getItemCost()
    {
        int size = _itemCostList.size();
        nz.co.cks.tms.xml.ItemCost[] mArray = new nz.co.cks.tms.xml.ItemCost[size];
        for (int index = 0; index < size; index++) {
            mArray[index] = (nz.co.cks.tms.xml.ItemCost) _itemCostList.elementAt(index);
        }
        return mArray;
    } //-- nz.co.cks.tms.xml.ItemCost[] getItemCost() 

    /**
     * Method getItemCostCount
     */
    public int getItemCostCount()
    {
        return _itemCostList.size();
    } //-- int getItemCostCount() 

    /**
     * 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 removeAllItemCost
     */
    public void removeAllItemCost()
    {
        _itemCostList.removeAllElements();
    } //-- void removeAllItemCost() 

    /**
     * Method removeItemCost
     * 
     * @param index
     */
    public nz.co.cks.tms.xml.ItemCost removeItemCost(int index)
    {
        java.lang.Object obj = _itemCostList.elementAt(index);
        _itemCostList.removeElementAt(index);
        return (nz.co.cks.tms.xml.ItemCost) obj;
    } //-- nz.co.cks.tms.xml.ItemCost removeItemCost(int) 

    /**
     * Method setItemCost
     * 
     * @param index
     * @param vItemCost
     */
    public void setItemCost(int index, nz.co.cks.tms.xml.ItemCost vItemCost)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _itemCostList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _itemCostList.setElementAt(vItemCost, index);
    } //-- void setItemCost(int, nz.co.cks.tms.xml.ItemCost) 

    /**
     * Method setItemCost
     * 
     * @param itemCostArray
     */
    public void setItemCost(nz.co.cks.tms.xml.ItemCost[] itemCostArray)
    {
        //-- copy array
        _itemCostList.removeAllElements();
        for (int i = 0; i < itemCostArray.length; i++) {
            _itemCostList.addElement(itemCostArray[i]);
        }
    } //-- void setItemCost(nz.co.cks.tms.xml.ItemCost) 

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

}
