/*
 * 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 EnquiryNcbAddressType.
 * 
 * @version $Revision$ $Date$
 */
public abstract class EnquiryNcbAddressType implements java.io.Serializable {


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

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

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

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


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

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


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

    /**
     * Method addNcbAddress
     * 
     * @param vNcbAddress
     */
    public void addNcbAddress(nz.co.cks.tms.xml.NcbAddress vNcbAddress)
        throws java.lang.IndexOutOfBoundsException
    {
        _ncbAddressList.addElement(vNcbAddress);
    } //-- void addNcbAddress(nz.co.cks.tms.xml.NcbAddress) 

    /**
     * Method addNcbAddress
     * 
     * @param index
     * @param vNcbAddress
     */
    public void addNcbAddress(int index, nz.co.cks.tms.xml.NcbAddress vNcbAddress)
        throws java.lang.IndexOutOfBoundsException
    {
        _ncbAddressList.insertElementAt(vNcbAddress, index);
    } //-- void addNcbAddress(int, nz.co.cks.tms.xml.NcbAddress) 

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

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

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

    /**
     * Method getNcbAddressCount
     */
    public int getNcbAddressCount()
    {
        return _ncbAddressList.size();
    } //-- int getNcbAddressCount() 

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

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

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

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

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

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

}
