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


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

    /**
     * Field _paymentAmount
     */
    private java.math.BigDecimal _paymentAmount;

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

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

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

    /**
     * Field _cardInfo
     */
    private nz.co.cks.tms.xml.CardInfo _cardInfo;

    /**
     * Field _ncb
     */
    private nz.co.cks.tms.xml.Ncb _ncb;

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

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


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

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


      //-----------/
     //- 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 addPurchaseItem
     * 
     * @param vPurchaseItem
     */
    public void addPurchaseItem(nz.co.cks.tms.xml.PurchaseItem vPurchaseItem)
        throws java.lang.IndexOutOfBoundsException
    {
        _purchaseItemList.addElement(vPurchaseItem);
    } //-- void addPurchaseItem(nz.co.cks.tms.xml.PurchaseItem) 

    /**
     * Method addPurchaseItem
     * 
     * @param index
     * @param vPurchaseItem
     */
    public void addPurchaseItem(int index, nz.co.cks.tms.xml.PurchaseItem vPurchaseItem)
        throws java.lang.IndexOutOfBoundsException
    {
        _purchaseItemList.insertElementAt(vPurchaseItem, index);
    } //-- void addPurchaseItem(int, nz.co.cks.tms.xml.PurchaseItem) 

    /**
     * Method deleteNcbId
     */
    public void deleteNcbId()
    {
        this._has_ncbId= false;
    } //-- void deleteNcbId() 

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

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

    /**
     * Method getCardInfoReturns the value of field 'cardInfo'.
     * 
     * @return the value of field 'cardInfo'.
     */
    public nz.co.cks.tms.xml.CardInfo getCardInfo()
    {
        return this._cardInfo;
    } //-- nz.co.cks.tms.xml.CardInfo getCardInfo() 

    /**
     * Method getNcbReturns the value of field 'ncb'.
     * 
     * @return the value of field 'ncb'.
     */
    public nz.co.cks.tms.xml.Ncb getNcb()
    {
        return this._ncb;
    } //-- nz.co.cks.tms.xml.Ncb getNcb() 

    /**
     * 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 getPaymentAmountReturns the value of field
     * 'paymentAmount'.
     * 
     * @return the value of field 'paymentAmount'.
     */
    public java.math.BigDecimal getPaymentAmount()
    {
        return this._paymentAmount;
    } //-- java.math.BigDecimal getPaymentAmount() 

    /**
     * Method getPaymentCurrencyCodeReturns the value of field
     * 'paymentCurrencyCode'.
     * 
     * @return the value of field 'paymentCurrencyCode'.
     */
    public java.lang.String getPaymentCurrencyCode()
    {
        return this._paymentCurrencyCode;
    } //-- java.lang.String getPaymentCurrencyCode() 

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

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

    /**
     * Method getPurchaseItemCount
     */
    public int getPurchaseItemCount()
    {
        return _purchaseItemList.size();
    } //-- int getPurchaseItemCount() 

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

    /**
     * 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 removePurchaseItem
     * 
     * @param index
     */
    public nz.co.cks.tms.xml.PurchaseItem removePurchaseItem(int index)
    {
        java.lang.Object obj = _purchaseItemList.elementAt(index);
        _purchaseItemList.removeElementAt(index);
        return (nz.co.cks.tms.xml.PurchaseItem) obj;
    } //-- nz.co.cks.tms.xml.PurchaseItem removePurchaseItem(int) 

    /**
     * Method setCardInfoSets the value of field 'cardInfo'.
     * 
     * @param cardInfo the value of field 'cardInfo'.
     */
    public void setCardInfo(nz.co.cks.tms.xml.CardInfo cardInfo)
    {
        this._cardInfo = cardInfo;
    } //-- void setCardInfo(nz.co.cks.tms.xml.CardInfo) 

    /**
     * Method setNcbSets the value of field 'ncb'.
     * 
     * @param ncb the value of field 'ncb'.
     */
    public void setNcb(nz.co.cks.tms.xml.Ncb ncb)
    {
        this._ncb = ncb;
    } //-- void setNcb(nz.co.cks.tms.xml.Ncb) 

    /**
     * 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 setPaymentAmountSets the value of field
     * 'paymentAmount'.
     * 
     * @param paymentAmount the value of field 'paymentAmount'.
     */
    public void setPaymentAmount(java.math.BigDecimal paymentAmount)
    {
        this._paymentAmount = paymentAmount;
    } //-- void setPaymentAmount(java.math.BigDecimal) 

    /**
     * Method setPaymentCurrencyCodeSets the value of field
     * 'paymentCurrencyCode'.
     * 
     * @param paymentCurrencyCode the value of field
     * 'paymentCurrencyCode'.
     */
    public void setPaymentCurrencyCode(java.lang.String paymentCurrencyCode)
    {
        this._paymentCurrencyCode = paymentCurrencyCode;
    } //-- void setPaymentCurrencyCode(java.lang.String) 

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

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

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

}
