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

/**
 * PPN - Performing person time stamp<p>
 * This data type type is the equivalent of an XCN data type joined with a TS data type.  
 * <p>Represents an HL7 PPN data type. 
 * This data type has the following attributes:</p><p>
 *  1. Person Identifier (ST)<b>Optional</b><br>
 *  2. Family Name (FN)<b>Optional</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>Optional</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>Optional</b><br>
 * 14. Assigning Facility (HD)<b>Optional</b><br>
 * 15. Date/Time Action Performed (DTM)<b>Optional</b><br>
 * 16. Name Representation Code (ID)<b>Optional</b><br>
 * 17. Name Context (CWE)<b>Optional</b><br>
 * 
 * 19. Name Assembly Order (ID)<b>Optional</b><br>
 * 20. Effective Date (DTM)<b>Optional</b><br>
 * 21. Expiration Date (DTM)<b>Optional</b><br>
 * 22. Professional Suffix (ST)<b>Optional</b><br>
 * 23. Assigning Jurisdiction (CWE)<b>Optional</b><br>
 * 24. Assigning Agency or Department (CWE)<b>Optional</b><br><p>
 * 25. Security Check (ST)<b>Optional</b><br><p>
 * 26. 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 PPN extends CompositeDataType    
{
	


	/**
	 * Default Constructor for PPN
	 */
	public PPN()
	{
		super(EnumDataType.HL7_DT_PPN);
		 
	}

	/**
	 * Constructor  for CQ class which takes four arguments and 
	 * sets the value in the respective member variable.
	 * @param iMaxLength - The Maximum 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 PPN(int iMinLength, int iMaxLength, String strCLength,int iComponentType) throws InvalidComponentTypeException
	{
		super(EnumDataType.HL7_DT_PPN);
		this.iMinLength = iMinLength;
		this.iMaxLength = iMaxLength;
		this.iConformanceLength = strCLength;
		this.iComponentType = iComponentType;
		if(!isValidComponentType())
		{
			throw new InvalidComponentTypeException(this.getClass().getSimpleName());
		}
	}

	/**
	 * Constructor for PPN 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 PPN(int iMinLength, int iMaxLength, String strCLength,int iTableNo,int iComponentType) throws InvalidComponentTypeException
	{
		super(EnumDataType.HL7_DT_PPN);
		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 PPN 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 PPN(int iComponentType,IDataTypeMap objIDataTypeMap)
	{
		super(EnumDataType.HL7_DT_PPN);
		this.objIDataTypeMap = objIDataTypeMap;
		this.iComponentType = iComponentType;
		if(!isValidComponentType())
		{
			throw new InvalidComponentTypeException(this.getClass().getSimpleName());
		}
	}
	/**
	 * Constructor for PPN 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 PPN(int iComponentType,int iMinLength, int iMaxLength, String strCLength,IDataTypeMap objIDataTypeMap)
	{
		super(EnumDataType.HL7_DT_PPN);
		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 PPN 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 PPN(int iComponentType,int iMinLength, int iMaxLength, String strCLength,int ITableNo,IDataTypeMap objIDataTypeMap)
	{
		super(EnumDataType.HL7_DT_PPN);
		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 Person Identifier.
	 *@param strPersonIdentifier carries the Person Identifier itself.  
	 */
	public void setPersonIdentifier(String strPersonIdentifier)
	{
		if(strPersonIdentifier!=null)
			setComponentType(1, strPersonIdentifier);
		else
			setPersonIdentifier((ST)null);
	}


	/**
	 *Sets the Person Identifier.
	 *@param objST carries the Person Identifier itself.  
	 */
	public void setPersonIdentifier(ST objST)
	{
		setComponentType(1,objST);
	}

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

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

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

	/**
	 *Sets the SecondAndFurtherGivenNamesOrInitialsThereof.
	 *@param strSecondNamesOrInitials Multiple middle names may be included by separating them with spaces. 
	 */
	public void setSecondAndFurtherGivenNamesOrInitialsThereof(String strSecondNamesOrInitials)
	{
		if(strSecondNamesOrInitials!=null)
			setComponentType(4, strSecondNamesOrInitials);
		else
			setSecondAndFurtherGivenNamesOrInitialsThereof((ST)null);
	}

	/**
	 *Sets the SecondAndFurtherGivenNamesOrInitialsThereof.
	 *@param objST Multiple middle names may be included by separating them with spaces.
	 */
	public void setSecondAndFurtherGivenNamesOrInitialsThereof(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 objST Used to specify a name prefix (e.g., Dr.).
	 */
	public void setPrefix(ST objST)
	{
		setComponentType(6,objST);
	}

	/**
	 *Sets the SourceTable.
	 *@param strSourceTable source is used as the HL7 identifier for the user-defined table of values for this component.  
	 */
	public void setSourceTable(String strSourceTable)
	{
		if(strSourceTable!=null)
			setComponentType(8, strSourceTable);
		else
			setSourceTable((CWE)null);
	}

	/**
	 *Sets the SourceTable.
	 *@param objCWE source is used as the HL7 identifier for the user-defined table of values for this component. 
	 */
	public void setSourceTable(CWE objCWE)
	{
		setComponentType(8,objCWE);
	}

	/**
	 *Sets the AssigningAuthority.
	 *@param objAssigningAuthority The assigning authority is a unique identifier of the system 
	 */
	public void setAssigningAuthority(HD objAssigningAuthority)
	{
		setComponentType(9,objAssigningAuthority);
	}

	/**
	 *Sets the NameTypeCode.
	 *@param strNameTypeCode 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 NameTypeCode.
	 *@param objString A code that represents the type of name. 
	 */
	public void setNameTypeCode(ID objID)
	{
		setComponentType(10,objID);
	}

	/**
	 *Sets the IdentifierCheckDigit.
	 *@param strIdentifierCheckDigit The check digit in this data type is not an add-on produced by the message processor.  
	 */
	public void setIdentifierCheckDigit(String strIdentifierCheckDigit)
	{
		if(strIdentifierCheckDigit!=null)
			setComponentType(11, strIdentifierCheckDigit);
		else
			setIdentifierCheckDigit((ST)null);
	}

	/**
	 *Sets the IdentifierCheckDigit.
	 *@param objST The check digit in this data type is not an add-on produced by the message processor. 
	 */
	public void setIdentifierCheckDigit(ST objST)
	{
		setComponentType(11,objST);
	}

	/**
	 *Sets the CheckDigitScheme.
	 *@param strCheckDigitScheme Contains the code identifying the check digit scheme employed. 
	 */
	public void setCheckDigitScheme(String strCheckDigitScheme)
	{
		if(strCheckDigitScheme!=null)
			setComponentType(12, strCheckDigitScheme);
		else
			setCheckDigitScheme((ID)null);
	}

	/**
	 *Sets the CheckDigitScheme.
	 *@param objID Contains the code identifying the check digit scheme employed.
	 */
	public void setCheckDigitScheme(ID objID)
	{
		setComponentType(12,objID);
	}

	/**
	 *Sets the IdentifierTypeCode.
	 *@param strIdentifierTypeCode A code corresponding to the type of identifier.  
	 */
	public void setIdentifierTypeCode(String strIdentifierTypeCode)
	{
		if(strIdentifierTypeCode!=null)
			setComponentType(13, strIdentifierTypeCode);
		else
			setIdentifierTypeCode((ID)null);
	}

	/**
	 *Sets the IdentifierTypeCode.
	 *@param objID A code corresponding to the type of identifier. 
	 */
	public void setIdentifierTypeCode(ID objID)
	{
		setComponentType(13,objID);
	}

	/**
	 *Sets the AssigningFacility.
	 *@param objAssigningFacility The place or location identifier where the identifier was first assigned to the patient. 
	 */
	public void setAssigningFacility(HD objAssigningFacility)
	{
		setComponentType(14,objAssigningFacility);
	}
	
	/**
	 * Sets the DateTimeActionPerformed.
	 * @param strDateTimeActionPerformed describes when the activity was performed.
	 */
	public void setDateTimeActionPerformed(String strDateTimeActionPerformed)
	{
		if(strDateTimeActionPerformed!=null)
			setComponentType(15, strDateTimeActionPerformed);
		else
			setDateTimeActionPerformed((DTM)null);
	}

	/**
	 *Sets the DateTimeActionPerformed.
	 *@param objDTM describes when the activity was performed.
	 */
	public void setDateTimeActionPerformed(DTM objDTM)
	{
		setComponentType(15,objDTM);
	}

	/**
	 *Sets the NameRepresentationCode.
	 *@param strNameRepresentationCode Different name/address types and representations of the same name/address should be described by repeating of this field 
	 */
	public void setNameRepresentationCode(String strNameRepresentationCode)
	{
		if(strNameRepresentationCode!=null)
			setComponentType(16, strNameRepresentationCode);
		else
			setNameRepresentationCode((ID)null);
	}

	/**
	 *Sets the NameRepresentationCode.
	 *@param objID Different name/address types and representations of the same name/address should be described by repeating of this field
	 */
	public void setNameRepresentationCode(ID objID)
	{
		setComponentType(16,objID);
	}

	/**
	 *Sets the NameContext.
	 *@param objNameContext This component is used to designate the context in which a name is used. 
	 */
	public void setNameContext(CWE objNameContext)
	{
		setComponentType(17,objNameContext);
	}

	/**
	 *Sets the NameAssemblyOrder.
	 *@param strNameAssemblyOrder A code that represents the preferred display order of the components of this person name.  
	 */
	public void setNameAssemblyOrder(String strNameAssemblyOrder)
	{
		if(strNameAssemblyOrder!=null)
			setComponentType(19, strNameAssemblyOrder);
		else
			setNameAssemblyOrder((ID)null);
	}

	/**
	 *Sets the NameAssemblyOrder.
	 *@param objID A code that represents the preferred display order of the components of this person name. 
	 */
	public void setNameAssemblyOrder(ID objID)
	{
		setComponentType(19,objID);
	}
	
	/**
	 * 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(20, strEffectiveDate);
		else
			setEffectiveDate((DTM)null);
	}

	/**
	 *Sets the EffectiveDate.
	 *@param objEffectiveDate The first date, if known, on which the address is valid and active.
	 */
	public void setEffectiveDate(DTM objEffectiveDate)
	{
		setComponentType(21,objEffectiveDate);
	}
	
	/**
	 * 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(21, strExpirationDate);
		else
			setExpirationDate((DTM)null);
	}

	/**
	 *Sets the ExpirationDate.
	 *@param objExpirationDate The last date, if known, on which the address is valid and active.
	 */
	public void setExpirationDate(DTM objExpirationDate)
	{
		setComponentType(21,objExpirationDate);
	}

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

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

	/**
	 *Sets the AssigningJurisdiction.
	 *@param objAssigningJurisdiction The geo-political body that assigned the identifier in component 1. 
	 */
	public void setAssigningJurisdiction(CWE objAssigningJurisdiction)
	{
		setComponentType(23,objAssigningJurisdiction);
	}

	/**
	 *Sets the AssigningAgencyOrDepartment.
	 *@param objAssigningAgencyOrDepartment The agency or department that assigned the identifier in component 1.
	 */
	public void setAssigningAgencyOrDepartment(CWE objAssigningAgencyOrDepartment)
	{
		setComponentType(24,objAssigningAgencyOrDepartment);
	}
	
	/**
	 *Sets the Security Check.
	 *@param strSecurityCheck is used to communicate a version code.  
	 */
	public void setSecurityCheck(String strSecurityCheck)
	{
		if(strSecurityCheck!=null)
			setComponentType(25, strSecurityCheck);
		else
			setSecurityCheck((ST)null);
	}
	
	/**
	 *Sets the Security Check.
	 *@param objST carries the version code.  
	 */
	public void setSecurityCheck(ST objST)
	{
		setComponentType(25,objST);
	}

	/**
	 *Sets the Security Check Scheme.
	 *@param strSecurityCheckScheme is used to communicate a version code.  
	 */
	public void setSecurityCheckScheme(String strSecurityCheckScheme)
	{
		if(strSecurityCheckScheme!=null)
			setComponentType(26, strSecurityCheckScheme);
		else
			setNameTypeCode((ID)null);
	}

	/**
	 *Sets the Security Check Scheme.
	 *@param objID carries a version code.
	 */
	public void setSecurityCheckScheme(ID objID)
	{
		setComponentType(26,objID);
	}
	
	/**
	 * Returns ID Number
	 * @return ST - data type.
	 */
	public ST getPersonIdentifier()
	{
		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 IS - 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 Date/Time Action Performed
	 * @return TS - data type.
	 */
	public DTM getDateTimeActionPerformed()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(15);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}

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

	/**
	 * Returns Name Context
	 * @return CE - data type.
	 */
	public CWE getNameContext()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(17);
		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(19);
		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(20);
		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(21);
		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(22);
		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(23);
		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(24);
		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(25);
		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(26);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * The Method validates the Input value,and if validated properly then returns true.
	 * Here the validation is based on the compulsory fields for the Datatype. 
	 * @return boolean - true or fals.
	 * @throws InvalidDataTypeException - if Invalid values is entered or Mandatory field is missing.
	 */
	public boolean validate() throws InvalidDataTypeException
	{
		super.validate();
		/*All fields are optional
		 * Except fields Check Digit Scheme  and Source Table Hans to be taken care.
		 */
		return true;
	}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		return true;
	}
}
