/*******************************************************************************
 *  Copyright 2017 Centre for Development of Advanced Computing(C-DAC), Pune
 *  
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *  
 *    http://www.apache.org/licenses/LICENSE-2.0
 *  
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *******************************************************************************/
package cdac.medinfo.sdk.hl7282.baselibs;

import cdac.medinfo.sdk.hl7282.baselibs.segmentfactory.DataElementFactory;
import cdac.medinfo.sdk.hl7282.commoninterface.IDataType;
import cdac.medinfo.sdk.hl7282.commoninterface.ISingleCollection;
import cdac.medinfo.sdk.hl7282.exceptions.InvalidComponentTypeException;
import cdac.medinfo.sdk.hl7282.exceptions.InvalidDataTypeException;
import cdac.medinfo.sdk.hl7282.exceptions.MissingValueException;
import cdac.medinfo.sdk.hl7282.utils.EnumDataType;
import cdac.medinfo.sdk.hl7282.utils.IDataTypeMap;

/**
 * CNE - Coded with No Exceptions<p>
 * This data type specifies a coded element and its associated detail. 
 * The CNE data type is used when a required or mandatory coded field is needed
 * <p>Represents an HL7 CNE data type. 
 * This data type has the following attributes:</p><p>
 *  1. identifier (ST)<b>Required</b><br>
 *  2. text (ST)<b>Optional</b><br>
 *  3. name of coding system (ID)<b>Optional</b><br>
 *  4. alternate identifier (ST)<b>Optional</b><br>
 *  5. alternate text (ST)<b>Optional</b><br>
 *  6. name of alternate coding system (ST)<b>Optional</b><br>
 *  7. coding system version ID (ST)<b>Conditional</b><br>
 *  8. alternate coding system version ID (ST)<b>Optional</b><br>
 *  9. original text (ST)<b>Optional</b><br><p>
 *  10. Second Alternate Identifier (ST)<b>Optional</b><br><p>
 *  11. Second Alternate Text (ST)<b>Optional</b><br><p>
 *  12. Name of Second Alternate Coding System (ID)<b>Optional</b><br><p>
 *  13. Second Alternate Coding System Version ID (ST)<b>Conditional</b><br><p>
 *  14. Coding System OID (ST)<b>Conditional</b><br><p>
 *  15. Value Set OID (ST)<b>Optional</b><br><p>
 *  16. Value Set Version ID (DTM)<b>Conditional</b><br><p>
 *  17. Alternate Coding System OID (ST)<b>Conditional</b><br><p>
 *  18. Alternate Value Set OID (ST)<b>Optional</b><br><p>
 *  19. Alternate Value Set Version ID (DTM)<b>Conditional</b><br><p>
 *  20. Second Alternate Coding System OID (ST)<b>COnditional</b><br><p>
 *  21.  Second Alternate Value Set OID (ST)<b>Optional</b><br><p>
 *  22. Second Alternate Value Set Version ID (DTM)<b>Conditional</b><br><p>
 * This class provides accessors & mutators for the elements mentioned above.
 * This class override the equal method, to check whether some other object is "equal to" this one.
 * 
 * <p>User can also create Data Type through {@link DataElementFactory} 
 */
public class CNE extends CompositeDataType    
{
	


	/**
	 * Default Constructor for CNE
	 */
	public CNE()
	{
		super(EnumDataType.HL7_DT_CNE);
		 
	}

	/**
	 * Constructor  for CNE class which takes four arguments and 
	 * sets the value in the respective member variable.
	 * @param iMinLength The Minimum length the DataType can have.
	 * @param iMaxLength The Maximum length the DataType can have.
	 * @param iCLength The Conformance length the DataType can have.
	 * @param iComponentType The Type of the component i.e Component or a subcomponent.
	 * @throws InvalidComponentTypeException - if Component Type is not specified or valid. 
	 */ 
	public CNE(int iMinLength, int iMaxLength, String strCLength,int iComponentType) throws InvalidComponentTypeException
	{
		super(EnumDataType.HL7_DT_CNE);
		this.iMinLength = iMinLength;
		this.iMaxLength = iMaxLength;
		this.iConformanceLength = strCLength;
		this.iComponentType = iComponentType;
		if(!isValidComponentType())
		{
			throw new InvalidComponentTypeException(this.getClass().getSimpleName());
		}
	}


