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


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

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

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


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

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


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

    /**
     * Method addAttrib
     * 
     * @param vAttrib
     */
    public void addAttrib(nz.co.cks.tms.xml.Attrib vAttrib)
        throws java.lang.IndexOutOfBoundsException
    {
        _attribList.addElement(vAttrib);
    } //-- void addAttrib(nz.co.cks.tms.xml.Attrib) 

    /**
     * Method addAttrib
     * 
     * @param index
     * @param vAttrib
     */
    public void addAttrib(int index, nz.co.cks.tms.xml.Attrib vAttrib)
        throws java.lang.IndexOutOfBoundsException
    {
        _attribList.insertElementAt(vAttrib, index);
    } //-- void addAttrib(int, nz.co.cks.tms.xml.Attrib) 

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

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

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

    /**
     * Method getAttribCount
     */
    public int getAttribCount()
    {
        return _attribList.size();
    } //-- int getAttribCount() 

    /**
     * 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 isValid
     */
    public boolean isValid()
    {
        try {
            validate();
        }
        catch (org.exolab.castor.xml.ValidationException vex) {
            return false;
        }
        return true;
    } //-- boolean isValid() 

    /**
     * Method removeAllAttrib
     */
    public void removeAllAttrib()
    {
        _attribList.removeAllElements();
    } //-- void removeAllAttrib() 

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

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

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

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

}
