/*******************************************************************************
 *  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.utils.EnumDataType;
import cdac.medinfo.sdk.hl7282.utils.IDataTypeMap;

/**
 * XCN - Extended composite ID number and name for persons<p>
 * This data type is used extensively appearing 
 * in the PV1, ORC, RXO, RXE, OBR and SCH segments, as well as 
 * others, where there is a need to specify the ID number and name of a person.
 * Example without assigning authority and assigning facility:
   |1234567^Smith^John^J^III^DR^PHD^ADT01^^L^4^M11^MR|
 * <p>Represents an HL7 XCN data type. 
 * This data type has the following attributes:</p><p>
 *  1. Person Identifier (ST)<b>Conditional</b><br>
 *  2. Family Name (FN)<b>Conditional</b><br>
 *  3. Given Name (ST)<b>Optional</b><br>
 *  4. Second and Further Given Names or Initials Thereof (ST)<b>Optional</b><br>
 *  5. Suffix (e.g., JR or III) (ST)<b>Optional</b><br>
 *  6. Prefix (e.g., DR) (ST)<b>Optional</b><br>
 *  
 *  8. Source Table (CWE)<b>Backward</b><br>
 *  9. Assigning Authority (HD)<b>Conditional</b><br>
 * 10. Name Type Code (ID)<b>Conditional</b><br>
 * 11. Identifier Check Digit (ST)<b>Optional</b><br>
 * 12. Check Digit Scheme (ID)<b>Conditional</b><br>
 * 13. Identifier Type Code (ID)<b>Conditional</b><br>
 * 14. Assigning Facility (HD)<b>Optional</b><br>
 * 15. Name Representation Code (ID)<b>Optional</b><br>
 * 16. Name Context (CWE)<b>Optional</b><br>
 * 
 * 18. Name Assembly Order (ID)<b>Optional</b><br>
 * 19. Effective Date (DTM)<b>Optional</b><br>
 * 20. Expiration Date (DTM)<b>Optional</b><br>
 * 21. Professional Suffix (ST)<b>Optional</b><br>
 * 22. Assigning Jurisdiction (CWE)<b>Conditional</b><br>
 * 23. Assigning Agency or Department (CWE)<b>Conditional</b><br><p>
 * 24. Security Check (ST)<b>Optional</b><br><p>
 * 25. Security Check Scheme (ID)<b>Optional</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 XCN extends CompositeDataType    
{
	


	/**
	 * Default Constructor for XCN
	 */
	public XCN()
	{
		super(EnumDataType.HL7_DT_XCN);
		 
	}

	/**
	 * Constructor  for XCN 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 XCN(int iMinLength, int iMaxLength, String strCLength,int iComponentType) throws InvalidComponentTypeException
	{
		super(EnumDataType.HL7_DT_XCN);
		this.iMinLength = iMinLength;
		this.iMaxLength = iMaxLength;
		this.iConformanceLength = strCLength;
		this.iComponentType = iComponentType;
		if(!isValidComponentType())
		{
			throw new InvalidComponentTypeException(this.getClass().getSimpleName());
		}
	}


	/**
	 * Constructor for XCN 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 XCN(int iMinLength, int iMaxLength, String strCLength,int iTableNo,int iComponentType) throws InvalidComponentTypeException
	{
		super(EnumDataType.HL7_DT_XCN);
		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 XCN 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 XCN(int iComponentType,IDataTypeMap objIDataTypeMap)
	{
		super(EnumDataType.HL7_DT_XCN);
		this.objIDataTypeMap = objIDataTypeMap;
		this.iComponentType = iComponentType;
		if(!isValidComponentType())
		{
			throw new InvalidComponentTypeException(this.getClass().getSimpleName());
		}
	}
	/**
	 * Constructor for XCN 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 XCN(int iComponentType,int iMinLength, int iMaxLength, String strCLength,IDataTypeMap objIDataTypeMap)
	{
		super(EnumDataType.HL7_DT_XCN);
		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 XCN 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 XCN(int iComponentType,int iMinLength, int iMaxLength, String strCLength,int ITableNo,IDataTypeMap objIDataTypeMap)
	{
		super(EnumDataType.HL7_DT_XCN);
		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 Id Number.
	 *@param strIdNumber Refers to the coded ID according to a user-defined table 
	 */
	public void setIdNumber(String strIdNumber)
	{
		if(strIdNumber!=null)
			setComponentType(1, strIdNumber);
		else
			setIdNumber((ST)null);
	}

	/**
	 *Sets the Id Number.
	 *@param objString Refers to the coded ID according to a user-defined table
	 */
	public void setIdNumber(ST objST)
	{
		setComponentType(1,objST);
	}

	/**
	 * Sets the Family Name.
	 * @param objFamilyName Specifies the surname of a person.
	 */
	public void setFamilyName(FN objFamilyName)
	{
		setComponentType(2,objFamilyName);
	}

	/**
	 *Sets the Given Name.
	 *@param strGivenName Specifies First name. 
	 */
	public void setGivenName(String strGivenName)
	{
		if(strGivenName!=null)
			setComponentType(3, strGivenName);
		else
			setGivenName((ST)null);
	}

	/**
	 *Sets the Given Name.
	 *@param objST Specifies First name.
	 */
	public void setGivenName(ST objST)
	{
		setComponentType(3,objST);
	}

	/**
	 *Sets the Second Name Or Initials.
	 *@param strSecondNameOrInitials Specifies multiple middle names that may be included by 
	 * 														   separating them with spaces.
	 */
	public void setSecondNameOrInitials(String strSecondNameOrInitials)
	{
		if(strSecondNameOrInitials!=null)
			setComponentType(4, strSecondNameOrInitials);
		else
			setSecondNameOrInitials((ST)null);
	}

	/**
	 *Sets the Second Name Or Initials.
	 *@param objST Specifies multiple middle names that may be included by 
	 * 														   separating them with spaces.
	 */
	public void setSecondNameOrInitials(ST objST)
	{
		setComponentType(4,objST);
	}

	/**
	 *Sets the Suffix.
	 *@param strSuffix Used to specify a name suffix (e.g., Jr. or III). 
	 */
	public void setSuffix(String strSuffix)
	{
		if(strSuffix!=null)
			setComponentType(5, strSuffix);
		else
			setSuffix((ST)null);
	}

	/**
	 *Sets the Suffix.
	 *@param objST Used to specify a name suffix (e.g., Jr. or III).
	 */
	public void setSuffix(ST objST)
	{
		setComponentType(5,objST);
	}

	/**
	 *Sets the Prefix.
	 *@param strPrefix Used to specify a name prefix (e.g., Dr.). 
	 */
	public void setPrefix(String strPrefix)
	{
		if(strPrefix!=null)
			setComponentType(6, strPrefix);
		else
			setPrefix((ST)null);
	}

	/**
	 *Sets the Prefix.
	 *@param objString Used to specify a name prefix (e.g., Dr.).
	 */
	public void setPrefix(ST objST)
	{
		setComponentType(6,objST);
	}


	/**
	 *Sets the Source Table.
	 *@param strSourceTable used as the HL7 identifier for the user-defined table of values for this component. [Refer User-defined Table 0297 \96 CN ID.] 
	 */
	public void setSourceTable(String strSourceTable)
	{
		if(strSourceTable!=null)
			setComponentType(8, strSourceTable);
		else
			setSourceTable((CWE)null);
	}
	
	/**
	 *Sets the Source Table.
	 *@param objCWE used as the HL7 identifier for the user-defined table of values for this component. [Refer User-defined Table 0297 CN ID.]
	 */
	public void setSourceTable(CWE objCWE)
	{
		setComponentType(8,objCWE);
	}

	/**
	 * Sets the Assigning Authority.
	 * @param objAssigningAuthority Specifies a unique identifier of the system (or organization or agency of department)
	 * 								  that creates the data. [Refer User-defined Table 0363 Assigning authority]
	 */
	public void setAssigningAuthority(HD objAssigningAuthority)
	{
		setComponentType(9,objAssigningAuthority);
	}

	/**
	 *Sets the Name Type Code.
	 *@param strNameTypeCode Specifies a code that represents the type of name.  
	 */
	public void setNameTypeCode(String strNameTypeCode)
	{
		if(strNameTypeCode!=null)
			setComponentType(10, strNameTypeCode);
		else
			setNameTypeCode((ID)null);
	}

	/**
	 *Sets the Name Type Code.
	 *@param objID Specifies a code that represents the type of name. 
	 */
	public void setNameTypeCode(ID objID)
	{
		setComponentType(10,objID);
	}

	/**
	 *Sets the Identifier Check Digit.
	 *@param strIdentifierCheckDigit Specifies part of the identifying number used in the sending application.  
	 */
	public void setIdentifierCheckDigit(String strIdentifierCheckDigit)
	{
		if(strIdentifierCheckDigit!=null)
			setComponentType(11, strIdentifierCheckDigit);
		else
			setIdentifierCheckDigit((ST)null);
	}

	/**
	 *Sets the Identifier CheckDigit.
	 *@param objST Specifies part of the identifying number used in the sending application. 
	 */
	public void setIdentifierCheckDigit(ST objST)
	{
		setComponentType(11,objST);
	}

	/**
	 *Sets the Check Digit Scheme.
	 *@param strCheckDigitScheme Specifies the code identifying the check digit scheme employed.[Refer HL7 Table 0061 - Check digit scheme]. 
	 */
	public void setCheckDigitScheme(String strCheckDigitScheme)
	{
		if(strCheckDigitScheme!=null)
			setComponentType(12, strCheckDigitScheme);
		else
			setCheckDigitScheme((ID)null);
	}

	/**
	 *Sets the Check Digit Scheme.
	 *@param objID Specifies the code identifying the check digit scheme employed.[Refer HL7 Table 0061 - Check digit scheme].
	 */
	public void setCheckDigitScheme(ID objID)
	{
		setComponentType(12,objID);
	}

	/**
	 *Sets the Identifier Type Code.
	 *@param strIdentifierTypeCode Specifies A code corresponding to the type of identifier.[Refer HL7 Table 0203 - Identifier type]. 
	 */
	public void setIdentifierTypeCode(String strIdentifierTypeCode)
	{
		if(strIdentifierTypeCode!=null)
			setComponentType(13, strIdentifierTypeCode);
		else
			setIdentifierTypeCode((ID)null);
	}

	/**
	 *Sets the Identifier Type Code.
	 *@param objID Specifies A code corresponding to the type of identifier.[Refer HL7 Table 0203 - Identifier type].
	 */
	public void setIdentifierTypeCode(ID objID)
	{
		setComponentType(13,objID);
	}

	/**
	 * Sets the Assigning Facility.
	 * @param objAssigningFacility Specifies the place or location identifier where the identifier was first assigned to the person
	 */
	public void setAssigningFacility(HD objAssigningFacility)
	{
		setComponentType(14,objAssigningFacility);
	}

	/**
	 *Sets the Name Representation Code.
	 *@param strNameRepresentationCode provides an indication of the representation provided by the data item.   
	 */
	public void setNameRepresentationCode(String strNameRepresentationCode)
	{
		if(strNameRepresentationCode!=null)
			setComponentType(15, strNameRepresentationCode);
		else
			setNameRepresentationCode((ID)null);
	}

	/**
	 *Sets the Name Representation Code.
	 *@param objID provides an indication of the representation provided by the data item.  
	 */
	public void setNameRepresentationCode(ID objID)
	{
		setComponentType(15,objID);
	}

	/**
	 * Sets the Name Context.
	 * @param objCWE Designates the context in which a name is used. [Refer User-defined Table 0448 ]
	 */
	public void setNameContext(CWE objCWE)
	{
		setComponentType(16,objCWE);
	}

	/**
	 *Sets the Name Assembly Order.
	 *@param strNameAssemblyOrder Specifies a code that represents the preferred display order of the components of this person name. Suggested values are G,F[Refer table 0444.] 
	 */
	public void setNameAssemblyOrder(String strNameAssemblyOrder)
	{
		if(strNameAssemblyOrder!=null)
			setComponentType(18, strNameAssemblyOrder);
		else
			setNameAssemblyOrder((ID)null);
	}

	/**
	 *Sets the Name Assembly Order.
	 *@param objID Specifies a code that represents the preferred display order of the components of this person name. Suggested values are G,F[Refer table 0444.]
	 */
	public void setNameAssemblyOrder(ID objID)
	{
		setComponentType(18,objID);
	}

	/**
	 * Sets the Effective Date.
	 * @param objEffectiveDate Specifies the first date, if known, on which the address is valid and active.
	 */
	public void setEffectiveDate(DTM objEffectiveDate)
	{
		setComponentType(19,objEffectiveDate);
	}
	
	/**
	 *Sets the Effective Date.
	 *@param strEffectiveDate Specifies the first date, if known, on which the address is valid and active. 
	 */
	public void setEffectiveDate(String strEffectiveDate)
	{
		if(strEffectiveDate!=null)
			setComponentType(19, strEffectiveDate);
		else
			setNameAssemblyOrder((ID)null);
	}

	/**
	 * Sets the Expiration Date.
	 * @param objExpirationDate Specifies the last date, if known, on which the address is valid and active.
	 */
	public void setExpirationDate(DTM objExpirationDate)
	{
		setComponentType(20,objExpirationDate);
	}
	
	/**
	 *Sets the Expiration Date.
	 *@param strExpirationDate Specifies the last date, if known, on which the address is valid and active. 
	 */
	public void setExpirationDate(String strExpirationDate)
	{
		if(strExpirationDate!=null)
			setComponentType(19, strExpirationDate);
		else
			setNameAssemblyOrder((ID)null);
	}

	/**
	 *Sets the Professional Suffix.
	 *@param strProfessionalSuffix Used to specify an abbreviation, or a string of abbreviations, denoting qualifications that support the person's profession, (e.g., licenses). 
	 */
	public void setProfessionalSuffix(String strProfessionalSuffix)
	{
		if(strProfessionalSuffix!=null)
			setComponentType(21, strProfessionalSuffix);
		else
			setProfessionalSuffix((ST)null);
	}

	/**
	 *Sets the Professional Suffix.
	 *@param objString Used to specify an abbreviation, or a string of abbreviations, denoting qualifications that support the person's profession, (e.g., licenses).
	 */
	public void setProfessionalSuffix(ST objST)
	{
		setComponentType(21,objST);
	}

	/**
	 * Sets the Assigning Jurisdiction.
	 * @param objAssigningJurisdiction Specifies the geo-political body that assigned the identifier.
	 */
	public void setAssigningJurisdiction(CWE objAssigningJurisdiction)
	{
		setComponentType(22,objAssigningJurisdiction);
	}

	/**
	 * Sets the Assigning Agency Or Department.
	 * @param objAssigningAgencyOrDepartment Specifies the agency or department that assigned the identifier.
	 */
	public void setAssigningAgencyOrDepartment(CWE objAssigningAgencyOrDepartment)
	{
		setComponentType(23,objAssigningAgencyOrDepartment);
	}
	
	/**
	 *Sets the Security Check.
	 *@param strSecurityCheck Refers to a version code that may be assigned to the value given in XCN.1 Person Identifier.
	 */
	public void setSecurityCheck(String strSecurityCheck)
	{
		if(strSecurityCheck!=null)
			setComponentType(24, strSecurityCheck);
		else
			setSecurityCheck((ST)null);
	}

	/**
	 *Sets the Security Check.
	 *@param objST Refers to a version code that may be assigned to the value given in XCN.1 Person Identifier.
	 */
	public void setSecurityCheck(ST objST)
	{
		setComponentType(24,objST);
	}
	
	/**
	 *Sets the Security Check Scheme.
	 *@param strSecurityCheckScheme is used to transmit information intended to validate the veracity of the supplied identifier or the presenter of the identifier.
	 */
	public void setSecurityCheckScheme(String strSecurityCheckScheme)
	{
		if(strSecurityCheckScheme!=null)
			setComponentType(25, strSecurityCheckScheme);
		else
			setSecurityCheckScheme((ID)null);
	}

	/**
	 *Sets the Security Check Scheme.
	 *@param objID is used to transmit information intended to validate the veracity of the supplied identifier or the presenter of the identifier.
	 */
	public void setSecurityCheckScheme(ID objID)
	{
		setComponentType(25,objID);
	}

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

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

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

	/**
	 * Returns Second and Further Given Names or Initials Thereof
	 * @return ST - data type.
	 */
	public ST getSecondNameInitials()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(4);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns Suffix (e.g., JR or III)
	 * @return ST - data type.
	 */
	public ST getSuffix()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(5);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns Prefix (e.g., DR)
	 * @return ST - data type.
	 */
	public ST getPrefix()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(6);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns Source Table
	 * @return CWE - data type.
	 */
	public CWE getSourceTable()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(8);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}
	/**
	 * Returns Assigning Authority
	 * @return HD - data type.
	 */
	public HD getAssigningAuthority()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(9);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (HD)objDataCollection.elementAt(0);
		else
			return null;
	}
	/**
	 * Returns Name Type Code 
	 * @return ID - data type.
	 */
	public ID getNameTypeCode()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(10);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}
	/**
	 * Returns Identifier Check Digit
	 * @return ST - data type.
	 */
	public ST getIdentifierCheckDigit()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(11);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}
	/**
	 * Returns Check Digit Scheme 
	 * @return ID - data type.
	 */
	public ID getCheckDigitScheme()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(12);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns Identifier Type Code
	 * @return ID - data type.
	 */
	public ID getIdentifierTypeCode()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(13);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns Assigning Facility
	 * @return HD - data type.
	 */
	public HD getAssigningFacility()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(14);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (HD)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns Name Representation Code
	 * @return ID - data type.
	 */
	public ID getNameRepresentationCode()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(15);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns Name Context
	 * @return CWE - data type.
	 */
	public CWE getNameContext()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(16);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}


	/**
	 * Returns Name Assembly Order
	 * @return ID - data type.
	 */
	public ID getNameAssemblyOrder()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(18);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns  Effective Date
	 * @return DTM - data type.
	 */
	public DTM getEffectiveDate()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(19);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns Expiration Date
	 * @return DTM - data type.
	 */
	public DTM getExpirationDate()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(20);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}

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

	/**
	 * Returns Assigning Jurisdiction
	 * @return CWE - data type.
	 */
	public CWE getAssigningJurisdiction()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(22);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns Assigning Agency or Department
	 * @return CWE - data type.
	 */
	public CWE getAssigningAgencyorDepartment()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(23);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Returns Security Check
	 * @return ST - data type.
	 */
	public ST getSecurityCheck()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(24);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}

	
	/**
	 * Returns Security Check Scheme
	 * @return ST - data type.
	 */
	public ID getSecurityCheckScheme()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(25);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}


	/**
	 * 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 XCN)))
			return false;

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

		if(this.getAssigningAgencyorDepartment() == null)
		{
			if(((XCN)objObject).getAssigningAgencyorDepartment() != null)
				return false;
		}
		else if(false == (this.getAssigningAgencyorDepartment().equals(((XCN)objObject).getAssigningAgencyorDepartment())))
			return false;
		
		if(this.getSecurityCheck() == null)
		{
			if(((XCN)objObject).getSecurityCheck() != null)
				return false;
		}
		else if(false == (this.getSecurityCheck().equals(((XCN)objObject).getSecurityCheck())))
			return false;
		
		if(this.getSecurityCheckScheme() == null)
		{
			if(((XCN)objObject).getSecurityCheckScheme() != null)
				return false;
		}
		else if(false == (this.getSecurityCheckScheme().equals(((XCN)objObject).getSecurityCheckScheme())))
			return false;

		return true;
	}
}