	/**
	 * Constructor for CNE class which takes five arguments and 
	 * sets the value in the respective member variable.
	 * @param iMinLength The Minimum length the DataType can have.
	 * @param iMaxLength The Maximum length the DataType can have.
	 * @param iCLength The Conformance length the DataType can have.
	 * @param iTableNo The Table number to which the value for the component is specified. 
	 * @param iComponentType The Type of the component i.e Component or a subcomponent.
	 * @throws InvalidComponentTypeException - if Component Type is not specified or valid. 
	 */
	public CNE(int iMinLength, int iMaxLength, String strCLength,int iTableNo,int iComponentType) throws InvalidComponentTypeException
	{
		super(EnumDataType.HL7_DT_CNE);
		this.iMinLength = iMinLength;
		this.iMaxLength = iMaxLength;
		this.iConformanceLength = strCLength;
		this.iTableNo = iTableNo;
		this.iComponentType = iComponentType;
		if(!isValidComponentType())
		{
			throw new InvalidComponentTypeException(this.getClass().getSimpleName());		
		}
	}
	/**
	 * Constructor for CNE class which takes two arguments and 
	 * sets the value in the respective member variable.
	 * @param objIDataTypeMap object of Data Type Map.
	 * @param iComponentType The Type of the component i.e Component or a subcomponent.
	 * @throws InvalidComponentTypeException - if Component Type is not specified or valid. 
	 */
	public CNE(int iComponentType,IDataTypeMap objIDataTypeMap)
	{
		super(EnumDataType.HL7_DT_CNE);
		this.objIDataTypeMap = objIDataTypeMap;
		this.iComponentType = iComponentType;
		if(!isValidComponentType())
		{
			throw new InvalidComponentTypeException(this.getClass().getSimpleName());
		}
	}
	/**
	 * Constructor for CNE class which takes five arguments and 
	 * sets the value in the respective member variable.
	 * @param objIDataTypeMap object of Data Type Map.
	 * @param iComponentType The Type of the component i.e Component or a subcomponent.
	 * @param iMinLength The Minimum length the DataType can have.
	 * @param iMaxLength The Maximum length the DataType can have.
	 * @param iCLength The Conformance length the DataType can have.
	 * @throws InvalidComponentTypeException - if Component Type is not specified or valid. 
	 */
	public CNE(int iComponentType,int iMinLength, int iMaxLength, String strCLength,IDataTypeMap objIDataTypeMap)
	{
		super(EnumDataType.HL7_DT_CNE);
		this.objIDataTypeMap = objIDataTypeMap;
		this.iComponentType = iComponentType;
		this.iMinLength = iMinLength;
		this.iMaxLength = iMaxLength;
		this.iConformanceLength = strCLength;

		if(!isValidComponentType())
		{
			throw new InvalidComponentTypeException(this.getClass().getSimpleName());
		}
	}
	/**
	 * Constructor for CNE class which takes six arguments and 
	 * sets the value in the respective member variable.
	 * @param objIDataTypeMap object of Data Type Map.
	 * @param iComponentType The Type of the component i.e Component or a subcomponent.
	 * @param iMinLength The Minimum length the DataType can have.
	 * @param iMaxLength The Maximum length the DataType can have.
	 * @param iCLength The Conformance length the DataType can have.
	 * @param iTableNo The Table number to which the value for the component is specified. 
	 * @throws InvalidComponentTypeException - if Component Type is not specified or valid. 
	 */
	public CNE(int iComponentType,int iMinLength, int iMaxLength, String strCLength,int ITableNo,IDataTypeMap objIDataTypeMap)
	{
		super(EnumDataType.HL7_DT_CNE);
		this.objIDataTypeMap = objIDataTypeMap;
		this.iComponentType = iComponentType;
		this.iTableNo = ITableNo;
		this.iMinLength = iMinLength;
		this.iMaxLength = iMaxLength;
		this.iConformanceLength = strCLength;

		if(!isValidComponentType())
		{
			throw new InvalidComponentTypeException(this.getClass().getSimpleName());
		}
	}

