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

import cdac.medinfo.sdk.hl7282.baselibs.CWE;
import cdac.medinfo.sdk.hl7282.baselibs.EI;
import cdac.medinfo.sdk.hl7282.baselibs.ID;
import cdac.medinfo.sdk.hl7282.baselibs.NM;
import cdac.medinfo.sdk.hl7282.baselibs.SN;
import cdac.medinfo.sdk.hl7282.commoninterface.IDataType;
import cdac.medinfo.sdk.hl7282.commoninterface.ISingleCollection;
import cdac.medinfo.sdk.hl7282.exceptions.FieldMissingException;
import cdac.medinfo.sdk.hl7282.exceptions.InvalidSegmentException;
import cdac.medinfo.sdk.hl7282.utils.EnumSegments;

/**
 * TCC - Test Code Configuration Segment<p>
 * The test (e.g., analyte) code configuration segment is the data necessary to 
 * maintain and transmit information concerning the test entity codes that are being used throughout the "automated system."
 * <p>Represents an HL7 TCC message segment. 
 * This segment has the following fields:</p><p>
 * TCC-1: Universal Service Identifier (CWE)<b>Required</b><br> 
 * TCC-2: Test Application Identifier (EI)<b>Required</b><br> 
 * TCC-3: Specimen Source (SPS)<b>Withdrawn</b><br> 
 * TCC-4: Auto-Dilution Factor Default (SN)<b>Optional</b><br> 
 * TCC-5: Rerun Dilution Factor Default (SN)<b>Optional</b><br> 
 * TCC-6: Pre-Dilution Factor Default (SN)<b>Optional</b><br> 
 * TCC-7: Endogenous Content of Pre-Dilution Diluent (SN)<b>Optional</b><br> 
 * TCC-8: Inventory Limits Warning Level (NM)<b>Optional</b><br> 
 * TCC-9: Automatic Rerun Allowed (ID)<b>Optional</b><br> 
 * TCC-10: Automatic Repeat Allowed (ID)<b>Optional</b><br> 
 * TCC-11: Automatic Reflex Allowed (ID)<b>Optional</b><br> 
 * TCC-12: Equipment Dynamic Range (SN)<b>Optional</b><br> 
 * TCC-13: Units (CWE)<b>Optional</b><br> 
 * TCC-14: Processing Type (CWE)<b>Optional</b><br>
 * TCC-15: Test Criticality (CWE)<b>Optional</b><br></p>
 * This class provides mechanism to validate message against HL7 v 2.8.2 standard.
 * The class provides accessors & mutators for the elements mentioned above.
 * The class has validate method which validates Message against HL7 v 2.8.2 standard.
 *
 * <p>User can also create Segment through {@link SegmentFactory}
 */
 public class TCC extends Segment   
{
	

	/***
	 * Constructs the TCC segment.
	 */
	public TCC()
	{super(EnumSegments.HL7_SEG_TCC);
	}

	//Integer values used in getter/setter is unique item id defined 
	//for each attribute.

