/*******************************************************************************
 *  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;

/**
 * XTN - Extended telecommunication number<p>
 * This data type specifies extended telecommunication number
 * <p>Represents an HL7 XTN data type. 
 * This data type has the following attributes:</p><p>
 *  1. Telephone Number <b>Withdrawn</b>
 *  2. Telecommunication Use Code (ID)<b>Optional</b><br>
 *  3. Telecommunication Equipment Type (ID)<b>Required</b><br>
 *  4. Communication Address (ST)<b>Conditional</b><br>
 *  5. Country Code (SNM)<b>Optional</b><br>
 *  6. Area/City Code (SNM)<b>Optional</b><br>
 *  7. Local Number (SNM)<b>Conditional</b><br>
 *  8. Extension (SNM)<b>Conditional</b><br>
 *  9. Any Text (ST)<b>Optional</b><br>
 * 10. Extension Prefix (ST)<b>Optional</b><br>
 * 11. Speed Dial Code (ST)<b>Optional</b><br>
 * 12. Unformatted Telephone number (ST)<b>Conditional</b><br><p>
 * 13. Effective Start Date (DTM)<b>Optional</b><br><p>
 * 14. Expiration Date (DTM)<b>Optional</b><br><p>
 * 15. Expiration Reason (CWE)<b>Optional</b><br><p>
 * 16. Protection Code (CWE)<b>Optional</b><br><p>
 * 17. Shared Telecommunication Identifier (EI)<b>Optional</b><br><p>
 * 18. Preference Order (NM)<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 XTN extends CompositeDataType    
{
	


	/**
	 * Default Constructor for XTN
	 */
	public XTN()
	{
		super(EnumDataType.HL7_DT_XTN);
		 
	}

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


	/**
	 * Constructor for XTN 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 XTN(int iMinLength, int iMaxLength, String strCLength,int iTableNo,int iComponentType) throws InvalidComponentTypeException
	{
		super(EnumDataType.HL7_DT_XTN);
		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 XTN 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 XTN(int iComponentType,IDataTypeMap objIDataTypeMap)
	{
		super(EnumDataType.HL7_DT_XTN);
		this.objIDataTypeMap = objIDataTypeMap;
		this.iComponentType = iComponentType;
		if(!isValidComponentType())
		{
			throw new InvalidComponentTypeException(this.getClass().getSimpleName());
		}
	}
	/**
	 * Constructor for XTN 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 XTN(int iComponentType,int iMinLength, int iMaxLength, String strCLength,IDataTypeMap objIDataTypeMap)
	{
		super(EnumDataType.HL7_DT_XTN);
		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 XTN 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 XTN(int iComponentType,int iMinLength, int iMaxLength, String strCLength,int ITableNo,IDataTypeMap objIDataTypeMap)
	{
		super(EnumDataType.HL7_DT_XTN);
		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 TelecommunicationUseCode.
	 *@param strTelecommunicationUseCode Specifies a code that represents a specific use of a telecommunication number.
 										Suggested values are PRN,ORN,WPN,VHN,ASN,EMR,NET,BPN  [Refer table 0201.]
	 */
	public void setTelecommunicationUseCode(String strTelecommunicationUseCode)
	{
		if(strTelecommunicationUseCode!=null)
			setComponentType(2, strTelecommunicationUseCode);
		else
			setTelecommunicationUseCode((ID)null);
	}

	/**
	 *Sets the TelecommunicationUseCode.
	 *@param objID Specifies a code that represents a specific use of a telecommunication number.
 										Suggested values are PRN,ORN,WPN,VHN,ASN,EMR,NET,BPN  [Refer table 0201.]
	 */
	public void setTelecommunicationUseCode(ID objID)
	{
		setComponentType(2,objID);
	}

	/**
	 * Sets the TelecommunicationEquipmentType.
	 * @param strTelecommunicationEquipmentType Specifies a code that represents the type of telecommunication equipment.
	 * 											  Suggested values are PH,FX,MD,CP,BP,Internet,X.400,TDD,TTY  [Refer table 0202.]
	 */
	public void setTelecommunicationEquipmentType(String strTelecommunicationEquipmentType)
	{
		if(strTelecommunicationEquipmentType!=null)
			setComponentType(3, strTelecommunicationEquipmentType);
		else
			setTelecommunicationEquipmentType((ID)null);
	} 

	/**
	 * Sets the TelecommunicationEquipmentType.
	 * @param objID Specifies a code that represents the type of telecommunication equipment.
	 * 											  Suggested values are PH,FX,MD,CP,BP,Internet,X.400,TDD,TTY  [Refer table 0202.]
	 */
	public void setTelecommunicationEquipmentType(ID objID)
	{
		setComponentType(3,objID);
	}

	/**
	 *Sets the CommuinicationAddress.
	 *@param strCommuinicationAddress Specifies Email address. 
	 */
	public void setCommuinicationAddress(String strCommuinicationAddress)
	{
		if(strCommuinicationAddress!=null)
			setComponentType(4, strCommuinicationAddress);
		else
			setCommuinicationAddress((ST)null);
	}

	/**
	 *Sets the CommuinicationAddress.
	 *@param objST Specifies Email address.
	 */
	public void setCommuinicationAddress(ST objST)
	{
		setComponentType(4,objST);
	}

	/**
	 *Sets the CountryCode.
	 *@param strCountryCode Specifies the Country code. 
	 */
	public void setCountryCode(String strCountryCode)
	{
		if(strCountryCode!=null)
			setComponentType(5, strCountryCode);
		else
			setCountryCode((SNM)null);
	}
	
	/**
	 *Sets the CountryCode.
	 *@param objSNM Specifies the Country code.
	 */
	public void setCountryCode(SNM objSNM)
	{
		setComponentType(5,objSNM);
	}
	
	/**
	 *Sets the AreaCityCode.
	 *@param strAreaCityCode Specifies the area /City Code. 
	 */
	public void setAreaCityCode(String strAreaCityCode)
	{
		if(strAreaCityCode!=null)
			setComponentType(6, strAreaCityCode);
		else
			setAreaCityCode((SNM)null);
	}

	/**
	 *Sets the AreaCityCode.
	 *@param objSNM Specifies the area /City Code.
	 */
	public void setAreaCityCode(SNM objSNM)
	{
		setComponentType(6,objSNM);
	}

	/**
	 *Sets the LocalNumber.
	 *@param strLocalNumber Specifies an Local Number. 
	 */
	public void setLocalNumber(String strLocalNumber)
	{
		if(strLocalNumber!=null)
			setComponentType(7, strLocalNumber);
		else
			setLocalNumber((SNM)null);
	}
	
	/**
	 *Sets the LocalNumber.
	 *@param objSNM Specifies an Local Number.
	 */
	public void setLocalNumber(SNM objSNM)
	{
		setComponentType(7,objSNM);
	}


	/**
	 *Sets the Extension.
	 *@param strExtension Specifies an Extension. 
	 */
	public void setExtension(String strExtension)
	{
		if(strExtension!=null)
			setComponentType(8, strExtension);
		else
			setExtension((SNM)null);
	}
	
	/**
	 *Sets the Extension.
	 *@param objSNM Specifies an Extension.
	 */
	public void setExtension(SNM objSNM)
	{
		setComponentType(8,objSNM);
	}

	/**
	 *Sets the AnyText.
	 *@param strAnyText Contains comments with respect to the telephone number. 
	 */
	public void setAnyText(String strAnyText)
	{
		if(strAnyText!=null)
			setComponentType(9, strAnyText);
		else
			setAnyText((ST)null);
	}

	/**
	 *Sets the AnyText.
	 *@param objST Contains comments with respect to the telephone number.
	 */
	public void setAnyText(ST objST)
	{
		setComponentType(9,objST);
	}

	/**
	 *Sets the ExtensionPrefix.
	 *@param strExtensionPrefix Specifies the characters established within a company's 
	 * 							   internal telephone system network used as a prefix to the Extension component for internal dialing. 
	 */
	public void setExtensionPrefix(String strExtensionPrefix)
	{
		if(strExtensionPrefix!=null)
			setComponentType(10, strExtensionPrefix);
		else
			setExtensionPrefix((ST)null);
	}

	/**
	 *Sets the ExtensionPrefix.
	 *@param objST Specifies the characters established within a company's 
	 * 							   internal telephone system network used as a prefix to the Extension component for internal dialing. 
	 */
	public void setExtensionPrefix(ST objST)
	{
		setComponentType(10,objST);
	}

	/**
	 * Sets the SpeedDialCode.
	 * @param strSpeedDialCode Specifies The characters established within a 
	 * 							 company's internal telephone system used in place of the (external) telephone number.
	 */
	public void setSpeedDialCode(String strSpeedDialCode)
	{
		if(strSpeedDialCode!=null)
			setComponentType(11, strSpeedDialCode);
		else
			setSpeedDialCode((ST)null);
	}  
	/**
	 * Sets the SpeedDialCode.
	 * @param objST Specifies The characters established within a 
	 * 							 company's internal telephone system used in place of the (external) telephone number.
	 */
	public void setSpeedDialCode(ST objST)
	{
		setComponentType(11,objST);
	}


	/**
	 *Sets the UnformattedTelephonenumber.
	 *@param strUnformattedPhNo Specifies an expression of the telephone number as an unparsible string. 
	 */
	public void setUnformattedTelephonenumber(String strUnformattedPhNo)
	{
		if(strUnformattedPhNo!=null)
			setComponentType(12, strUnformattedPhNo);
		else
			setUnformattedTelephonenumber((ST)null);
	}

	/**
	 *Sets the UnformattedTelephonenumber.
	 *@param objST Specifies an expression of the telephone number as an unparsible string.
	 */
	public void setUnformattedTelephonenumber(ST objST)
	{
		setComponentType(12,objST);
	}
	
	/**
	 *Sets the Effective Start Date.
	 *@param strEffectiveStartDate Specifies The first date, if known, on which the telecommunication number is valid and active. 
	 */
	public void setEffectiveStartDate(String strEffectiveStartDate)
	{
		if(strEffectiveStartDate!=null)
			setComponentType(13, strEffectiveStartDate);
		else
			setEffectiveStartDate((DTM)null);
	}

	/**
	 *Sets the Effective Start Date.
	 *@param objDTM Specifies The first date, if known, on which the telecommunication number is valid and active.
	 */
	public void setEffectiveStartDate(DTM objDTM)
	{
		setComponentType(13,objDTM);
	}
	
	/**
	 *Sets the Expiration Date.
	 *@param strExpirationDate Specifies The last date, if known, on which the telecommunication number is valid and active.
	 */
	public void setExpirationDate(String strExpirationDate)
	{
		if(strExpirationDate!=null)
			setComponentType(14, strExpirationDate);
		else
			setExpirationDate((DTM)null);
	}

	/**
	 *Sets the Expiration Date.
	 *@param objDTM Specifies The last date, if known, on which the telecommunication number is valid and active.
	 */
	public void setExpirationDate(DTM objDTM)
	{
		setComponentType(14,objDTM);
	}
	
	/**
	 *Sets the Expiration Reason.
	 *@param objCWE Specifies Indicates why this contact number/e-mail was marked as "ended".
	 */
	public void setExpirationReason(CWE objCWE)
	{
		setComponentType(15,objCWE);
	}
	
	/**
	 *Sets the  Protection Code .
	 *@param objCWE Indicates whether this information is considered sensitive or should be protected in some way.
	 */
	public void setProtectionCode (CWE objCWE)
	{
		setComponentType(16,objCWE);
	}
	
	/**
	 *Sets the  Shared Telecommunication Identifier.
	 *@param objEI A unique identifier for the phone number or e-mail address.
	 */
	public void setSharedTelecommunicationIdentifier (EI objEI)
	{
		setComponentType(17,objEI);
	}
	
	/**
	 *Sets the Preference Order.
	 *@param strPreferenceOrder indicates which is the "most preferred" (lowest number) to "least preferred" (highest number).
	 */
	public void setPreferenceOrder(String strPreferenceOrder)
	{
		if(strPreferenceOrder!=null)
			setComponentType(18, strPreferenceOrder);
		else
			setPreferenceOrder((NM)null);
	}

	/**
	 *Sets the Preference Order.
	 *@param objNM indicates which is the "most preferred" (lowest number) to "least preferred" (highest number).
	 */
	public void setPreferenceOrder(NM objNM)
	{
		setComponentType(18,objNM);
	}

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

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

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

	/**
	 * Returns Country Code
	 * @return SNM - data type.
	 */ 
	public SNM getCountryCode()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(5);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (SNM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns Area/City Code
	 * @return SNM - data type.
	 */
	public SNM getAreaCityCode()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(6);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (SNM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns Local Number
	 * @return SNM - data type.
	 */
	public SNM getLocalNumber()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(7);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (SNM)objDataCollection.elementAt(0);
		else
			return null;
	}
	/**
	 * Returns Extension
	 * @return SNM - data type.
	 */
	public SNM getExtension()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(8);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (SNM)objDataCollection.elementAt(0);
		else
			return null;
	}

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

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

	/**
	 * Returns Speed Dial Code
	 * @return ST - data type.
	 */
	public ST getSpeedDialCode()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(11);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Returns Unformatted Telephone number 
	 * @return ST - data type.
	 */
	public ST getUnformattedTelephonenumber()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(12);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Returns Effective Start Date
	 * @return DTM - data type.
	 */
	public DTM getEffectiveStartDate()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(13);
		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(14);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Returns Expiration Reason
	 * @return CWE - data type.
	 */
	public CWE getExpirationReason()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(15);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Returns Protection Code
	 * @return CWE - data type.
	 */
	public CWE getProtectionCode()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(16);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Returns Shared Telecommunication Identifier
	 * @return EI - data type.
	 */
	public EI getSharedTelecommunicationIdentifier()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(17);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (EI)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Returns Preference Order 
	 * @return NM - data type.
	 */
	public NM getPreferenceOrder()
	{
		ISingleCollection<IDataType> objDataCollection =getComponentType(18);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (NM)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 false.
	 * @throws InvalidDataTypeException - if Invalid values is entered or Mandatory field is missing.
	 */
	public boolean validate() throws InvalidDataTypeException
	{
		super.validate();
		if(getComponentType(3)== null)
		{
			throw new MissingValueException(this.getClass().getSimpleName() + "Telecommunication Equipment Type");	
		}
		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 XTN)))
			return false;

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

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

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

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

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

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

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

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

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

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

		if(this.getUnformattedTelephonenumber() == null)
		{
			if(((XTN)objObject).getUnformattedTelephonenumber() != null)
				return false;
		}
		else if(false == (this.getUnformattedTelephonenumber().equals(((XTN)objObject).getUnformattedTelephonenumber())))
			return false;
		
		if(this.getEffectiveStartDate() == null)
		{
			if(((XTN)objObject).getEffectiveStartDate() != null)
				return false;
		}
		else if(false == (this.getEffectiveStartDate().equals(((XTN)objObject).getEffectiveStartDate())))
			return false;
		
		if(this.getExpirationDate() == null)
		{
			if(((XTN)objObject).getExpirationDate() != null)
				return false;
		}
		else if(false == (this.getExpirationDate().equals(((XTN)objObject).getExpirationDate())))
			return false;
		
		if(this.getExpirationReason() == null)
		{
			if(((XTN)objObject).getExpirationReason() != null)
				return false;
		}
		else if(false == (this.getExpirationReason().equals(((XTN)objObject).getExpirationReason())))
			return false;
		
		if(this.getProtectionCode() == null)
		{
			if(((XTN)objObject).getProtectionCode() != null)
				return false;
		}
		else if(false == (this.getProtectionCode().equals(((XTN)objObject).getProtectionCode())))
			return false;
		
		if(this.getSharedTelecommunicationIdentifier() == null)
		{
			if(((XTN)objObject).getSharedTelecommunicationIdentifier() != null)
				return false;
		}
		else if(false == (this.getSharedTelecommunicationIdentifier().equals(((XTN)objObject).getSharedTelecommunicationIdentifier())))
			return false;
		
		if(this.getPreferenceOrder() == null)
		{
			if(((XTN)objObject).getPreferenceOrder() != null)
				return false;
		}
		else if(false == (this.getPreferenceOrder().equals(((XTN)objObject).getPreferenceOrder())))
			return false;

		return true;
	}
}