	/**
	 *Sets the Identifier.
	 *@param strIdentifier Specifies sequence of characters (the code) that uniquely identifies the item being referenced by the CNE. 
	 */
	public void setIdentifier(String strIdentifier)
	{
		if(strIdentifier!=null)
			setComponentType(1, strIdentifier);
		else
			setIdentifier((ST)null);
	}

	/**
	 *Sets the Identifier.
	 *@param objST Specifies sequence of characters (the code) that uniquely identifies the item being referenced by the CNE.
	 */
	public void setIdentifier(ST objST)
	{
		setComponentType(1,objST);
	}

	/**
	 *Sets the Text
	 *@param strText Specifies descriptive or textual name of the identifier, e.g., myocardial infarction 
	 */
	public void setText(String strText)
	{
		if(strText!=null)
			setComponentType(2, strText);
		else
			setText((ST)null);
	}

	/**
	 *Sets the Text
	 *@param objST Specifies descriptive or textual name of the identifier, e.g., myocardial infarction
	 */
	public void setText(ST objST)
	{
		setComponentType(2,objST);
	}

	/**
	 *Sets the Name Of Coding System.
	 *@param strNameOfCodingSystem Specifies the coding scheme being used in the identifier component. 
	 */
	public void setNameOfCodingSystem(String strNameOfCodingSystem)
	{
		if(strNameOfCodingSystem!=null)
			setComponentType(3, strNameOfCodingSystem);
		else
			setNameOfCodingSystem((ID)null);
	}

	/**
	 *Sets the Name Of Coding System.
	 *@param objID Specifies the coding scheme being used in the identifier component.
	 */
	public void setNameOfCodingSystem(ID objID)
	{
		setComponentType(3,objID);
	}

	/**
	 *Sets the Alternate Identifier.
	 *@param strAlternateIdentifier Specifies the local or user seen code as described. 
	 */
	public void setAlternateIdentifier(String strAlternateIdentifier)
	{
		if(strAlternateIdentifier!=null)
			setComponentType(4, strAlternateIdentifier);
		else
			setAlternateIdentifier((ST)null);
	}

	/**
	 *Sets the Alternate Identifier.
	 *@param objST Specifies the local or user seen code as described.
	 */
	public void setAlternateIdentifier(ST objST)
	{
		setComponentType(4,objST);
	}

	/**
	 *Sets the Alternate Text.
	 *@param strAlternateText Specifies descriptive or textual name of the alternate identifier. 
	 */
	public void setAlternateText(String strAlternateText)
	{
		if(strAlternateText!=null)
			setComponentType(5, strAlternateText);
		else
			setAlternateIdentifier((ST)null);
	}

	/**
	 *Sets the Alternate Text.
	 *@param objST Specifies descriptive or textual name of the alternate identifier.
	 */
	public void setAlternateText(ST objST)
	{
		setComponentType(5,objST);
	}

	/**
	 *Sets the Name Of Alternate Coding System.
	 *@param strNameOfAlternateCodingSystem  Name Of Alternate Coding System.
	 */
	public void setNameOfAlternateCodingSystem(String strNameOfAlternateCodingSystem)
	{
		if(strNameOfAlternateCodingSystem!=null)
			setComponentType(6, strNameOfAlternateCodingSystem);
		else
			setNameOfAlternateCodingSystem((ID)null);
	}

	/**
	 *Sets the Name Of Alternate Coding System.
	 *@param objID represents Name Of Alternate Coding System.
	 */
	public void setNameOfAlternateCodingSystem(ID objID)
	{
		setComponentType(6,objID);
	}

	/**
	 *Sets the Coding System Version ID.
	 *@param strCodingSystemVersionID Specifies the version ID for the coding system. 
	 */
	public void setCodingSystemVersionID(String strCodingSystemVersionID)
	{
		if(strCodingSystemVersionID!=null)
			setComponentType(7, strCodingSystemVersionID);
		else
			setAlternateIdentifier((ST)null);
	}