	/**
	 * Retrieves the Auto Dilution Factor Default.
	 * This field specify the value that is to be used as the default factor for automatically diluting a specimen by an instrument for this particular test code.  
	 * @return SN - autoDilutionFactorDefault
	 */
	public SN getAutoDilutionFactorDefault() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1410);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (SN)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Automatic Reflex Allowed.
	 * This field identifies whether automatic or manual reflex testing is to be initiated on specimens for this particular test code
	 * @return String - automaticReflexAllowed
	 */
	public ID getAutomaticReflexAllowed() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1417);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Automatic Repeat Allowed.
	 * This field identifies whether automatic repeat testing is to be initiated on specimens for this particular test code or not.
	 * @return String - automaticRepeatAllowed
	 */
	public ID getAutomaticRepeatAllowed() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1416);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Automatic Rerun Allowed.
	 * This field identifies whether automatic reruns are to be initiated on specimens for this particular test code or not. 
	 * @return String - automaticRerunAllowed
	 */
	public ID getAutomaticRerunAllowed()
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1415);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Endogenous Content of Pre Dilution Diluent.
	 * This field represents a baseline value for the measured test that is inherently contained in the diluent.
	 * @return SN - endogenousContentofPreDilutionDiluent
	 */
	public SN getEndogenousContentofPreDilutionDiluent() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1413);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (SN)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Equipment Dynamic Range.
	 * This field specify the range over which the equipment can produce results. 
	 * @return SN - equipmentDynamicRange
	 */
	public SN getEquipmentDynamicRange() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1418);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (SN)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Inventory Limits Warning Level.
	 * This field specify the value that is to be used as the threshold for initiating inventory warning-level messages.
	 * @return String - inventoryLimitsWarningLevel
	 */
	public NM getInventoryLimitsWarningLevel()
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1414);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (NM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Pre Dilution Factor Default.
	 * This field specify the value that is to be used as the default factor for a specimen that is delivered to the laboratory automation system as pre-diluted for this particular test code.
	 * @return SN - preDilutionFactorDefault
	 */
	public SN getPreDilutionFactorDefault() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1412);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (SN)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Processing Type.
	 * This field identify the processing type that applies to this test code. 
	 * @return CWE - processingType
	 */
	public CWE getProcessingType() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1419);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Rerun Dilution Factor Default.
	 * This field specify the value that is to be used as the default factor for automatically diluting a specimen in case of rerun for this particular test code.
	 * @return SN - rerunDilutionFactorDefault
	 */
	public SN getRerunDilutionFactorDefault() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1411);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (SN)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Test Application Identifier.
	 * This field identifies the test application code assigned by the manufacturer of the equipment or reagents and associated with performing of the particular test specified by the Universal Test Identifier.
	 * @return EI - testApplicationIdentifier
	 */
	public EI getTestApplicationIdentifier() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1408);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (EI)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Units. 
	 * @return CWE - units
	 */
	public CWE getUnits() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(574);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Universal Service Identifier.
	 * This field identifies the test code that information is being transmitted.
	 * @return CWE - universalServiceIdentifier
	 */
	public CWE getUniversalServiceIdentifier() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(238);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Set the Auto Dilution Factor Default.
	 * This field specify the value that is to be used as the default factor for automatically diluting a specimen by an instrument for this particular test code.  
	 * @param strComparator Specifies as greater than, less than, greater than or equal, less than or equal,
	 * 						 equal, and not equal, respectively 
	 * @param strNum1 Specifies A number. 
	 * @param strSeparatorSuffix Specifies Separat or Suffix 
	 * @param strNum2 Specifies A number or null depending on the measurement.
	 */ 
	public void setAutoDilutionFactorDefault (String strComparator,String strNum1,String strSeparatorSuffix,String strNum2) 
	{
		SN autoDilutionFactorDefault  = (SN)getDataElement(1410);
		autoDilutionFactorDefault.setComparator(strComparator);
		autoDilutionFactorDefault.setNum1(strNum1);
		autoDilutionFactorDefault.setSeparatorSuffix(strSeparatorSuffix);
		autoDilutionFactorDefault.setNum2(strNum2); 
		setAutoDilutionFactorDefault(autoDilutionFactorDefault);

	} 

	/** 
	 * Set the Auto Dilution Factor Default.
	 * This field specify the value that is to be used as the default factor for automatically diluting a specimen by an instrument for this particular test code.  
	 * @param objautoDilutionFactorDefault Object of Auto Dilution Factor Default.
	 */ 
	public void setAutoDilutionFactorDefault(SN objautoDilutionFactorDefault)
	{
		setDataType(1410,objautoDilutionFactorDefault);

	}

	/**
	 * Set the Automatic Reflex Allowed.
	 * This field identifies whether automatic or manual reflex testing is to be initiated on specimens for this particular test code  
	 * @param strActionCode Specifies the the intent of the message    
	 */ 
	public void setAutomaticReflexAllowed (String strActionCode)
	{
		ID automaticReflexAllowed  = (ID)getDataElement(1417);
		automaticReflexAllowed.setValue(strActionCode); 
		setAutomaticReflexAllowed(automaticReflexAllowed);

	} 

	/** Set the Automatic Reflex Allowed.
	 * This field identifies whether automatic or manual reflex testing is to be initiated on specimens for this particular test code  
	 * @param objautomaticReflexAllowed Object of Automatic Reflex Allowed.    
	 */ 
	public void setAutomaticReflexAllowed(ID objautomaticReflexAllowed)
	{
		setDataType(1417,objautomaticReflexAllowed);

	}

	/**
	 * Set the Automatic Repeat Allowed.
	 * This field identifies whether automatic repeat testing is to be initiated on specimens for this particular test code or not.  
	 * @param strActionCode Specifies the the intent of the message    
	 */ 
	public void setAutomaticRepeatAllowed (String strActionCode)
	{
		ID automaticRepeatAllowed  = (ID)getDataElement(1416);
		automaticRepeatAllowed.setValue(strActionCode); 
		setAutomaticRepeatAllowed(automaticRepeatAllowed);

	} 

	/** Set the Automatic Repeat Allowed.
	 * This field identifies whether automatic repeat testing is to be initiated on specimens for this particular test code or not.  
	 * @param objautomaticRepeatAllowed Object of Automatic Repeat Allowed.    
	 */ 
	public void setAutomaticRepeatAllowed(ID objautomaticRepeatAllowed)
	{
		setDataType(1416,objautomaticRepeatAllowed);

	}

	/**
	 * Set the Automatic Rerun Allowed.
	 * This field identifies whether automatic reruns are to be initiated on specimens for this particular test code or not.   
	 * @param strActionCode Specifies the the intent of the message    
	 */ 
	public void setAutomaticRerunAllowed (String strActionCode)
	{
		ID automaticRerunAllowed  = (ID)getDataElement(1415);
		automaticRerunAllowed.setValue(strActionCode); 
		setAutomaticRerunAllowed(automaticRerunAllowed);

	} 

	/** Set the Automatic Rerun Allowed.
	 * This field identifies whether automatic reruns are to be initiated on specimens for this particular test code or not.   
	 * @param objautomaticRerunAllowed Object of Automatic Rerun Allowed.    
	 */ 
	public void setAutomaticRerunAllowed(ID objautomaticRerunAllowed)
	{
		setDataType(1415,objautomaticRerunAllowed);

	}


	/**
	 * Set the Endogenous Content of Pre Dilution Diluent.
	 * This field represents a baseline value for the measured test that is inherently contained in the diluent.
	 * @param strComparator Specifies as greater than, less than, greater than or equal, less than or equal,
	 * 						 equal, and not equal, respectively 
	 * @param strNum1 Specifies A number. 
	 * @param strSeparatorSuffix Specifies Separat or Suffix 
	 * @param strNum2 Specifies A number or null depending on the measurement.
	 */ 
	public void setEndogenousContentofPreDilutionDiluent (String strComparator,String strNum1,String strSeparatorSuffix,String strNum2) 
	{
		SN endogenousContentofPreDilutionDiluent  = (SN)getDataElement(1413);
		endogenousContentofPreDilutionDiluent.setComparator(strComparator);
		endogenousContentofPreDilutionDiluent.setNum1(strNum1);
		endogenousContentofPreDilutionDiluent.setSeparatorSuffix(strSeparatorSuffix);
		endogenousContentofPreDilutionDiluent.setNum2(strNum2); 
		setEndogenousContentofPreDilutionDiluent(endogenousContentofPreDilutionDiluent);

	} 

	/** 
	 * Set the Endogenous Content of Pre Dilution Diluent.
	 * This field represents a baseline value for the measured test that is inherently contained in the diluent.
	 * @param objendogenousContentofPreDilutionDiluent Object of Endogenous Content of Pre Dilution Diluent.
	 */ 
	public void setEndogenousContentofPreDilutionDiluent(SN objendogenousContentofPreDilutionDiluent)
	{
		setDataType(1413,objendogenousContentofPreDilutionDiluent);

	}

	/**
	 * Set the Equipment Dynamic Range.
	 * This field specify the range over which the equipment can produce results. 
	 * @param strComparator Specifies as greater than, less than, greater than or equal, less than or equal,
	 * 						 equal, and not equal, respectively 
	 * @param strNum1 Specifies A number. 
	 * @param strSeparatorSuffix Specifies Separate or Suffix 
	 * @param strNum2 Specifies A number or null depending on the measurement.
	 */ 
	public void setEquipmentDynamicRange (String strComparator,String strNum1,String strSeparatorSuffix,String strNum2) 
	{
		SN equipmentDynamicRange  = (SN)getDataElement(1418);
		equipmentDynamicRange.setComparator(strComparator);
		equipmentDynamicRange.setNum1(strNum1);
		equipmentDynamicRange.setSeparatorSuffix(strSeparatorSuffix);
		equipmentDynamicRange.setNum2(strNum2); 
		setEquipmentDynamicRange(equipmentDynamicRange);

	} 

	/** Set the Equipment Dynamic Range.
	 * This field specify the range over which the equipment can produce results. 
	 * @param objequipmentDynamicRange Object of Equipment Dynamic Range.
	 */ 
	public void setEquipmentDynamicRange(SN objequipmentDynamicRange)
	{
		setDataType(1418,objequipmentDynamicRange);

	}

	/** 
	 * Set the Inventory Limits Warning Level.
	 * This field specify the value that is to be used as the threshold for initiating inventory warning-level messages.
	 * @param strPolicyLimitDays Specifies the maximum number of days that the insurance policy will cover.
	 */ 
	public void setInventoryLimitsWarningLevel (String strPolicyLimitDays) 
	{
		NM inventoryLimitsWarningLevel  = (NM)getDataElement(1414);
		inventoryLimitsWarningLevel.setValue(strPolicyLimitDays); 
		setInventoryLimitsWarningLevel(inventoryLimitsWarningLevel);

	} 

	/** 
	 * Set the Inventory Limits Warning Level.
	 * This field specify the value that is to be used as the threshold for initiating inventory warning-level messages.
	 * @param objinventoryLimitsWarningLevel Object of Inventory Limits Warning Level.
	 */ 
	public void setInventoryLimitsWarningLevel(NM objinventoryLimitsWarningLevel)
	{
		setDataType(1414,objinventoryLimitsWarningLevel);

	}

	/**
	 * Set the Pre Dilution Factor Default.
	 * This field specify the value that is to be used as the default factor for a specimen that is delivered to the laboratory automation system as pre-diluted for this particular test code.
	 * @param strComparator Specifies as greater than, less than, greater than or equal, less than or equal,
	 * 						 equal, and not equal, respectively 
	 * @param strNum1 Specifies A number. 
	 * @param strSeparatorSuffix Specifies Separat or Suffix 
	 * @param strNum2 Specifies A number or null depending on the measurement.
	 */ 
	public void setPreDilutionFactorDefault (String strComparator,String strNum1,String strSeparatorSuffix,String strNum2) 
	{
		SN preDilutionFactorDefault  = (SN)getDataElement(1412);
		preDilutionFactorDefault.setComparator(strComparator);
		preDilutionFactorDefault.setNum1(strNum1);
		preDilutionFactorDefault.setSeparatorSuffix(strSeparatorSuffix);
		preDilutionFactorDefault.setNum2(strNum2); 
		setPreDilutionFactorDefault(preDilutionFactorDefault);

	} 

	/** Set the Pre Dilution Factor Default.
	 * This field specify the value that is to be used as the default factor for a specimen that is delivered to the laboratory automation system as pre-diluted for this particular test code.
	 * @param objpreDilutionFactorDefault Object of Pre Dilution Factor Default.
	 */ 
	public void setPreDilutionFactorDefault(SN objpreDilutionFactorDefault)
	{
		setDataType(1412,objpreDilutionFactorDefault);

	}

	/**
	 * Set the Rerun Dilution Factor Default.
	 * This field specify the value that is to be used as the default factor for automatically diluting a specimen in case of rerun for this particular test code.
	 * @param strComparator Specifies as greater than, less than, greater than or equal, less than or equal,
	 * 						 equal, and not equal, respectively 
	 * @param strNum1 Specifies A number. 
	 * @param strSeparatorSuffix Specifies Separat or Suffix 
	 * @param strNum2 Specifies A number or null depending on the measurement.
	 */ 
	public void setRerunDilutionFactorDefault (String strComparator,String strNum1,String strSeparatorSuffix,String strNum2) 
	{
		SN rerunDilutionFactorDefault  = (SN)getDataElement(1411);
		rerunDilutionFactorDefault.setComparator(strComparator);
		rerunDilutionFactorDefault.setNum1(strNum1);
		rerunDilutionFactorDefault.setSeparatorSuffix(strSeparatorSuffix);
		rerunDilutionFactorDefault.setNum2(strNum2); 
		setRerunDilutionFactorDefault(rerunDilutionFactorDefault);

	} 

	/** Set the Rerun Dilution Factor Default.
	 * This field specify the value that is to be used as the default factor for automatically diluting a specimen in case of rerun for this particular test code.
	 * @param objrerunDilutionFactorDefault Object of Rerun Dilution Factor Default.
	 */ 
	public void setRerunDilutionFactorDefault(SN objrerunDilutionFactorDefault)
	{
		setDataType(1411,objrerunDilutionFactorDefault);

	}

	/**
	 * Set the Processing Type.
	 * This field identify the processing type that applies to this test code. 
	 * @param strIdentifier Specifies of characters (the code) that uniquely identifies the item being referenced. 
	 * @param strText Specifies The descriptive or textual name of the identifier, e.g., myocardial infarction. 
	 * @param strNameOfCodingSystem Identifies the coding scheme being used in the identifier component.
	 * @param strAlternateIdentifier Specifies an alternate sequence of characters (the code) that uniquely identifies the item being referenced.
	 * @param strAlternateText Specifies the descriptive or textual name of the alternate identifier. See usage note in section introduction.
	 * @param strNameOfAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */ 
	public void setProcessingType (String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String 				strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(1419);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID);
		setProcessingType(cwe);

	} 

	/** 
	 * Set the Processing Type.
	 * This field identify the processing type that applies to this test code. 
	 * @param objprocessingType Object of Processing Type.
	 */ 
	public void setProcessingType(CWE objprocessingType)
	{
		setDataType(1419,objprocessingType);

	}

	/**
	 * Set the Test Application Identifier.
	 * This field identifies the test application code assigned by the manufacturer of the equipment or reagents and associated with performing of the particular test specified by the Universal Test Identifier.
	 * @param strEntityIdentifier Specifies defined by a hierarchic designator, represented by components 2 through 4.
	 * 								[Reference Section 2.A.33, "HD - hierarchic designator".] 
	 * @param strNamespaceId Specifies  the HL7 identifier for the user-defined table of values for this component.
	 * 						   [Refer to User-defined Table 0363 - Assigning authority] 	 
	 * @param strUniversalId Specifies string formatted according to the scheme defined by the component, 
	 * 							<universal ID type> (UID type). 
	 * @param strUniversalIdType Specifies  the interpretation of the second component of the HD. 
	 */ 
	public void setTestApplicationIdentifier (String strEntityIdentifier,String strNamespaceId,
			String strUniversalId,String strUniversalIdType)
	{
		EI testApplicationIdentifier  = (EI)getDataElement(1408);
		testApplicationIdentifier.setEntityIdentifier(strEntityIdentifier);
		testApplicationIdentifier.setNamespaceId(strNamespaceId);
		testApplicationIdentifier.setUniversalId(strUniversalId);
		testApplicationIdentifier.setUniversalIdType(strUniversalIdType); 
		setTestApplicationIdentifier(testApplicationIdentifier);

	} 

	/** Set the Test Application Identifier.
	 * This field identifies the test application code assigned by the manufacturer of the equipment or reagents and associated with performing of the particular test specified by the Universal Test Identifier.
	 * @param objtestApplicationIdentifier Object of Test Application Identifier. 
	 */ 
	public void setTestApplicationIdentifier(EI objtestApplicationIdentifier)
	{
		setDataType(1408,objtestApplicationIdentifier);

	}

	/**
	 * Set the Units. 
	 * @param strIdentifier Specifies of characters (the code) that uniquely identifies the item being referenced. 
	 * @param strText Specifies The descriptive or textual name of the identifier, e.g., myocardial infarction. 
	 * @param strNameOfCodingSystem Identifies the coding scheme being used in the identifier component.
	 * @param strAlternateIdentifier Specifies an alternate sequence of characters (the code) that uniquely identifies the item being referenced.
	 * @param strAlternateText Specifies the descriptive or textual name of the alternate identifier. See usage note in section introduction.
	 * @param strNameOfAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */
	public void setUnits (String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String 				strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(574);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID); 
		setUnits(cwe);

	} 

	/** Set the Units. 
	 * @param objunits Object of Units.
	 */ 
	public void setUnits(CWE objunits)
	{
		setDataType(574,objunits);

	}

	/**
	 * Set the Universal Service Identifier.
	 * This field identifies the test code that information is being transmitted.
	 * @param strIdentifier Specifies of characters (the code) that uniquely identifies the item being referenced. 
	 * @param strText Specifies The descriptive or textual name of the identifier, e.g., myocardial infarction. 
	 * @param strNameOfCodingSystem Identifies the coding scheme being used in the identifier component.
	 * @param strAlternateIdentifier Specifies an alternate sequence of characters (the code) that uniquely identifies the item being referenced.
	 * @param strAlternateText Specifies the descriptive or textual name of the alternate identifier. See usage note in section introduction.
	 * @param strNameOfAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */ 
	public void setUniversalServiceIdentifier (String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String 				strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(238);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID); 
		setUniversalServiceIdentifier(cwe);

	} 

	/** Set the Universal Service Identifier.
	 * This field identifies the test code that information is being transmitted.
	 * @param objuniversalServiceIdentifier Object of Universal Service Identifier.
	 */ 
	public void setUniversalServiceIdentifier(CWE objuniversalServiceIdentifier)
	{
		setDataType(238,objuniversalServiceIdentifier);

	}
	
	/**
	 * Retrieves the Test Criticality.
	 * This field identifies the test the Test Criticality. The values in this field are used for decisions, which tests should be performed, in case of, e.g., insufficient specimen volume.  
	 * @return CWE - TestCriticality
	 */
	public CWE getTestCriticality() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3313);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Test Criticality.
	 * This field identifies the test the Test Criticality. The values in this field are used for decisions, which tests should be performed, in case of, e.g., insufficient specimen volume. 
	 * @param strIdentifier Specifies of characters (the code) that uniquely identifies the item being referenced. 
	 * @param strText Specifies The descriptive or textual name of the identifier, e.g., myocardial infarction. 
	 * @param strNameOfCodingSystem Identifies the coding scheme being used in the identifier component.
	 * @param strAlternateIdentifier Specifies an alternate sequence of characters (the code) that uniquely identifies the item being referenced.
	 * @param strAlternateText Specifies the descriptive or textual name of the alternate identifier. See usage note in section introduction.
	 * @param strNameOfAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */
	public void setTestCriticality(String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String 				strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(3313);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID);
		setTestCriticality(cwe);
	}

	/**
	 * Set the Test Criticality.
	 * This field identifies the test the Test Criticality. The values in this field are used for decisions, which tests should be performed, in case of, e.g., insufficient specimen volume. 
	 * @param objTestCriticality Object of Test Criticality.
	 */
	public void setTestCriticality(CWE objTestCriticality)
	{
		setDataType(3313,objTestCriticality);
	}

	/**
	 * Validates HL7 Message objects .
	 * Validate method checks for validation each and every segments in side the Message object against specified message Structure. 
	 * Validation checks include optionality of segment or group.
	 * It also verifies the number of times segment or group is repeated in message.
	 * e.g 
	 * {PSH} while parsing PSH segment validate method will check for its mandatory presence.
	 * [PSH] in this case validate will throw exception if one tries to enter more than one PSH segment.
	 * @return boolean - true or false.
	 * @throws InvalidSegmentException Throws when Segment Validation fails.
	 */	
	@Override
	public boolean validate() throws InvalidSegmentException 
	{
		/*
		 * Universal Service Identifier,Test Application Identifier  are required fields.
		 */
		try
		{
			super.validate();

			return true;
		}
		catch(FieldMissingException ex)
		{
			throw new InvalidSegmentException(enumSegments.getValue(),ex);
		}		
	}
}