/*******************************************************************************
 *  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 java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;

import cdac.medinfo.sdk.hl7282.baselibs.CNE;
import cdac.medinfo.sdk.hl7282.baselibs.CWE;
import cdac.medinfo.sdk.hl7282.baselibs.DTM;
import cdac.medinfo.sdk.hl7282.baselibs.EI;
import cdac.medinfo.sdk.hl7282.baselibs.FN;
import cdac.medinfo.sdk.hl7282.baselibs.HD;
import cdac.medinfo.sdk.hl7282.baselibs.ID;
import cdac.medinfo.sdk.hl7282.baselibs.NM;
import cdac.medinfo.sdk.hl7282.baselibs.OG;
import cdac.medinfo.sdk.hl7282.baselibs.SAD;
import cdac.medinfo.sdk.hl7282.baselibs.SI;
import cdac.medinfo.sdk.hl7282.baselibs.ST;
import cdac.medinfo.sdk.hl7282.baselibs.XAD;
import cdac.medinfo.sdk.hl7282.baselibs.XCN;
import cdac.medinfo.sdk.hl7282.baselibs.XON;
import cdac.medinfo.sdk.hl7282.baselibs.segmentfactory.DataElementFactory;
import cdac.medinfo.sdk.hl7282.commoninterface.IDataType;
import cdac.medinfo.sdk.hl7282.commoninterface.IDelimiter;
import cdac.medinfo.sdk.hl7282.commoninterface.ISingleCollection;
import cdac.medinfo.sdk.hl7282.exceptions.FieldMissingException;
import cdac.medinfo.sdk.hl7282.exceptions.InvalidDataTypeException;
import cdac.medinfo.sdk.hl7282.exceptions.InvalidDelimiterException;
import cdac.medinfo.sdk.hl7282.exceptions.InvalidFieldException;
import cdac.medinfo.sdk.hl7282.exceptions.InvalidSegmentException;
import cdac.medinfo.sdk.hl7282.hl7streams.HL7BufferStream;
import cdac.medinfo.sdk.hl7282.utils.EnumSegments;
import cdac.medinfo.sdk.hl7282.utils.HL7Constants;
import cdac.medinfo.sdk.hl7282.utils.SingleCollection;

/**
 * OBX - Observation/Result Segment.<p>
 * The OBX segment is used to transmit a single observation or observation fragment. It
 * represents the smallest indivisible unit of a report.  The OBX segment can also contain
 * encapsulated data, e.g., a CDA document or a DICOM image.
 * <p>Represents an HL7 OBX message segment. 
 * This segment has the following fields:</p><p>
 * OBX-1: Set ID - OBX (SI)<b>Optional</b><br> 
 * OBX-2: Value Type (ID)<b>Conditional</b><br> 
 * OBX-3: Observation Identifier (CWE)<b>Required</b><br> 
 * OBX-4: Observation Sub-ID (OG)<b>Conditional</b><br> 
 * OBX-5: Observation Value (varies)<b>Conditional</b><br> 
 * OBX-6: Units (CWE)<b>Optional</b><br> 
 * OBX-7: References Range (ST)<b>Optional</b><br> 
 * OBX-8: Abnormal Flags (CWE)<b>Optional</b><br> 
 * OBX-9: Probability (NM)<b>Optional</b><br> 
 * OBX-10: Nature of Abnormal Test (ID)<b>Optional</b><br> 
 * OBX-11: Observation Result Status (ID)<b>Required</b><br> 
 * OBX-12: Effective Date of Reference Range (DTM)<b>Optional</b><br> 
 * OBX-13: User Defined Access Checks (ST)<b>Optional</b><br> 
 * OBX-14: Date/Time of the Observation (DTM)<b>Optional</b><br> 
 * OBX-15: Producer's ID (CWE)<b>Backwards compatible</b><br> 
 * OBX-16: Responsible Observer (XCN)<b>Backwards compatible</b><br> 
 * OBX-17: Observation Method (CWE)<b>Optional</b><br> 
 * OBX-18: Equipment Instance Identifier (EI)<b>Backwards compatible</b><br> 
 * OBX-19: Date/Time of the Analysis (DTM)<b>Optional</b><br>
 * OBX-20: Observation Site<b>Optional</b><br>
 * OBX-21: Observation Instance Identifier<b>Optional</b><br>
 * OBX-22: Mood Code<b>Conditional</b><br>
 * OBX-23: Performing Organization Name<b>Backwards compatible</b><br>
 * OBX-24: Performing Organization Address<b>Backwards compatible</b><br>
 * OBX-25: Performing Organization Medical Director<b>Backwards compatible</b><br>
 * OBX-26: Patient Results Release Category<b>Optional</b><br>
 * OBX-27: Root Cause<b>Optional</b><br>
 * OBX-28: Local Process Control<b>Optional</b><br>
 * OBX-29: Observation Type<b>Optional</b><br>
 * OBX-30: Observation Sub-Type<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 OBX extends Segment   
{
	

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

	/**
	 * Constructs the OBX segment.
	 */
	public OBX()
	{super(EnumSegments.HL7_SEG_OBX);
	}

	/**
	 * Retrieves the Value Type.
	 * This field returns valueType.
	 * @return ID - contains Object of valueType.
	 */
	public ID getValueType() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(570);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Abnormal Flags.
	 * This field contains a table lookup indicating the normalcy status of the result.
	 * @return ISingleCollection<CWE> - abnormalFlags
	 */
	public ISingleCollection<CWE> getAbnormalFlags() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(576);
		ISingleCollection<CWE> objDataList = new SingleCollection<CWE>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				CWE objCWE = (CWE)objDataType;
				objDataList.add(objCWE);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Dt Time Of Analysis.
	 * This field is used to transfer the time stamp associated with generation
	 * of the analytical result by the instrument specified in Equipment Instance Identifier. 
	 * @return DTM - dtTimeOfAnalysis
	 */
	public DTM getDtTimeOfAnalysis() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1480);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Dt Time Of Observation.
	 * This field is required in two circumstances.  
	 * @return DTM - dtTimeOfObservation
	 */
	public DTM getDtTimeOfObservation() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(582);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Effective Date Of Reference Range.
	 * This field contains the date(and, optionally, the time) on which the values in 
	 * OBX-7-reference range went into effect. 
	 * @return DTM - effectiveDateOfReferenceRange
	 */
	public DTM getEffectiveDateOfReferenceRange() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(580);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Equipment Instance Identifier.
	 * This field identify the Equipment Instance.
	 * @return ISingleCollection<EI> - equipmentInstanceIdentifier
	 */
	public ISingleCollection<EI> getEquipmentInstanceIdentifier() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1479);
		ISingleCollection<EI> objDataList = new SingleCollection<EI>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				EI objEI = (EI)objDataType;
				objDataList.add(objEI);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Nature Of Abnormal Test.
	 * This field contains the nature of the abnormal test.  
	 * @return ISingleCollection<ID> - natureOfAbnormalTest
	 */
	public ISingleCollection<ID> getNatureOfAbnormalTest() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(578);
		ISingleCollection<ID> objDataList = new SingleCollection<ID>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				ID objID = (ID)objDataType;
				objDataList.add(objID);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Observation Identifier.
	 * This contains a unique identifier for the observation. 
	 * @return CWE - observationIdentifier
	 */
	public CWE getObservationIdentifier() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(571);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Observation Method.
	 * This field is use to transmit the method or procedure by which 
	 * an observation is obtained when the sending system wishes to distinguish among one 
	 * measurement obtained by different methods and the distinction is not implicit in the test ID. 
	 * @return ISingleCollection<CWE> - observationMethod
	 */
	public ISingleCollection<CWE> getObservationMethod() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(936);
		ISingleCollection<CWE> objDataList = new SingleCollection<CWE>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				CWE objCWE = (CWE)objDataType;
				objDataList.add(objCWE);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Observation Result Status.
	 * This field contains the observation result status.  
	 * @return ID - observationResultStatus
	 */
	public ID getObservationResultStatus() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(579);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Observation Sub ID.
	 * This field is used to distinguish between multiple OBX segments with the same 
	 * observation ID organized under one OBR.
	 * @return OG - observationSubID
	 */
	public OG getObservationSubID() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(572);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (OG)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Observation Value.
	 * This contains the value observed by the observation producer.  
	 * @return ISingleCollection<IDataType> - observationValue
	 */
	public ISingleCollection<IDataType> getObservationValue() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(573);
		return objDataCollection;
	}

	/**
	 * Retrieves the Probability.
	 * This contains the probability of a result being true for results with categorical values. 
	 * @return NM - probability
	 */
	public NM getProbability() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(577);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (NM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Producers ID.
	 * This field contains a unique identifier of the responsible producing service.  
	 * @return CWE - producersID
	 */
	public CWE getProducersID() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(583);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the References Range.
	 * This observation quantifies the amount of a toxic substance, then the upper limit of the range identify the toxic limit.  
	 * @return ST - referencesRange
	 */
	public ST getReferencesRange() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(575);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Responsible Observer.
	 * This field contains the identifier of the individual directly responsible for the observation.
	 * @return ISingleCollection<XCN> - responsibleObserver
	 */
	public ISingleCollection<XCN> getResponsibleObserver() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(584);
		ISingleCollection<XCN> objDataList = new SingleCollection<XCN>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				XCN objXCN = (XCN)objDataType;
				objDataList.add(objXCN);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the  Set ID OBX.
	 * This field contains the sequence number. For compatibility with ASTM. 
	 * @return SI - setID_OBX
	 */
	public SI getSetID_OBX() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(569);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (SI)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Units.
	 * This fields measure units within the units field of the OBX segment.
	 * @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 User Defined Access Checks.
	 * This field permits the producer to record results-dependent codes for classifying 
	 * the observation at the receiving system.
	 * @return ST - userDefinedAccessChecks
	 */
	public ST getUserDefinedAccessChecks() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(581);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ST)objDataCollection.elementAt(0);
		else
			return null;
	}
	/**
	 * Retrieves the Abnormal Flags.
	 * This field typically contains the body site(s) where the measurement being reported was obtained. 
	 * @return ISingleCollection<CWE> - observationSite
	 */
	public ISingleCollection<CWE> getObservationSite() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2179);
		ISingleCollection<CWE> objDataList = new SingleCollection<CWE>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				CWE objCWE = (CWE)objDataType;
				objDataList.add(objCWE);
			}
		}
		return objDataList;
	}
	/** Retrieves the Observation Instance Identifier.
	 * This field contains a unique identifier for this observation.  This instance identifier is persistent between messages.
	 * @return EI - ObservationInstanceIdentifier
	 */ 
	public EI getObservationInstanceIdentifier()
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2180);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (EI)objDataCollection.elementAt(0);
		else
			return null;
	}
	/** Retrieves the Mood Code.
	 * This field identifies the actuality of the observation (e.g., intent, request, promise, event).    
	 * @return CNE - MoodCode
	 */ 
	public CNE getMoodCode()
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2182);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CNE)objDataCollection.elementAt(0);
		else
			return null;
	}
	/** Retrieves the Performing Organization Name.
	 * This field contains the name of the organization/service responsible for performing the service.
	 * @return XON - Performing Organization Name.
	 */ 
	public XON getPerformingOrganizationName()
	{		
		ISingleCollection<IDataType> objDataCollection =getDataType(2283);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (XON)objDataCollection.elementAt(0);
		else
			return null;
	}
	/** Retrieves the Performing Organization Address.
	 * This field contains the address of the organization/service responsible for performing the service.
	 * @return XAD - Performing Organization Address.
	 */ 
	public XAD getPerformingOrganizationAddress()
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2284);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (XAD)objDataCollection.elementAt(0);
		else
			return null;
	}
	/** Retrieves the Performing Organization Medical Director.
	 * This field contains the medical director of the organization/service responsible for performing the service.
	 * @return XAN - Performing Organization Medical Director.
	 */ 
	public XCN getPerformingOrganizationMedicalDirector()
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2285);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (XCN)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/** Retrieves the Patient Results Release Category.
	 * This field contains instructions on whether to share the results with the patient, and if so how
	 * @return ID - Patient Results Release Category.
	 */ 
	public ID getPatientResultsReleaseCategory()
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(2313);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}
	/**
	 * Retrieves the Root Cause.
	 * This element contains the reason code indicating the root cause for the reissue of a previously released lab report.  
	 * @return CWE - Root Cause
	 */
	public CWE getRootCause() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3308);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}
	/**
	 * Retrieves the Local Process Control.
	 * This element contains information intended to be used for locally defined processing, particularly process control/status type information.  
	 * @return CWE - Local Process Control
	 */
	public CWE getLocalProcessControl() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3309);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Retrieves the Observation Type.
	 * This field indicates the type of observation to enable systems to distinguish between observations sent along with an order, versus observations sent as the result to an order.  
	 * @return ID - Observation Type
	 */
	public ID getObservationType() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3432);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Retrieves the Observation Sub-Type.
	 * The result sub-type provides further classification of OBX-29 Observation Type.  
	 * @return ID - Observation Sub-Type
	 */
	public ID getObservationSubType() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3475);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	
	 
	/**
	 * Set the Abnormal Flags.
	 * This field contains a table lookup indicating the normalcy status of the result.  
	 * @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 addAbnormalFlags (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(576);
		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);		 
		addAbnormalFlags(cwe);

	} 

	/** Set the Abnormal Flags.
	 * This field contains a table lookup indicating the normalcy status of the result.  
	 * @param strAbnormalFlags Specifies the normalcy status
	 */ 
	public void addAbnormalFlags(CWE objtempVisitUserCode)
	{
		addDataType(576,objtempVisitUserCode);

	}

	/**
	 * Set the AbnormalFlags list.
	 * @param objAbnormalFlagsList List of AbnormalFlags
	 */	
	@SuppressWarnings("unchecked")
	public void setAbnormalFlags(ISingleCollection<CWE> objAbnormalFlagsList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objAbnormalFlagsList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(576,objCollection);
	}

	/**
	 * Set the Dt Time Of Analysis.
	 * This field is used to transfer the time stamp associated with generation
	 * of the analytical result by the instrument specified in Equipment Instance Identifier.
	 * @param strTime Specifies a point in time using a 24-hour clock notation.	 
	 */
	public void setDtTimeOfAnalysis(String strTime) 
	{
		DTM dtTimeOfAnalysis  = (DTM)getDataElement(1480);
		dtTimeOfAnalysis.setValue(strTime);		
		setDtTimeOfAnalysis(dtTimeOfAnalysis);
	}

	/**
	 * Set the Dt Time Of Analysis.
	 * This field is used to transfer the time stamp associated with generation
	 * of the analytical result by the instrument specified in Equipment Instance Identifier.
	 * @param dtTimeOfAnalysis Dt Time Of Analysis
	 */
	public void setDtTimeOfAnalysis(DTM dtTimeOfAnalysis)
	{
		setDataType(1480,dtTimeOfAnalysis);
	}

	/**
	 * Set the Dt Time Of Observation.
	 * This field is required in two circumstances.  
	 * @param strTime Specifies a point in time using a 24-hour clock notation. 
	 * @param strDegreeOfPrecision The degree of precision of the time stamp .Suggested Values Y,L,D,H,M,S [Refer to HL7 Table 0529].
	 */
	public void setDtTimeOfObservation(String strTime) 
	{
		DTM dtTimeOfObservation  = (DTM)getDataElement(582);
		dtTimeOfObservation.setValue(strTime);		
		setDtTimeOfObservation(dtTimeOfObservation);
	}

	/**
	 * Set the Dt Time Of Observation.
	 * This field is required in two circumstances.  
	 * @param dtTimeOfObservation Dt Time Of Observation.
	 */
	public void setDtTimeOfObservation(DTM dtTimeOfObservation)
	{
		setDataType(582,dtTimeOfObservation);
	}

	/**
	 * Set the Equipment Instance Identifier.
	 * This field identify the Equipment Instance. 
	 * @param strTime Specifies a point in time using a 24-hour clock notation. 
	 * @param strDegreeOfPrecision The degree of precision of the time stamp .Suggested Values Y,L,D,H,M,S [Refer to HL7 Table 0529].
	 */
	public void setEffectiveDateOfReferenceRange(String strTime) 
	{
		DTM effectiveDateOfReferenceRange  = (DTM)getDataElement(580);
		effectiveDateOfReferenceRange.setValue(strTime);		
		setEffectiveDateOfReferenceRange(effectiveDateOfReferenceRange);
	}

	/**
	 * Set the EffectiveDateOfReferenceRange
	 * This field identify the Equipment Instance. 
	 * @param effectiveDateOfReferenceRange EffectiveDateOfReferenceRange
	 */
	public void setEffectiveDateOfReferenceRange(DTM effectiveDateOfReferenceRange)
	{
		setDataType(580,effectiveDateOfReferenceRange);
	}

	/**
	 * Set the field which identifies the Equipment Instance.
	 * (e.g., Analyzer, Analyzer module, group of Analyzers,...) 
	 * responsible for the production of the observation.  
	 * @param strEntityIdentifier Specifies entity identifier
	 * @param strNamespaceId Specifies the NameSpace ID.
	 * @param strUniversalId Specifies the Universal ID
	 * @param strUniversalIdType Specifies the Universal ID type
	 */ 
	public void addEquipmentInstanceIdentifier (String strEntityIdentifier,String strNamespaceId,
			String strUniversalId,String strUniversalIdType)
	{
		EI tempEquipmentInstanceIdentifier  = (EI)getDataElement(1479);
		tempEquipmentInstanceIdentifier.setEntityIdentifier(strEntityIdentifier);
		tempEquipmentInstanceIdentifier.setNamespaceId(strNamespaceId);
		tempEquipmentInstanceIdentifier.setUniversalId(strUniversalId);
		tempEquipmentInstanceIdentifier.setUniversalIdType(strUniversalIdType); 
		addEquipmentInstanceIdentifier(tempEquipmentInstanceIdentifier);

	} 

	/** Set the field which identifies the Equipment Instance.
	 * (e.g., Analyzer, Analyzer module, group of Analyzers,...) 
	 * responsible for the production of the observation.  
	 * @param strEntityIdentifier Specifies entity identifier
	 * @param strNamespaceId Specifies the NameSpace ID.
	 * @param strUniversalId Specifies the Universal ID
	 * @param strUniversalIdType Specifies the Universal ID type
	 */ 
	public void addEquipmentInstanceIdentifier(EI objtempEquipmentInstanceIdentifier)
	{
		addDataType(1479,objtempEquipmentInstanceIdentifier);

	}

	/**
	 * Set the EquipmentInstanceIdentifier list.
	 * @param objEquipmentInstanceIdentifierList List of EquipmentInstanceIdentifier
	 */	
	@SuppressWarnings("unchecked")
	public void setEquipmentInstanceIdentifier(ISingleCollection<EI> objEquipmentInstanceIdentifierList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objEquipmentInstanceIdentifierList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1479,objCollection);
	}

	/**
	 * Set the Nature Of Abnormal Test.
	 * This field contains the nature of the abnormal test.  
	 * @param strNatureOfAbnormalTest Specified the nature of abnormal test.
	 */ 
	public void addNatureOfAbnormalTest (String strNatureOfAbnormalTest)
	{
		ID tempNatureOfAbnormalTest  = (ID)getDataElement(578);
		tempNatureOfAbnormalTest.setValue(strNatureOfAbnormalTest); 
		addNatureOfAbnormalTest(tempNatureOfAbnormalTest);

	} 

	/** Set the Nature Of Abnormal Test.
	 * This field contains the nature of the abnormal test.  
	 * @param objtempNatureOfAbnormalTest Specified the nature of abnormal test.
	 */ 
	public void addNatureOfAbnormalTest(ID objtempNatureOfAbnormalTest)
	{
		addDataType(578,objtempNatureOfAbnormalTest);

	}

	/**
	 * Set the NatureOfAbnormalTest list.
	 * @param objDiagnosingClinicianList List of NatureOfAbnormalTest
	 */	
	@SuppressWarnings("unchecked")
	public void setNatureOfAbnormalTest(ISingleCollection<ID> objNatureOfAbnormalTestList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objNatureOfAbnormalTestList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(578,objCollection);
	}

	/**
	 * Set the Observation Identifier.
	 * This contains a unique identifier for the observation.  
	 * @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 setObservationIdentifier (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(571);
		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);
		setObservationIdentifier(cwe);
	}

	/**
	 * Set the Observation Identifier.
	 * This contains a unique identifier for the observation.  
	 * @param observationIdentifier Observation Identifier
	 */
	public void setObservationIdentifier(CWE observationIdentifier)
	{
		setDataType(571,observationIdentifier);
	}

	/**
	 * Set the Observation Method.
	 * This field is use to transmit the method or procedure by which 
	 * an observation is obtained when the sending system wishes to distinguish among one 
	 * measurement obtained by different methods and the distinction is not implicit in the test ID.  
	 * @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 addObservationMethod (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(936);
		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); 
		addObservationMethod(cwe);

	} 

	/** Set the Observation Method.
	 * This field is use to transmit the method or procedure by which 
	 * an observation is obtained when the sending system wishes to distinguish among one 
	 * measurement obtained by different methods and the distinction is not implicit in the test ID.  
	 * @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.
	 */ 
	public void addObservationMethod(CWE objtempObservationMethod)
	{
		addDataType(936,objtempObservationMethod);

	}

	/**
	 * Set the ObservationMethod list.
	 * @param objObservationMethodList List of ObservationMethod
	 */	
	@SuppressWarnings("unchecked")
	public void setObservationMethod(ISingleCollection<CWE> objObservationMethodList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objObservationMethodList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(936,objCollection);
	}


	/**
	 * Set the Observation Result Status.
	 * This field contains the observation result status.
	 * @param strObservationResultStatus Used as ObservationResultStatus.
	 */ 
	public void setObservationResultStatus (String strObservationResultStatus)
	{
		ID observationResultStatus  = (ID)getDataElement(579);
		observationResultStatus.setValue(strObservationResultStatus); 
		setObservationResultStatus(observationResultStatus);

	} 

	/** Set the Observation Result Status.
	 * This field contains the observation result status.
	 * @param objobservationResultStatus Used as ObservationResultStatus.
	 */ 
	public void setObservationResultStatus(ID objobservationResultStatus)
	{
		setDataType(579,objobservationResultStatus);

	}

	/**
	 * Set the Observation Sub ID.
	 * The components that can be used to define the structure of the observation/result segments (OBX) within an observation report segment (OBR).  
	 * @param objObservationSubID Specifies the original data type used in OBX-4 to enable backwards compatibility to continue use of the original format to provide OBX segment grouping.
	 * @param objGroup Specifies the group and its sequence within the OBR segment that the OBX segment is a part of.
	 * @param objSequence Specifies the sequence within the group as defined in OG-2. 
	 * @param objIdentifier Specifies assignment of an identifier to a result component, for example an isolate in a microbiology message.	 * 
	 */ 
	public void setObservationSubID (ST objObservationSubID,NM objGroup, NM objSequence, ST objIdentifier)
	{
		OG og  = (OG)getDataElement(572);
		og.setOriginalSubIdentifier(objObservationSubID);
		og.setGroup(objGroup);
		og.setSequence(objSequence);
		og.setIdentifier(objIdentifier);		 
		setObservationSubID(og);
	}

	/** Set the Observation Sub ID.
	 * This field is used to distinguish between multiple OBX segments with the same 
	 * observation ID organized under one OBR.
	 * @param objobservationSubID Specifies the observation sub ID 
	 */ 
	public void setObservationSubID(OG objobservationSubID)
	{
		setDataType(572,objobservationSubID);

	}

	/**
	 * Set the Observation Value.
	 * This contains the value observed by the observation producer.  
	 * @param objObservationValue Specifies the observation value 
	 */	
	public void addObservationValue(IDataType objObservationValue)throws InvalidFieldException 
	{
		addDataType(573, objObservationValue);
	}

	/**
	 * Set the ObservationValue list.
	 * @param objDiagnosingClinicianList List of ObservationValue
	 */	
	@SuppressWarnings("unchecked")
	public void setObservationValue(ISingleCollection<IDataType> objObservationValueList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objObservationValueList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(573,objCollection);
	}

	/**
	 * Set the Probability.
	 * This contains the probability of a result being true for results with categorical values.
	 * @param strProbability Specifies the numeric value.
	 */ 
	public void setProbability (String strProbability)
	{
		NM probability  = (NM)getDataElement(577);
		probability.setValue(strProbability); 
		setProbability(probability);

	} 

	/** Set the Probability.
	 * This contains the probability of a result being true for results with categorical values.
	 * @param objprobability Specifies the numeric value.
	 */ 
	public void setProbability(NM objprobability)
	{
		setDataType(577,objprobability);

	}

	/**
	 * Set the Producers ID.
	 * This field contains a unique identifier of the responsible producing service.  
	 * @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 setProducersID(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(583);
		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);
		setProducersID(cwe);
	}

	/**
	 * Set the Producers ID.
	 * This field contains a unique identifier of the responsible producing service.  
	 * @param producersID Producers ID
	 */
	public void setProducersID(CWE producersID)
	{
		setDataType(583,producersID);
	}

	/**
	 * Set the References Range.
	 * This observation quantifies the amount of a toxic substance, then the upper limit of the range identify the toxic limit.  
	 * @param StrReferencesRange Specifies the upper or lower limit. 
	 */ 
	public void setReferencesRange (String StrReferencesRange)
	{
		ST referencesRange  = (ST)getDataElement(575);
		referencesRange.setValue(StrReferencesRange); 
		setReferencesRange(referencesRange);

	} 

	/**
	 * Set the References Range.
	 * This observation quantifies the amount of a toxic substance, then the upper limit of the range identify the toxic limit.  
	 * @param objreferencesRange Specifies the upper or lower limit. 
	 */ 
	public void setReferencesRange(ST objreferencesRange)
	{
		setDataType(575,objreferencesRange);

	}

	/**
	 * Add the Responsible Observer.
	 * This field contains the identifier of the individual directly responsible for the observation.
	 * @param strIDNumber Refers to the coded ID according to a user-defined table
	 * @param objFamilyName Specifies the surname of a person.
	 * @param strGivenName Specifies First name.
	 * @param strSecondAndFurtherGivenNamesOrInitialsThereof Specifies multiple middle names that may be included by 
	 * 														   separating them with spaces.
	 * @param strSuffix Used to specify a name suffix (e.g., Jr. or III).
	 * @param strPrefix Used to specify a name prefix (e.g., Dr.).
	 * @param strSourceTable Used as the HL7 identifier for the user-defined table of values for this component. [Refer User-defined Table 0297 - CN ID.]
	 * @param objAssigningAuthority Specifies a unique identifier of the system (or organization or agency of department)
	 * 								  that creates the data. [Refer User-defined Table 0363 - Assigning authority]
	 * @param strNameTypeCode Specifies a code that represents the type of name. 
	 * @param strIdentifierCheckDigit Specifies part of the identifying number used in the sending application. 
	 * @param strCheckDigitScheme Specifies the code identifying the check digit scheme employed.[Refer HL7 Table 0061 - Check digit scheme].
	 * @param strIdentifierTypeCode Specifies A code corresponding to the type of identifier.[Refer HL7 Table 0203 - Identifier type].
	 * @param objAssigningFacility Specifies the place or location identifier where the identifier was first assigned to the person
	 * @param strNameRepresentationCode Provides an indication of the representation provided by the data item.  
	 * @param objNameContext Designates the context in which a name is used. [Refer User-defined Table 0448 ]
	 * @param strNameAssemblyOrder Specifies a code that represents the preferred display order of the components of this person name. Suggested values are G,F[Refer table 0444.]
	 * @param strEffectiveDate Specifies the first date, if known, on which the address is valid and active.
	 * @param strExpirationDate Specifies the last date, if known, on which the address is valid and active.
	 * @param strProfessionalSuffix Used to specify an abbreviation, or a string of abbreviations, denoting qualifications that support the person's profession, (e.g., licenses).
	 * @param objAssigningJurisdiction Specifies the geo-political body that assigned the identifier.
	 * @param objAssigningAgencyOrDepratment Specifies the agency or department that assigned the identifier
	 * @param strSecurityCheck Specifies the version code that may be assigned to the person identifier
	 * @param strSecurityCheckScheme Specifies the check digit scheme.
	 */ 
	public void addResponsibleObserver (String strIDNumber,FN objFamilyName,String strGivenName,String strSecondAndFurtherGivenNamesOrInitialsThereof,
			String 	strSuffix,String strPrefix,CWE objSourceTable,HD objAssigningAuthority,
			String strNameTypeCode,String strIdentifierCheckDigit,String strCheckDigitScheme,String strIdentifierTypeCode,
			HD objAssigningFacility,String strNameRepresentationCode,CWE objNameContext,
			String strNameAssemblyOrder, String strEffectiveDate,String strExpirationDate,String strProfessionalSuffix,
			CWE objAssigningJurisdiction,CWE objAssigningAgencyOrDepratment, String strSecurityCheck, String strSecurityCheckScheme)
	
	{
		XCN xcn  = (XCN)getDataElement(584);
		xcn.setIdNumber(strIDNumber);
		xcn.setFamilyName(objFamilyName);
		xcn.setGivenName(strGivenName);
		xcn.setSecondNameOrInitials(strSecondAndFurtherGivenNamesOrInitialsThereof);
		xcn.setSuffix(strSuffix);
		xcn.setPrefix(strPrefix);
 
		xcn.setSourceTable(objSourceTable);
		xcn.setAssigningAuthority(objAssigningAuthority);
		xcn.setNameTypeCode(strNameTypeCode);
		xcn.setIdentifierCheckDigit(strIdentifierCheckDigit);
		xcn.setCheckDigitScheme(strCheckDigitScheme);
		xcn.setIdentifierTypeCode(strIdentifierTypeCode);
		xcn.setAssigningFacility(objAssigningFacility);
		xcn.setNameRepresentationCode(strNameRepresentationCode);
		xcn.setNameContext(objNameContext);
 
		xcn.setNameAssemblyOrder(strNameAssemblyOrder);
		xcn.setEffectiveDate(strEffectiveDate);
		xcn.setExpirationDate(strExpirationDate);
		xcn.setProfessionalSuffix(strProfessionalSuffix);
		xcn.setAssigningJurisdiction(objAssigningJurisdiction);
		xcn.setAssigningAgencyOrDepartment(objAssigningAgencyOrDepratment); 
		xcn.setSecurityCheck(strSecurityCheck);
		xcn.setSecurityCheckScheme(strSecurityCheckScheme); 
		addResponsibleObserver(xcn);

	} 

	/** @param strNameAssemblyOrder Specifies a code that represents the preferred display order of the components of this person name. Suggested values are G,F[Refer table 0444.]
	 * @param objEffectiveDate Specifies the first date, if known, on which the address is valid and active.
	 * @param objExpirationDate Specifies the last date, if known, on which the address is valid and active.
	 * @param strProfessionalSuffix Used to specify an abbreviation, or a string of abbreviations, denoting qualifications that support the person's profession, (e.g., licenses).
	 * @param objAssigningJurisdiction Specifies the geo-political body that assigned the identifier.
	 * @param objAssigningAgencyOrDepratment Specifies the agency or department that assigned the identifier
	 */ 
	public void addResponsibleObserver(XCN objtemResponsibleObserver)
	{
		addDataType(584,objtemResponsibleObserver);

	}

	/**
	 * Set the ResponsibleObserver list.
	 * @param objResponsibleObserverList List of ResponsibleObserver
	 */	
	@SuppressWarnings("unchecked")
	public void setResponsibleObserver(ISingleCollection<XCN> objResponsibleObserverList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objResponsibleObserverList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(584,objCollection);
	}

	/**
	 * Set the  Set ID OBX.
	 * This field contains the sequence number. For compatibility with ASTM.
	 * @param strSquenceID Specifies the sequence number.  
	 */ 
	public void setSetID_OBX (String strSquenceID)
	{
		SI setID_OBX  = (SI)getDataElement(569);
		setID_OBX.setValue(strSquenceID); 
		setSetID_OBX(setID_OBX);

	} 

	/**
	 * Set the  Set ID OBX.
	 * This field contains the sequence number. For compatibility with ASTM.
	 * @param strSquenceID Specifies the sequence number.  
	 */ 
	public void setSetID_OBX(SI objsetID_OBX)
	{
		setDataType(569,objsetID_OBX);

	}

	/**
	 * Set the Units.
	 * This fields measure units within the units field of the OBX segment.
	 * @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.
	 * This fields measure units within the units field of the OBX segment.
	 *  @param units Units
	 */
	public void setUnits(CWE units)
	{
		setDataType(574,units);
	}

	/**
	 * Set the User Defined Access Checks.
	 * This field permits the producer to record results-dependent codes for classifying 
	 * the observation at the receiving system. 
	 * @param strUserDefinedAccessChecks Used as UserDefinedAccessChecks.
	 */ 
	public void setUserDefinedAccessChecks (String strUserDefinedAccessChecks)
	{
		ST userDefinedAccessChecks  = (ST)getDataElement(581);
		userDefinedAccessChecks.setValue(strUserDefinedAccessChecks); 
		setUserDefinedAccessChecks(userDefinedAccessChecks);

	} 

	/** Set the User Defined Access Checks.
	 * This field permits the producer to record results-dependent codes for classifying 
	 * the observation at the receiving system. 
	 * @param objuserDefinedAccessChecks Used as UserDefinedAccessChecks.
	 */ 
	public void setUserDefinedAccessChecks(ST objuserDefinedAccessChecks)
	{
		setDataType(581,objuserDefinedAccessChecks);

	}

	/**
	 * Set the Value Type.
	 * This field returns valueType.
	 * @param strValueType Used as ValueType.
	 */ 
	public void setValueType (String  strValueType)
	{
		ID valueType  = (ID)getDataElement(570);
		valueType.setValue(strValueType); 
		setValueType(valueType);

	} 

	/** Set the Value Type.
	 * This field returns valueType.
	 * @param objvalueType Used as ValueType.
	 */ 
	public void setValueType(ID objvalueType)
	{
		setDataType(570,objvalueType);

	}
	/**
	 * Set the Observation Site.
	 * This field typically contains the body site(s) where the measurement being reported was obtained.   
	 * @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 addObservationSite (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(2179);
		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);		 
		addAbnormalFlags(cwe);

	} 

	/** Set the Observation Site.
	 * This field typically contains the body site(s) where the measurement being reported was obtained.   
	 * @param objObservationSite Specifies the normalcy status
	 */ 
	public void addObservationSite(CWE objObservationSite)
	{
		addDataType(2179,objObservationSite);

	}

	/**
	 * Set the Observation Site.
	 * This field typically contains the body site(s) where the measurement being reported was obtained. 
	 * @param objObservationSiteList List of AbnormalFlags
	 */	
	@SuppressWarnings("unchecked")
	public void setObservationSite(ISingleCollection<CWE> objObservationSiteList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objObservationSiteList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(2179,objCollection);
	}
	
	/**
	 * Set the Observation Instance Identifier.
	 * This field contains a unique identifier for this observation.  This instance identifier is persistent between messages.
	 * @param strEntityIdentifier Specifies to be unique within the series of identifiers created by the 
	 * 								assigning authority, defined by a hierarchic designator
	 * @param strNamespaceId Specifies the assigning authority is a unique identifier of the system 
	 * 							(or organization or agency or department) that creates the data. 
	 * @param strUniversalId Specifies a string formatted according to the scheme defined by the third component universal ID type.
	 * 							It is intended to be unique over time within the UID type.
	 * @param strUniversalIdType Governs the interpretation of the Universal ID.  
	 */
	public void setObservationInstanceIdentifier(String strEntityIdentifier,String strNamespaceId,String strUniversalId,
			String strUniversalIdType)
	{
		EI ei  = (EI)getDataElement(2180);
		ei.setEntityIdentifier(strEntityIdentifier);
		ei.setNamespaceId(strNamespaceId);
		ei.setUniversalId(strUniversalId);
		ei.setUniversalIdType(strUniversalIdType);
		setObservationInstanceIdentifier(ei);
	}
	/** Set the Observation Instance Identifier.
	 * This field contains a unique identifier for this observation.  This instance identifier is persistent between messages.
	 * @param objObservationInstanceIdentifier Used as ObservationInstanceIdentifier.
	 */ 
	public void setObservationInstanceIdentifier(EI objObservationInstanceIdentifier)
	{
		setDataType(2180,objObservationInstanceIdentifier);

	}

	/** Set the Mood Code.
	 * This field identifies the actuality of the observation (e.g., intent, request, promise, event).    
     * @param strIdentifier Specifies sequence of characters (the code) that uniquely identifies
	 * 						 the item being referenced by the CNE.
	 * @param strText Specifies descriptive or textual name of the identifier, e.g., myocardial infarction 
	 * @param strNameOfCodingSystem Specifies the coding scheme being used in the identifier component. 
	 * @param strAlternateIdentifier Specifies the local or user seen code as described. 
	 * @param strAlternateText Specifies descriptive or textual name of the alternate identifier.  
	 * @param strNameOfAlternateCodingSystem Specifies the coding scheme being used in the alternate identifier 
	 * 											component.  
	 * @param strCodingSystemVersionID Specifies the version ID for the coding system. 
	 * @param strAlternateCodingSystemVersionID Specifies the version ID for the coding system .
	 * @param strOriginalText Specifies the original text that was available to an automated process or a human 
	 * 							before a specific code was assigned.
	 * @param strSecondAlternateIdentifier Specifies a sequence of characters that uniquely identifies the second alternate code
	 * @param strSecondAlternateText Specifies a the textual information of the second alternate code
	 * @param strNameOfSecondAltenateCodingSystem Specifies the second coding scheme being used in the identifier component.
	 * @param strSecondAlternateCodingSystemVersionID Specifies version ID of Second alternative coding system.
	 * @param strCodingSystemOID contains the ISO Object identifier for the coding system.
	 * @param strValueSetOID contains the value set from which CNE-1 is obtained 
	 * @param strValueSetVersionID contains the version of the value set identified by CNE-15. 
	 * @param strAlternateCodingSystemOID contains the ISO Object identifier for the alternate coding system
	 * @param strAlternateValueSetOID contains the value set from which CNE-4 is obtained
	 * @param strAlternateValueSetVersionID contains the version of the value set identified by CNE-18. 
	 * @param strSecondAlternateCodingSystemOID contains the value set from which CNE-12 is obtained
	 * @param strSecondAlternateValueSetOID contains the value set from which CNE-10 is obtained
	 * @param strSecondAlternateValueSetVersionID contains the version of the value set identified by CNE-21. 
	 */ 
	public void setMoodCode (String strIdentifier,String strText,String strNameOfCodingSystem,String strAlternateIdentifier,
			String strAlternateText,String strNameOfAlternateCodingSystem,String strCodingSystemVersionID,
			String strAlternateCodingSystemVersionID,String strOriginalText, String strSecondAlternateIdentifier, String strSecondAlternateText,
			String strNameOfSecondAltenateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, 
			String strValueSetOID, String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID,
			String strAlternateValueSetVersionID, String strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID,
			String strSecondAlternateValueSetVersionID)
	{
		CNE cne  = (CNE)getDataElement(2182);
		cne.setIdentifier(strIdentifier);
		cne.setText(strText);
		cne.setNameOfCodingSystem(strNameOfCodingSystem);
		cne.setAlternateIdentifier(strAlternateIdentifier);
		cne.setAlternateText(strAlternateText);
		cne.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem);
		cne.setCodingSystemVersionID(strCodingSystemVersionID);
		cne.setAlternateCodingSystemVersionID(strAlternateCodingSystemVersionID);
		cne.setOriginalText(strOriginalText); 
		cne.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cne.setSecondAlternateText(strSecondAlternateText);
		cne.setNameofSecondAlternateCodingSystem(strNameOfSecondAltenateCodingSystem);
		cne.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cne.setCodingSystemOID(strCodingSystemOID);
		cne.setValueSetOID(strValueSetOID);
		cne.setValueSetVersionID(strValueSetVersionID);
		cne.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cne.setAlternateValueSetOID(strAlternateValueSetOID);
		cne.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cne.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cne.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cne.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID);
		setMoodCode(cne);

	} 
	/** Set the Mood Code.
	 * This field identifies the actuality of the observation (e.g., intent, request, promise, event).
	 * @param objMoodCode Used as MoodCode.
	 */ 
	public void setMoodCode(CNE objMoodCode)
	{
		setDataType(2182,objMoodCode);
	}
	

	/** Set the Performing Organization Name.
	 * This field contains the name of the organization/service responsible for performing the service.    
     * @param strOrganizationName Specifies name of the specified organization.
	 * @param strOrganizationNameTypeCode Specifies a code that represents the type of name i.e., legal name, display name.
	 * 										Suggested Values A,L,D,SL.[Refer to table No.0204]  
	 * @param objAssigningAuthority Specifies The assigning authority is a unique identifier of the system 
	 * 									(or organization or agency or department) that creates the data. 
	 * @param strIdentifierTypeCode Specifies a code corresponding to the type of identifier. 
	 * @param objAssigningFacility Specifies The place or location identifier where the identifier was first assigned to the person. 
	 * @param strNameRepresentationCode Specifies representations of the same name/address Suggested values are I,A,P [Refer table 0465] 
	 * @param strOrganizationIdentifier This component contains the sequence of characters (the code) that uniquely 
	 * 									  identifies the item being referenced by XON.1 Organization Name. 
	 * 									  This component replaces XON.3 ID Number as of v 2.5.
	 */ 
	public void setPerformingOrganizationName(String strOrganizationName, CWE objOrganizationNameTypeCode,
			 HD objAssigningAuthority,
			String strIdentifierTypeCode, HD objAssigningFacility, String strNameRepresentationCode,
			String strOrganizationIdentifier)
	{
		XON xon  = (XON)getDataElement(2283);
		xon.setOrganizationName(strOrganizationName);
		xon.setOrganizationNameTypeCode(objOrganizationNameTypeCode);
		xon.setAssigningAuthority(objAssigningAuthority);
		xon.setIdentifierTypeCode(strIdentifierTypeCode);
		xon.setAssigningFacility(objAssigningFacility);
		xon.setNameRepresentationCode(strNameRepresentationCode);
		xon.setOrganizationIdentifier(strOrganizationIdentifier);
		setPerformingOrganizationName(xon);

	} 
	/** Set the Performing Organization Name.
	 * This field contains the name of the organization/service responsible for performing the service.
	 * @param objPerformingOrganizationName Used as Performing Organization Name.
	 */ 
	public void setPerformingOrganizationName(XON objPerformingOrganizationName)
	{
		setDataType(2283,objPerformingOrganizationName);
	}
	
	/**
	 * Set the Performing Organization Address.
	 * This field contains the address of the organization/service responsible for performing the service.  
	 * @param objStreetAddress Specifies the street address.
	 * @param strOtherDesignation Specifies the Second line of address. 
	 * @param strCity The city, or district or place where the addressee is located. 
	 * @param strStateOrProvince Specifies the state or province where the addressee is located.
	 * @param strZipOrPostalCode Specifies the zip or postal code where the addressee is located. 
	 * @param strCountry Specifies the country where the addressee is located.
	 * @param strAddressType Specifies the kind or type of address.
	 * @param strOtherGeographicDesignation Specifies any other geographic designation. 
	 * @param objCountyParishCode Specifies a code that represents the county in which the specified address resides. 
	 * @param objCensusTract Specifies a code that represents the census tract in which the specified address resides. 
	 * @param strAddressRepresentationCode Specifies representations of the same name/address Suggested values are I,A,P [Refer table 0465]
	 * @param objEffectiveDate It is The first date, if known, on which the address is valid and active.
	 * @param objExpirationDate It is The last date, if known, on which the address is valid and active.
	 * @param objExpirationReason indicates why this address was marked as ended.
	 * @param strTemporaryIndicator indicates whether address is considered temporary .
	 * @param strBadAddressIndicator indicates whether it is possible to contact the owning entity.
	 * @param strAddressUsage indicates how the address is intended to be used.
	 * @param strAddressee indicates the name of the person whose address is intended to be used.
	 * @param strComment indicated descriptive information
	 * @param strPreferenceOrder preference order
	 * @param objProtectionCode indicates that an address need to be protected
	 * @param objAdressIdentifier indicates a unique identifier for address
	 */ 
	public void setPerformingOrganizationAddress (SAD objStreetAddress,String strOtherDesignation,String strCity,
			String strStateOrProvince,String strZipOrPostalCode,String strCountry,String strAddressType,
			String strOtherGeographicDesignation,CWE objCountyParishCode,CWE objCensusTract,
			String strAddressRepresentationCode,DTM objEffectiveDate,
			DTM objExpirationDate, CWE objEXpirationReason, String strTemporaryIndicator,
			String strBadAddressIndicator, String strAddressUsage, String strAddressee, String strComment,
			String strPreferenceOrder, CWE objProtectionCode, EI objAddressIdentifier)
	{
		XAD xad = (XAD)getDataElement(2284);
		xad.setStreetAddress(objStreetAddress);
		xad.setOtherDesignation(strOtherDesignation);
		xad.setCity(strCity);
		xad.setStateOrProvince(strStateOrProvince);
		xad.setZipOrPostalCode(strZipOrPostalCode);
		xad.setCountry(strCountry);
		xad.setAddressType(strAddressType);
		xad.setOtherGeographicDesignation(strOtherGeographicDesignation);
		xad.setCountyParishCode(objCountyParishCode);
		xad.setCensusTract(objCensusTract);
		xad.setAddressRepresentationCode(strAddressRepresentationCode);
 
		xad.setEffectiveDate(objEffectiveDate);
		xad.setExpirationDate(objExpirationDate); 
		xad.setExpirationReason(objEXpirationReason);
		xad.setTemporaryIndicator(strTemporaryIndicator);
		xad.setBadAddressIndicator(strBadAddressIndicator);
		xad.setAddressUsage(strAddressUsage);
		xad.setAddressee(strAddressee);
		xad.setComment(strComment);
		xad.setPreferenceOrder(strPreferenceOrder);
		xad.setProtectionCode(objProtectionCode);
		xad.setAddressIdentifier(objAddressIdentifier);
		setPerformingOrganizationAddress(xad);

	} 
	/** Set the Performing Organization Address.
	 * This field contains the address of the organization/service responsible for performing the service.
	 * @param objPerformingOrganizationAddress Used as Performing Organization Name.
	 */ 
	public void setPerformingOrganizationAddress(XAD objPerformingOrganizationAddress)
	{
		setDataType(2284,objPerformingOrganizationAddress);
	}	
	
	/**
	 * Set the Performing Organization Medical Director.
	 * This field contains the medical director of the organization/service responsible for performing the service.  
	 * @param strIDNumber Refers to the coded ID according to a user-defined table
	 * @param objFamilyName Specifies the surname of a person.
	 * @param strGivenName Specifies First name.
	 * @param strSecondAndFurtherGivenNamesOrInitialsThereof Specifies multiple middle names that may be included by 
	 * 														   separating them with spaces.
	 * @param strSuffix Used to specify a name suffix (e.g., Jr. or III).
	 * @param strPrefix Used to specify a name prefix (e.g., Dr.).
	 * @param strSourceTable Used as the HL7 identifier for the user-defined table of values for this component. [Refer User-defined Table 0297 - CN ID.]
	 * @param objAssigningAuthority Specifies a unique identifier of the system (or organization or agency of department)
	 * 								  that creates the data. [Refer User-defined Table 0363 - Assigning authority]
	 * @param strNameTypeCode Specifies a code that represents the type of name. 
	 * @param strIdentifierCheckDigit Specifies part of the identifying number used in the sending application. 
	 * @param strCheckDigitScheme Specifies the code identifying the check digit scheme employed.[Refer HL7 Table 0061 - Check digit scheme].
	 * @param strIdentifierTypeCode Specifies A code corresponding to the type of identifier.[Refer HL7 Table 0203 - Identifier type].
	 * @param objAssigningFacility Specifies the place or location identifier where the identifier was first assigned to the person
	 * @param strNameRepresentationCode Provides an indication of the representation provided by the data item.  
	 * @param objNameContext Designates the context in which a name is used. [Refer User-defined Table 0448 ]
	 * @param strNameAssemblyOrder Specifies a code that represents the preferred display order of the components of this person name. Suggested values are G,F[Refer table 0444.]
	 * @param strEffectiveDate Specifies the first date, if known, on which the address is valid and active.
	 * @param strExpirationDate Specifies the last date, if known, on which the address is valid and active.
	 * @param strProfessionalSuffix Used to specify an abbreviation, or a string of abbreviations, denoting qualifications that support the person's profession, (e.g., licenses).
	 * @param objAssigningJurisdiction Specifies the geo-political body that assigned the identifier.
	 * @param objAssigningAgencyOrDepratment Specifies the agency or department that assigned the identifier
	 * @param strSecurityCheck Specifies the version code that may be assigned to the person identifier
	 * @param strSecurityCheckScheme Specifies the check digit scheme.
	 */ 
	public void setPerformingOrganizationMedicalDirector  (String strIDNumber,FN objFamilyName,String strGivenName,String strSecondAndFurtherGivenNamesOrInitialsThereof,
			String 	strSuffix,String strPrefix,CWE objSourceTable,HD objAssigningAuthority,
			String strNameTypeCode,String strIdentifierCheckDigit,String strCheckDigitScheme,String strIdentifierTypeCode,
			HD objAssigningFacility,String strNameRepresentationCode,CWE objNameContext,
			String strNameAssemblyOrder, String strEffectiveDate,String strExpirationDate,String strProfessionalSuffix,
			CWE objAssigningJurisdiction,CWE objAssigningAgencyOrDepratment, String strSecurityCheck, String strSecurityCheckScheme)
	{
		XCN xcn = (XCN)getDataElement(2285);
		xcn.setIdNumber(strIDNumber);
		xcn.setFamilyName(objFamilyName);
		xcn.setGivenName(strGivenName);
		xcn.setSecondNameOrInitials(strSecondAndFurtherGivenNamesOrInitialsThereof);
		xcn.setSuffix(strSuffix);
		xcn.setPrefix(strPrefix);
 
		xcn.setSourceTable(objSourceTable);
		xcn.setAssigningAuthority(objAssigningAuthority);
		xcn.setNameTypeCode(strNameTypeCode);
		xcn.setIdentifierCheckDigit(strIdentifierCheckDigit);
		xcn.setCheckDigitScheme(strCheckDigitScheme);
		xcn.setIdentifierTypeCode(strIdentifierTypeCode);
		xcn.setAssigningFacility(objAssigningFacility);
		xcn.setNameRepresentationCode(strNameRepresentationCode);
		xcn.setNameContext(objNameContext);
 
		xcn.setNameAssemblyOrder(strNameAssemblyOrder);
		xcn.setEffectiveDate(strEffectiveDate);
		xcn.setExpirationDate(strExpirationDate);
		xcn.setProfessionalSuffix(strProfessionalSuffix);
		xcn.setAssigningJurisdiction(objAssigningJurisdiction);
		xcn.setAssigningAgencyOrDepartment(objAssigningAgencyOrDepratment); 
		xcn.setSecurityCheck(strSecurityCheck);
		xcn.setSecurityCheckScheme(strSecurityCheckScheme);
		setPerformingOrganizationMedicalDirector(xcn);

	} 
	/** Set the Performing Organization Medical Director.
	 * This field contains the medical director of the organization/service responsible for performing the service.
	 * @param objPerformingOrganizationMedicalDirector Used as Performing Organization Name.
	 */ 
	public void setPerformingOrganizationMedicalDirector(XCN objPerformingOrganizationMedicalDirector)
	{
		setDataType(2285,objPerformingOrganizationMedicalDirector);
	}
	
	/**
	 * Set the Patient Results Release Category.
	 * This field contains instructions on whether to share the results with the patient, and if so how.
	 * @param strPatientResultsReleaseCategory Used as PatientResultsReleaseCategory.
	 */ 
	public void setPatientResultsReleaseCategory (String strPatientResultsReleaseCategory)
	{
		ID patientResultsReleaseCategory  = (ID)getDataElement(2313);
		patientResultsReleaseCategory.setValue(strPatientResultsReleaseCategory); 
		setPatientResultsReleaseCategory(patientResultsReleaseCategory);

	} 

	/** Set the Patient Results Release Category.
	 * This field contains instructions on whether to share the results with the patient, and if so how
	 * @param objPatientResultsReleaseCategory Used as Patient Results Release Category.
	 */ 
	public void setPatientResultsReleaseCategory(ID objPatientResultsReleaseCategory)
	{
		setDataType(2313,objPatientResultsReleaseCategory);

	}
	/**
	 * Set the Root Cause.
	 * This element contains the reason code indicating the root cause for the reissue of a previously released lab report.  
	 * @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 setRootCause(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(3308);
		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);
		setRootCause(cwe);
	}

	/**
	 * Set the Root Cause.
	 * This element contains the reason code indicating the root cause for the reissue of a previously released lab report.  
	 * @param objRootCause Root Cause.
	 */
	public void setRootCause(CWE objRootCause)
	{
		setDataType(3308,objRootCause);
	}
	/**
	 * Set the Local Process Control.
	 * This element contains information intended to be used for locally defined processing, particularly process control/status type information.  
	 * @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 setLocalProcessControl(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(3309);
		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);
		setLocalProcessControl(cwe);
	}

	/**
	 * Set the Local Process Control.
	 * This element contains information intended to be used for locally defined processing, particularly process control/status type information.  
	 * @param objLocalProcessControl LocalProcessControl.
	 */
	public void setLocalProcessControl(CWE objLocalProcessControl)
	{
		setDataType(3309,objLocalProcessControl);
	}
	/**
	 * Set the Observation Type.
	 * This field indicates the type of observation to enable systems to distinguish between observations sent along with an order, versus observations sent as the result to an order.
	 * @param strObjObservationType Used as ObservationType.
	 */ 
	public void setObservationType (String strObjObservationType)
	{
		ID objObservationType  = (ID)getDataElement(3432);
		objObservationType.setValue(strObjObservationType); 
		setObservationType(objObservationType);
	} 

	/** Set the Observation Type.
	 * This field indicates the type of observation to enable systems to distinguish between observations sent along with an order, versus observations sent as the result to an order.
	 * @param objObservationType Used as ObservationType.
	 */ 
	public void setObservationType(ID objObservationType)
	{
		setDataType(3432,objObservationType);
	}
	/**
	 * Set the Observation Sub-Type.
	 * The result sub-type provides further classification of OBX-29 Observation Type.
	 * @param strObservationSubType Used as ObservationSubType.
	 */ 
	public void setObservationSubType (String strObservationSubType)
	{
		ID observationSubType  = (ID)getDataElement(3475);
		observationSubType.setValue(strObservationSubType); 
		setObservationSubType(observationSubType);

	} 

	/** Set the Observation Sub-Type.
	 * The result sub-type provides further classification of OBX-29 Observation Type.
	 * @param objPatientResultsReleaseCategory Used as Patient Results Release Category.
	 */ 
	public void setObservationSubType(ID objObservationSubType)
	{
		setDataType(3475,objObservationSubType);

	}
	/**
	 * Validates HL7 Message objects .
	 * Validate method checks for validation each and every segments in side the Message object against specified message Structure. 
	 * Validation chcecks 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. 
	 */
	public boolean validate() throws InvalidSegmentException
	{
		try
		{
			super.validate();

			/*
			 * Currently below implemented check is commented because value table check with less priority has been 
			 * performed in base class. 
			 * If in future value table check is also strictly included then we can include this with modifications in other 
			 * expected segments also.
			 */
			//			IDataType observationIdentifier = getObservationIdentifier();
			//			IDataType observationResultStatus = getObservationResultStatus();
			//			IDataType valueType = getValueType();
			//			ISingleCollection<IS> abnormalFlags = getAbnormalFlags();
			//
			//			if(observationIdentifier!=null && observationResultStatus!=null)
			//			{
			//				if((!observationResultStatus.getValue().equals("X")))
			//				{
			//					if(valueType!=null)
			//					{
			//						/*Modified by AD on 26/07/07,
			//						 * Value Type should be one of the values described in Value Table 0125.
			//						 */ 
			//						if(getObservationValue() != null && getObservationValue().size() != 0)
			//						{
			//							String strValue = valueType.getValue();
			//							ValueTables objValueTables = ValueTables.createInstance();
			//							if(objValueTables.isValuePresent(125, strValue) == HL7Constants.HL7_VALUE_NOT_FOUND)
			//							{
			//								String strMessage = "'Observation Value :Value type contains the data type for this field according to which observation value is formatted.'";
			//								if(HL7Config.createInstance().getValidationMode()== EnumValidationMode.LOW)
			//								{
			//									if(HL7Config.createInstance().isLoggingOn())
			//									{
			//										HL7Logger.getLogger().log(strMessage);
			//									}
			//								}
			//								else
			//									throw new InvalidFieldException(strMessage);
			//
			//
			//							}
			//						}				
			//					}	
			//					
			//					if(abnormalFlags!=null)
			//					{
			//						/*Modified by AD on 26/07/07,
			//						 * Abnormal Flags should be one of the values described in Value Table 78.
			//						 */ 
			//						ValueTables objValueTables = ValueTables.createInstance();
			//						String[] arrStrDataType =  objValueTables.getTableValues(78);
			//						ISingleCollection<IS> objVect = abnormalFlags;
			//						String strValue = null;
			//
			//						for(int count=0; count < objVect.size(); count++)
			//						{
			//							strValue = (objVect.elementAt(count)).getValue();
			//							for(int index=0; index < arrStrDataType.length; index++)
			//							{
			//								if(!strValue.equalsIgnoreCase(arrStrDataType[index]))
			//								{
			//									String strMessage = "'Abnormal Flags : Should Contain Value from User-defined Table 0078 - Abnormal flags'";
			//									if(HL7Config.createInstance().getValidationMode()== EnumValidationMode.LOW)
			//									{
			//										if(HL7Config.createInstance().isLoggingOn())
			//										{
			//											HL7Logger.getLogger().log(strMessage);
			//										}
			//									}
			//									else
			//										throw new InvalidFieldException(strMessage);
			//								}
			//							}
			//						}		
			//					}
			//				}
			//			}
			return true;
		}
		catch(FieldMissingException ex)
		{
			throw new InvalidSegmentException(enumSegments.getValue(),ex);
		}
	}

	/**
	 * Parses HL7 Segment Strings from any Stream into HL7 Segment object.
	 * This method checks for the Repetition of the fields in the Segment.
	 * It also checks for the optionality of the fields as whether they are mandatory or optional.
	 * Successful parsing of the segment populates the object with the data present on the stream and provides
	 * easy accessor and mutator methods to navigate the message.
	 * It also leads to failure if version of given HL7 Message is not 2.8.2.
	 * This method raises exception if there is Segment which is not valid as per HL7 v 2.8.2 standard.
	 * @param strSegmentStream String of HL7Stream.
	 * @param objIDelimiter Object of class Delimiter.
	 * @return int - Success if segment is valid.
	 * 			   - Fail if segment in not valid
	 * @throws InvalidSegmentException Thrown when Field Validation Fails.
	 * @throws IOException Signals that an I/O exception of some sort has occurred.
	 */	
	public int parse(String strSegmentStream,IDelimiter objIDelimiter)throws IOException,InvalidSegmentException
	{
		int iRetVal = HL7Constants.HL7_FUNCTION_FAIL;
		DataElementFactory objDataElementFactory = DataElementFactory.createInstance();
		char cReadChar = '\0';
		int i = -1;
		IDataType objIDataType = null;
		try
		{
			//get field separator from IDelimiter
			char cFSeparator = objIDelimiter.getFieldSeparator();
			cReadChar = strSegmentStream.charAt(++i);

			if(cReadChar == cFSeparator)
			{
				String strEnumSegment = enumSegments.getValue();
				if(strEnumSegment.length() > 3)
				{
					strEnumSegment = strEnumSegment.substring(0, 3);
				}
				ISingleCollection<Integer> objItemIDList = objSegmentMap.getItemIDList();
				int[] iValueTable = null;
				String strDTName = null;
				int iMinLength = 0;
				int iMaxLength = 0;
				String strCLength = null;
				boolean isOptional;
				String strFieldName = null;
				for(Integer objItemID : objItemIDList)
				{
					strDTName = objSegmentMap.getDataTypeName(objItemID);
					iValueTable = objSegmentMap.getValueTable(objItemID);
					iMinLength = objSegmentMap.getItemMinimumLength(objItemID);
					iMaxLength = objSegmentMap.getItemMaximumLength(objItemID);
					strCLength = objSegmentMap.getItemConformanceLength(objItemID);
					strFieldName = objSegmentMap.getFieldName(objItemID);
					isOptional=objSegmentMap.isOptional(objItemID);
					do
					{
						String strField="";
						objIDataType = objDataElementFactory.getDataElement(iValueTable,iMinLength, iMaxLength,strCLength, strDTName,HL7Constants.HL7_COMPONENT);
						if(objIDataType == null)
						{
							// if Data Type is withdrawn then skip that value by reading stream till next delimiter
							cReadChar = strSegmentStream.charAt(++i);
							strField=""+cReadChar;
							while(cReadChar != cFSeparator && cReadChar != '\r')
							{
								cReadChar=strSegmentStream.charAt(++i);
								strField= strField+cReadChar;
							}
							if(strField!=null && strField.charAt(0) != '|')
								setUnRecognizedField(strEnumSegment, strFieldName, strField);
						}
						else
						{
							do
							{
								i++;
								strField=strField+strSegmentStream.charAt(i);
							}while(strSegmentStream.charAt(i) != '~' && strSegmentStream.charAt(i)!='|' && strSegmentStream.charAt(i)!='\r');
							iRetVal = objIDataType.read(strField, objIDelimiter);
	
							if(iRetVal == 0)
							{
								if(!isOptional)
								{
									setUnRecognizedField(strEnumSegment, strFieldName, strField);
								}
								objIDataType = null;
								cReadChar = '\0';
								cReadChar = strSegmentStream.charAt(i);
								break;
							}
							else if(iRetVal == HL7Constants.HL7_FUNCTION_FAIL)
							{
								objIDataType = null;
								setUnRecognizedField(strEnumSegment, strFieldName, strField);
							}
							else if(iRetVal == -1)  
							{
								//Avoids the reading of extra characters from stream when Components data type is withdrawn
								objIDataType = null;
								cReadChar = '\0';
								cReadChar= objIDelimiter.getFieldSeparator();
								break;
							}
							else if(iRetVal == HL7Constants.HL7_WITHDRAWN_FIELD)
							{
								setUnRecognizedField(strEnumSegment, strFieldName, strField);
							}
							else
							{
								objDataElementList.put(objItemID,objIDataType);
								objIDataType = null;
							}
							cReadChar = '\0';
							cReadChar = strSegmentStream.charAt(i);
						}
					}while(cReadChar == objIDelimiter.getRepetitionSeparator());

					if(cReadChar != cFSeparator)
						break;
				}
			}

			if(cReadChar == '\r')
			{
				/*
				 * Conversion code for Observation Value according to the value specified in Value Type
				 * In initial parsing this field has been parsed as UN.
				 */
				ID objValueType = getValueType();
				ISingleCollection<IDataType> objObservationValueList = getObservationValue();
				if(objValueType != null && objObservationValueList != null)
				{
					String strDatatype = (String)objValueType.getValue();
					ISingleCollection<IDataType> objTargetObservationValueList = new SingleCollection<IDataType>();
					IDataType objTargetDataType = DataElementFactory.createInstance().getDataElement(0,0,0, null ,strDatatype,HL7Constants.HL7_COMPONENT);
					for(IDataType objUN : objObservationValueList)
					{
						ByteArrayOutputStream objByteArrayOutputStream = new ByteArrayOutputStream();
						HL7BufferStream objHL7BufferStream = new HL7BufferStream();
						
						objHL7BufferStream.setOutputStream(objByteArrayOutputStream);
						objUN.write(objHL7BufferStream,objIDelimiter);

						//converting value to specified Data type
						ByteArrayInputStream objByteArrayInputStream = new ByteArrayInputStream(objByteArrayOutputStream.toByteArray());
						objHL7BufferStream.setInputStream(objByteArrayInputStream);
						String strTemp = "";
						if(objHL7BufferStream!= null)
						{
							
							char readCh;
							do
							{
								readCh = objHL7BufferStream.readChar();
								strTemp=strTemp+readCh;
							}while(readCh != '\0');
						}
						objTargetDataType.read(strTemp ,objIDelimiter);
						objTargetObservationValueList.add(objTargetDataType);
					}
					if(objTargetObservationValueList.size() == objObservationValueList.size())
					{
						/*
						 * If all occurrences has been modified only then attribute will be replaced.
						 */
						setDataType(573,objTargetObservationValueList);
					}
				}
				
				return HL7Constants.HL7_FUNCTION_SUCCESS;
				
			}
			else
				return HL7Constants.HL7_INVALID_SEGMENT_TERMINATOR;

		}
		catch(InvalidDataTypeException ex)
		{
			throw new InvalidSegmentException(this.getClass().getSimpleName(), ex);
		}
		catch(FieldMissingException ex)
		{
			throw new InvalidSegmentException(this.getClass().getSimpleName(),ex);
		}
		catch(InvalidFieldException ex)
		{
			throw new InvalidSegmentException(this.getClass().getSimpleName(),ex);
		}
		catch(InvalidDelimiterException ex)
		{
			throw new InvalidSegmentException(this.getClass().getSimpleName(),ex);
		}
	}
}