	/**
	 *Sets the Coding System Version ID.
	 *@param objST Specifies the version ID for the coding system.
	 */
	public void setCodingSystemVersionID(ST objST)
	{
		setComponentType(7,objST);
	}

	/**
	 *Sets the Alternate Coding System Version ID.
	 *@param strAlternateCodingSystemVersionID Specifies the version ID for the coding system. 
	 */
	public void setAlternateCodingSystemVersionID(String strAlternateCodingSystemVersionID)
	{
		if(strAlternateCodingSystemVersionID!=null)
			setComponentType(8, strAlternateCodingSystemVersionID);
		else
			setAlternateIdentifier((ST)null);
	}

	/**
	 *Sets the Alternate Coding System Version ID.
	 *@param objST Specifies the version ID for the coding system.
	 */
	public void setAlternateCodingSystemVersionID(ST objST)
	{
		setComponentType(8,objST);
	}

	/**
	 *Sets the Original Text.
	 *@param strOriginalText Specifies the original text that was available to an automated process or a human 
	 * 							before a specific code was assigned.
	 */
	public void setOriginalText(String strOriginalText)
	{
		if(strOriginalText!=null)
			setComponentType(9, strOriginalText);
		else
			setAlternateIdentifier((ST)null);
	}

	/**
	 *Sets the Original Text.
	 *@param objST Specifies the original text that was available to an automated process or a human 
	 * 							before a specific code was assigned.
	 */
	public void setOriginalText(ST objST)
	{
		setComponentType(9,objST);
	}

	/**
	 *Sets the Second Alternate Identifier.
	 *@param strSecondAlternateIdentifier Specifies A sequence of characters that uniquely identifies a second alternate code.
	 */
	public void setSecondAlternateIdentifier(String strSecondAlternateIdentifier)
	{
		if(strSecondAlternateIdentifier!=null)
			setComponentType(10, strSecondAlternateIdentifier);
		else
			setSecondAlternateIdentifier((ST)null);
	}

	/**
	 *Sets the Second Alternate Identifier.
	 *@param objST Specifies A sequence of characters that uniquely identifies a second alternate code. 
	 */
	public void setSecondAlternateIdentifier(ST objST)
	{
		setComponentType(10,objST);
	}
	
	/**
	 *Sets the Second Alternate Text.
	 *@param strSecond Alternate Text Specifies A sequence of characters that uniquely identifies a second alternate code.
	 */
	public void setSecondAlternateText(String strSecondAlternateText)
	{
		if(strSecondAlternateText!=null)
			setComponentType(11, strSecondAlternateText);
		else
			setSecondAlternateText((ST)null);
	}

	/**
	 *Sets the Second Alternate Text.
	 *@param objST Specifies A sequence of characters that uniquely identifies a second alternate code. 
	 */
	public void setSecondAlternateText(ST objST)
	{
		setComponentType(11,objST);
	}
	
	/**
	 *Sets the Name of Second Alternate Coding System.
	 *@param strSecond descriptive or textual name of the Second Alternate Identifier.
	 */
	public void setNameofSecondAlternateCodingSystem(String strNameofSecondAlternateCodingSystem)
	{
		if(strNameofSecondAlternateCodingSystem!=null)
			setComponentType(12, strNameofSecondAlternateCodingSystem);
		else
			setNameofSecondAlternateCodingSystem((ID)null);
	}

	/**
	 *Sets the Name of Second Alternate Coding System.
	 *@param objID Specifies descriptive or textual name of the Second Alternate Identifier. 
	 */
	public void setNameofSecondAlternateCodingSystem(ID objID)
	{
		setComponentType(12,objID);
	}
	
	/**
	 *Sets the Second Alternate Coding System Version ID.
	 *@param strSecond carries the version for the coding system identified by components 10-12.
	 */
	public void setSecondAlternateCodingSystemVersionID(String strSecondAlternateCodingSystemVersionID)
	{
		if(strSecondAlternateCodingSystemVersionID!=null)
			setComponentType(13, strSecondAlternateCodingSystemVersionID);
		else
			setSecondAlternateCodingSystemVersionID((ST)null);
	}

	/**
	 *Sets the Second Alternate Coding System Version ID.
	 *@param objST carries the version for the coding system identified by components 10-12. 
	 */
	public void setSecondAlternateCodingSystemVersionID(ST objST)
	{
		setComponentType(13,objST);
	}
	
	/**
	 *Sets the Coding System OID.
	 *@param strCodingSystemOID contains the ISO Object Identifier (OID) for the coding system.
	 */
	public void setCodingSystemOID(String strCodingSystemOID)
	{
		if(strCodingSystemOID!=null)
			setComponentType(14, strCodingSystemOID);
		else
			setCodingSystemOID((ST)null);
	}

	/**
	 *Sets the Coding System OID.
	 *@param objST contains the ISO Object Identifier (OID) for the coding system. 
	 */
	public void setCodingSystemOID(ST objST)
	{
		setComponentType(14,objST);
	}
	
	/**
	 *Sets the Value Set OID.
	 *@param strValueSetOID contains the ISO Object Identifier (OID) to allow identification of the value set.
	 */
	public void setValueSetOID(String strValueSetOID )
	{
		if(strValueSetOID !=null)
			setComponentType(15, strValueSetOID );
		else
			setValueSetOID((ST)null);
	}

	/**
	 *Sets the Value Set OID.
	 *@param objST contains the ISO Object Identifier (OID) to allow identification of the value set.
	 */
	public void setValueSetOID (ST objST)
	{
		setComponentType(15,objST);
	}
	
	/**
	 *Sets the Value Set Version ID.
	 *@param strValueSetVersionID carries the version for the value set identified by Value Set OID.
	 */
	public void setValueSetVersionID(String strValueSetVersionID)
	{
		if(strValueSetVersionID !=null)
			setComponentType(16, strValueSetVersionID);
		else
			setValueSetVersionID((DTM)null);
	}

	/**
	 *Sets the Value Set Version ID.
	 *@param objDTM carries the version for the value set identified by Value Set OID.
	 */
	public void setValueSetVersionID (DTM objDTM)
	{
		setComponentType(16,objDTM);
	}
	
	/**
	 *Sets the Alternate Coding System OID.
	 *@param strAlternateCodingSystemOID contains the ISO Object Identifier (OID) for the coding system or value set named in CNE.6 (Name of the Alternate Coding System).
	 */
	public void setAlternateCodingSystemOID(String strAlternateCodingSystemOID)
	{
		if(strAlternateCodingSystemOID !=null)
			setComponentType(17, strAlternateCodingSystemOID);
		else
			setAlternateCodingSystemOID((ST)null);
	}

	/**
	 *Sets the Alternate Coding System OID.
	 *@param objST contains the ISO Object Identifier (OID) for the coding system or value set named in CNE.6 (Name of the Alternate Coding System).
	 */
	public void setAlternateCodingSystemOID(ST objST)
	{
		setComponentType(17,objST);
	}
	
	/**
	 *Sets the Alternate Value Set OID.
	 *@param strAlternateValueSetOID contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CNE.4 (Alternate Identifier) is obtained.
	 */
	public void setAlternateValueSetOID(String strAlternateValueSetOID)
	{
		if(strAlternateValueSetOID !=null)
			setComponentType(18, strAlternateValueSetOID);
		else
			setAlternateValueSetOID((ST)null);
	}

	/**
	 *Sets the Alternate Value Set OID.
	 *@param objST contains contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CNE.4 (Alternate Identifier) is obtained.
	 */
	public void setAlternateValueSetOID(ST objST)
	{
		setComponentType(18,objST);
	}
	
	/**
	 *Sets the Alternate Value Set Version ID.
	 *@param strAlternateValueSetVersionID carries the version for the value set identified by CNE.18 (Alternate Value Set OID).
	 */
	public void setAlternateValueSetVersionID(String strAlternateValueSetVersionID)
	{
		if(strAlternateValueSetVersionID !=null)
			setComponentType(19, strAlternateValueSetVersionID);
		else
			setAlternateValueSetVersionID((DTM)null);
	}

	/**
	 *Sets the Alternate Value Set Version ID.
	 *@param objDTM carries the version for the value set identified by CNE.18 (Alternate Value Set OID).
	 */
	public void setAlternateValueSetVersionID (DTM objDTM)
	{
		setComponentType(19,objDTM);
	}
	
	/**
	 *Sets the Second Alternate Coding System OID.
	 *@param strSecondAlternateCodingSystemOID contains the ISO Object Identifier (OID) from which the value in CNE.12 (Name of the Alternate COdimng System) is obtained.
	 */
	public void setSecondAlternateCodingSystemOID(String strSecondAlternateCodingSystemOID)
	{
		if(strSecondAlternateCodingSystemOID !=null)
			setComponentType(20, strSecondAlternateCodingSystemOID);
		else
			setSecondAlternateCodingSystemOID((ST)null);
	}

	/**
	 *Sets the Second Alternate Coding System OID.
	 *@param objST contains the ISO Object Identifier (OID) from which the value in CNE.12 (Name of the Alternate COdimng System) is obtained.
	 */
	public void setSecondAlternateCodingSystemOID(ST objST)
	{
		setComponentType(20,objST);
	}
	
	/**
	 *Sets the Second Alternate Value Set OID.
	 *@param strSecondAlternateValueSetOID contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CNE.10 (Second Alternate Identifier)is obtained.
	 */
	public void setSecondAlternateValueSetOID(String strSecondAlternateValueSetOID)
	{
		if(strSecondAlternateValueSetOID !=null)
			setComponentType(21, strSecondAlternateValueSetOID);
		else
			setSecondAlternateValueSetOID((ST)null);
	}

	/**
	 *Sets the Second Alternate Value Set OID.
	 *@param objST contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CNE.10 (Second Alternate Identifier) is obtained.
	 */
	public void setSecondAlternateValueSetOID(ST objST)
	{
		setComponentType(21,objST);
	}
	
	/**
	 *Sets the Second Alternate Value Set Version ID.
	 *@param strSecondAlternateValueSetVersionID carries the version for the value set identified by CNE.21 (Second Alternate Value Set OID).
	 */
	public void setSecondAlternateValueSetVersionID(String strSecondAlternateValueSetVersionID)
	{
		if(strSecondAlternateValueSetVersionID !=null)
			setComponentType(22, strSecondAlternateValueSetVersionID);
		else
			setSecondAlternateValueSetVersionID((DTM)null);
	}

	/**
	 *Sets the Second Alternate Value Set Version ID.
	 *@param objDTM carries the version for the value set identified by CNE.21 (Second Alternate Value Set OID).
	 */
	public void setSecondAlternateValueSetVersionID (DTM objDTM)
	{
		setComponentType(22,objDTM);
	}
	
	
	
	/**
	 * Returns Identifier
	 * @return ST - data type.
	 */
	public ST getIdentifier()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(1);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns Text 
	 * @return ST - data type.
	 */
	public ST getText()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(2);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns Name Of Coding System 
	 * @return ID - data type.
	 */
	public ID getNameOfCodingSystem()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(3);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns Alternate Identifier 
	 * @return ST - data type.
	 */
	public ST getAlternateIdentifier()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(4);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns Alternate Text 
	 * @return ST - data type.
	 */
	public ST getAlternateText()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(5);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns Name of Alternate Coding System 
	 * @return ST - data type.
	 */

	public ID getNameOfAlternateCodingSystem()

	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(6);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns Coding System Version ID
	 * @return ST - data type.
	 */
	public ST getCodingSystemVersionID()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(7);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns Alternate Coding System Version ID
	 * @return ST - data type.
	 */
	public ST getAlternateCodingSystemVersionID()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(8);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns Original Text
	 * @return ST - data type.
	 */
	public ST getOriginalText()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(9);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Returns Second Alternate Identifier
	 * @return ST - data type.
	 */
	public ST getSecondAlternateIdentifier()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(10);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Returns Second Alternate Text.
	 * @return ST - data type.
	 */
	public ST getSecondAlternateText()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(11);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Returns Name of Second Alternate Coding System
	 * @return ID - data type.
	 */
	public ID getNameofSecondAlternateCodingSystem()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(12);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Returns Second Alternate Coding System Version ID
	 * @return ST - data type.
	 */
	public ST getSecondAlternateCodingSystemVersionID()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(13);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Returns Coding System OID
	 * @return ST - data type.
	 */
	public ST getCodingSystemOID()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(14);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Returns Value Set OID
	 * @return ST - data type.
	 */
	public ST getValueSetOID()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(15);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Returns Value Set Version ID
	 * @return DTM - data type.
	 */
	public DTM getValueSetVersionID()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(16);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Returns Alternate Coding System OID
	 * @return ST - data type.
	 */
	public ST getAlternateCodingSystemOID()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(17);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}
	/**
	 * Returns Alternate Value Set OID
	 * @return ST - data type.
	 */
	public ST getAlternateValueSetOID()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(18);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Returns Alternate Value Set Version ID
	 * @return DTM - data type.
	 */
	public DTM getAlternateValueSetVersionID()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(19);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Returns Second Alternate Coding System OID
	 * @return ST - data type.
	 */
	public ST getSecondAlternateCodingSystemOID()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(20);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Returns Second Alternate Value Set OID
	 * @return ST - data type.
	 */
	public ST getSecondAlternateValueSetOID()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(21);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Returns Second Alternate Value Set Version ID
	 * @return DTM - data type.
	 */
	public DTM getSecondAlternateValueSetVersionID()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(22);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * The Method validates the Input value,and if validated properly then returns true.
	 * Here the validetion is based on the compulsory fields for the Datatype. 
	 * @return boolean - true or false.
	 * @throws InvalidDataTypeException - if Invalid values is entered or Mandatory field is missing.
	 */
	public boolean validate()throws InvalidDataTypeException
	{
		super.validate();
		if(getComponentType(1)!=null)
			return true;
		else
		{
			throw new MissingValueException(this.getClass().getSimpleName() + "Identifier");
		}
	}

	/**
	 * This method checks the equality of Object.
	 * @param objObject object of Object class.
	 * @return boolean - shows success or failure of the comparison.
	 */
	public boolean equals(Object objObject)
	{
		if((objObject == null ) || (!(objObject instanceof CNE)))
			return false;

		if(this.getIdentifier() == null)
		{
			if(((CNE)objObject).getIdentifier() != null)
				return false;
		}
		else if(false == (this.getIdentifier().equals(((CNE)objObject).getIdentifier())))
			return false;

		if(this.getText() == null)
		{
			if(((CNE)objObject).getText() != null)
				return false;
		}
		else if(false == (this.getText().equals(((CNE)objObject).getText())))
			return false;

		if(this.getNameOfCodingSystem() == null)
		{
			if(((CNE)objObject).getNameOfCodingSystem() != null)
				return false;
		}
		else if(false == (this.getNameOfCodingSystem().equals(((CNE)objObject).getNameOfCodingSystem())))
			return false;

		if(this.getAlternateIdentifier() == null)
		{
			if(((CNE)objObject).getAlternateIdentifier() != null)
				return false;
		}
		else if(false == (this.getAlternateIdentifier().equals(((CNE)objObject).getAlternateIdentifier())))
			return false;

		if(this.getAlternateText() == null)
		{
			if(((CNE)objObject).getAlternateText() != null)
				return false;
		}
		else if(false == (this.getAlternateText().equals(((CNE)objObject).getAlternateText())))
			return false;

		if(this.getNameOfAlternateCodingSystem() == null)
		{
			if(((CNE)objObject).getNameOfAlternateCodingSystem() != null)
				return false;
		}
		else if(false == (this.getNameOfAlternateCodingSystem().equals(((CNE)objObject).getNameOfAlternateCodingSystem())))
			return false;

		if(this.getCodingSystemVersionID() == null)
		{
			if(((CNE)objObject).getCodingSystemVersionID() != null)
				return false;
		}
		else if(false == (this.getCodingSystemVersionID().equals(((CNE)objObject).getCodingSystemVersionID())))
			return false;

		if(this.getAlternateCodingSystemVersionID() == null)
		{
			if(((CNE)objObject).getAlternateCodingSystemVersionID() != null)
				return false;
		}
		else if(false == (this.getAlternateCodingSystemVersionID().equals(((CNE)objObject).getAlternateCodingSystemVersionID())))
			return false;

		if(this.getOriginalText() == null)
		{
			if(((CNE)objObject).getOriginalText() != null)
				return false;
		}
		else if(false == (this.getOriginalText().equals(((CNE)objObject).getOriginalText())))
			return false;
		
		if(this.getAlternateIdentifier() == null)
		{
			if(((CNE)objObject).getAlternateIdentifier() != null)
				return false;
		}
		else if(false == (this.getAlternateIdentifier().equals(((CNE)objObject).getAlternateIdentifier())))
			return false;
		
		if(this.getSecondAlternateText() == null)
		{
			if(((CNE)objObject).getSecondAlternateText() != null)
				return false;
		}
		else if(false == (this.getSecondAlternateText().equals(((CNE)objObject).getSecondAlternateText())))
			return false;
		
		if(this.getNameofSecondAlternateCodingSystem() == null)
		{
			if(((CNE)objObject).getNameofSecondAlternateCodingSystem() != null)
				return false;
		}
		else if(false == (this.getNameofSecondAlternateCodingSystem().equals(((CNE)objObject).getNameofSecondAlternateCodingSystem())))
			return false;

		if(this.getNameofSecondAlternateCodingSystem() == null)
		{
			if(((CNE)objObject).getAlternateCodingSystemVersionID() != null)
				return false;
		}
		else if(false == (this.getAlternateCodingSystemVersionID().equals(((CNE)objObject).getAlternateCodingSystemVersionID())))
			return false;
		
		if(this.getCodingSystemOID() == null)
		{
			if(((CNE)objObject).getCodingSystemOID() != null)
				return false;
		}
		else if(false == (this.getCodingSystemOID().equals(((CNE)objObject).getCodingSystemOID())))
			return false;
		
		if(this.getValueSetOID() == null)
		{
			if(((CNE)objObject).getValueSetOID() != null)
				return false;
		}
		else if(false == (this.getValueSetOID().equals(((CNE)objObject).getValueSetOID())))
			return false;
		
		if(this.getValueSetVersionID() == null)
		{
			if(((CNE)objObject).getValueSetVersionID() != null)
				return false;
		}
		else if(false == (this.getValueSetVersionID().equals(((CNE)objObject).getValueSetVersionID())))
			return false;
		
		if(this.getAlternateCodingSystemOID() == null)
		{
			if(((CNE)objObject).getAlternateCodingSystemOID() != null)
				return false;
		}
		else if(false == (this.getAlternateCodingSystemOID().equals(((CNE)objObject).getAlternateCodingSystemOID())))
			return false;
		
		if(this.getAlternateValueSetOID() == null)
		{
			if(((CNE)objObject).getAlternateValueSetOID() != null)
				return false;
		}
		else if(false == (this.getAlternateValueSetOID().equals(((CNE)objObject).getAlternateValueSetOID())))
			return false;
		
		if(this.getAlternateValueSetVersionID()== null)
		{
			if(((CNE)objObject).getAlternateValueSetVersionID() != null)
				return false;
		}
		else if(false == (this.getAlternateValueSetVersionID().equals(((CNE)objObject).getAlternateValueSetVersionID())))
			return false;
		
		if(this.getSecondAlternateCodingSystemOID()== null)
		{
			if(((CNE)objObject).getSecondAlternateCodingSystemOID() != null)
				return false;
		}
		else if(false == (this.getSecondAlternateCodingSystemOID().equals(((CNE)objObject).getSecondAlternateCodingSystemOID())))
			return false;
		
		if(this.getSecondAlternateValueSetOID()== null)
		{
			if(((CNE)objObject).getSecondAlternateValueSetOID() != null)
				return false;
		}
		else if(false == (this.getSecondAlternateValueSetOID().equals(((CNE)objObject).getSecondAlternateValueSetOID())))
			return false;
		
		if(this.getSecondAlternateValueSetVersionID()== null)
		{
			if(((CNE)objObject).getSecondAlternateValueSetVersionID() != null)
				return false;
		}
		else if(false == (this.getSecondAlternateValueSetVersionID().equals(((CNE)objObject).getSecondAlternateValueSetVersionID())))
			return false;
		
		return true;
	}
}
