/*******************************************************************************
 *  Copyright 2017 Centre for Development of Advanced Computing(C-DAC), Pune
 *  
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *  
 *    http://www.apache.org/licenses/LICENSE-2.0
 *  
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *******************************************************************************/
package cdac.medinfo.sdk.hl7282.baselibs.segments;

import cdac.medinfo.sdk.hl7282.baselibs.CWE;
import cdac.medinfo.sdk.hl7282.baselibs.DLT;
import cdac.medinfo.sdk.hl7282.baselibs.NM;
import cdac.medinfo.sdk.hl7282.baselibs.NR;
import cdac.medinfo.sdk.hl7282.baselibs.RFR;
import cdac.medinfo.sdk.hl7282.baselibs.TX;
import cdac.medinfo.sdk.hl7282.commoninterface.IDataType;
import cdac.medinfo.sdk.hl7282.commoninterface.ISingleCollection;
import cdac.medinfo.sdk.hl7282.exceptions.FieldMissingException;
import cdac.medinfo.sdk.hl7282.exceptions.InvalidSegmentException;
import cdac.medinfo.sdk.hl7282.utils.EnumSegments;
import cdac.medinfo.sdk.hl7282.utils.SingleCollection;

/***
 * OM2 - Numeric Observation Segment.<p>
 * The Technical Steward for the OM2 segment is ORDERS.
 * This segment contains the attributes of observations with continuous values
 * (including those with data types of numeric, date, or time stamp).
 * <p>Represents an HL7 OM2 message segment. 
 * This segment has the following fields:</p><p>
 * OM2-1: Sequence Number - Test/Observation Master File (NM)<b>Optional</b><br> 
 * OM2-2: Units of Measure (CWE)<b>Optional</b><br> 
 * OM2-3: Range of Decimal Precision (NM)<b>Optional</b><br> 
 * OM2-4: Corresponding SI Units of Measure (CWE)<b>Optional</b><br> 
 * OM2-5: SI Conversion Factor (TX)<b>Optional</b><br> 
 * OM2-6: Reference (Normal) Range - Ordinal and Continuous Observations (RFR) <b>Optional</b><br> 
 * OM2-7: Critical Range for Ordinal and Continuous Observations (RFR)<b>Optional</b><br> 
 * OM2-8: Absolute Range for Ordinal and Continuous Observations (RFR)<b>Optional</b><br> 
 * OM2-9: Delta Check Criteria (DLT)<b>Optional</b><br> 
 * OM2-10: Minimum Meaningful Increments (NM)<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 OM2 extends Segment   
{
	

	/***
	 * Constructs the OM2 segment.
	 */
	public OM2()
	{super(EnumSegments.HL7_SEG_OM2);
	}

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

	/**
	 * Retrieves the Absolute Range for Ordinal and Continuous Observations.
	 * This field defines the range of possible results.  
	 * @return RFR - absoluteRangeforOrdinalandContinuousObservations
	 */
	public RFR getAbsoluteRangeforOrdinalandContinuousObservations() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(633);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (RFR)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Corresponding SI Units of Measure.
	 * This field contains the single tests/observations the corresponding SI units of measure in the format, when these differ from the customary units of measure given in the previous field.
	 * @return CWE - correspondingSIUnitsofMeasure
	 */
	public CWE getCorrespondingSIUnitsofMeasure() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(629);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Critical Range for Ordinal and Continuous Observations.
	 * This field Critical Range for Ordinal and Continuous Observations.
	 * @return ISingleCollection<RFR> - criticalRangeforOrdinalandContinuousObservations
	 */
	public ISingleCollection<RFR> getCriticalRangeforOrdinalandContinuousObservations() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(632);
		ISingleCollection<RFR> objDataList = new SingleCollection<RFR>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				RFR objRFR = (RFR)objDataType;
				objDataList.add(objRFR);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Delta Check Criteria.
	 * This field describes the information that controls delta check warnings.
	 * @return ISingleCollection<DLT> - deltaCheckCriteria
	 */
	public ISingleCollection<DLT> getDeltaCheckCriteria() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(634);
		ISingleCollection<DLT> objDataList = new SingleCollection<DLT>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				DLT objDLT = (DLT)objDataType;
				objDataList.add(objDLT);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Minimum Meaningful Increments.
	 * This field contains the numerically valued single observations.
	 * @return NM - minimumMeaningfulIncrements
	 */
	public NM getMinimumMeaningfulIncrements() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(635);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (NM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Range of Decimal Precision.
	 * This field contains the numerically valued single observations.
	 * @return ISingleCollection<NM> - rangeofDecimalPrecision
	 */
	public ISingleCollection<NM> getRangeofDecimalPrecision() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(628);
		ISingleCollection<NM> objDataList = new SingleCollection<NM>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				NM objNM = (NM)objDataType;
				objDataList.add(objNM);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Reference Normal Range Ordinal and Continuous Observations.
	 * This field contains the reference(normal) ranges for "numeric" observations/tests with a nature code of A or C.
	 * @return ISingleCollection<RFR> - referenceNormalRangeOrdinalandContinuousObservations
	 */
	public ISingleCollection<RFR> getReferenceNormalRangeOrdinalandContinuousObservations() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(631);
		ISingleCollection<RFR> objDataList = new SingleCollection<RFR>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				RFR objRFR = (RFR)objDataType;
				objDataList.add(objRFR);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Sequence Number Test Observation Master File.
	 * This field contains the same value as the sequence number of the associated OM1 segment.
	 * @return NM - sequenceNumberTestObservationMasterFile
	 */
	public NM getSequenceNumberTestObservationMasterFile() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(586);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (NM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the SI Conversion Factor.
	 * This field contains the continuous, numerically valued tests/observations, with a nature code of A or C.
	 * @return TX - sIConversionFactor
	 */
	public TX getSIConversionFactor() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(630);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (TX)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Units of Measure.
	 * This field contains the single tests/observations.
	 * @return CWE - unitsofMeasure
	 */
	public CWE getUnitsofMeasure() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(627);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Set the Absolute Range for Ordinal and Continuous Observations.
	 * This field defines the range of possible results.
	 * @param objNumericRange This component specifies the numeric interval of the reference data. 
	 * @param objAdministrativeSex This component specifies which gender for which the reference range is valid. 
	 * @param objAgeRange This component specifies the age range for which the reference range is valid.
	 * @param objGestationalAgeRange This component specifies the gestational age range for which the reference range is valid. 
	 * @param strSpecies This component specifies the species for which the reference range is valid. 
	 * @param strRacesubspecies This component specifies the race or subspecies for which the reference range is valid. 
	 * @param strConditions This component specifies any arbitrary condition for which the reference range is valid. 
	 */ 
	public void setAbsoluteRangeforOrdinalandContinuousObservations (NR objNumericRange,CWE objAdministrativeSex,NR objAgeRange,NR objGestationalAgeRange,
			String strSpecies,String strRacesubspecies,String strConditions)
	{
		RFR absoluteRangeforOrdinalandContinuousObservations =(RFR)getDataElement(633);
		absoluteRangeforOrdinalandContinuousObservations.setNumericRange(objNumericRange);
		absoluteRangeforOrdinalandContinuousObservations.setAdministrativeSex(objAdministrativeSex);
		absoluteRangeforOrdinalandContinuousObservations.setAgeRange(objAgeRange);
		absoluteRangeforOrdinalandContinuousObservations.setGestationalAgeRange(objGestationalAgeRange);
		absoluteRangeforOrdinalandContinuousObservations.setSpecies(strSpecies);
		absoluteRangeforOrdinalandContinuousObservations.setRacesubspecies(strRacesubspecies);
		absoluteRangeforOrdinalandContinuousObservations.setConditions(strConditions);
		setAbsoluteRangeforOrdinalandContinuousObservations(absoluteRangeforOrdinalandContinuousObservations);

	} 

	/** 
	 * Set the Absolute Range for Ordinal and Continuous Observations.
	 * This field defines the range of possible results.
	 * @param objabsoluteRangeforOrdinalandContinuousObservations Object of  Absolute Range for Ordinal and Continuous Observations.
	 */ 
	public void setAbsoluteRangeforOrdinalandContinuousObservations(RFR objabsoluteRangeforOrdinalandContinuousObservations)
	{
		setDataType(633,objabsoluteRangeforOrdinalandContinuousObservations);

	}

	/**
	 * Set the Units of Measure.
	 * This field contains the single tests/observations.
	 * @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 setUnitsofMeasure (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(627);
		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); 
		setUnitsofMeasure(cwe);

	} 

	/** 
	 * Set the Units of Measure.
	 * This field contains the single tests/observations.
	 * @param objunitsofMeasure Object of Units of Measure.
	 */ 
	public void setUnitsofMeasure(CWE objunitsofMeasure)
	{
		setDataType(627,objunitsofMeasure);

	}

	/**
	 * Set the Corresponding SI Units of Measure.
	 * This field contains the single tests/observations the corresponding SI units of measure in the format, when these differ from the customary units of measure given in the previous field.
	 * @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 setCorrespondingSIUnitsofMeasure (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(629);
		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); 
		setCorrespondingSIUnitsofMeasure(cwe);

	} 

	/** 
	 * Set the Corresponding SI Units of Measure.
	 * This field contains the single tests/observations the corresponding SI units of measure in the format, when these differ from the customary units of measure given in the previous field.
	 * @param objcorrespondingSIUnitsofMeasure Object of Corresponding SI Units of Measure.
	 */ 
	public void setCorrespondingSIUnitsofMeasure(CWE objcorrespondingSIUnitsofMeasure)
	{
		setDataType(629,objcorrespondingSIUnitsofMeasure);

	}


	/**
	 * Add the Critical Range for Ordinal and Continuous Observations.
	 * This field Critical Range for Ordinal and Continuous Observations.
	 * @param objNumericRange This component specifies the numeric interval of the reference data. 
	 * @param objAdministrativeSex This component specifies which gender for which the reference range is valid. 
	 * @param objAgeRange This component specifies the age range for which the reference range is valid.
	 * @param objGestationalAgeRange This component specifies the gestational age range for which the reference range is valid. 
	 * @param strSpecies This component specifies the species for which the reference range is valid. 
	 * @param strRacesubspecies This component specifies the race or subspecies for which the reference range is valid. 
	 * @param strConditions This component specifies any arbitrary condition for which the reference range is valid. 
	 */
	public void addCriticalRangeforOrdinalandContinuousObservations
	(NR objNumericRange,CWE objAdministrativeSex,NR objAgeRange,NR objGestationalAgeRange,
			String strSpecies,String strRacesubspecies,String strConditions)
	{
		RFR criticalRangeforOrdinalandContinuousObservations =(RFR)getDataElement(632);
		criticalRangeforOrdinalandContinuousObservations.setNumericRange(objNumericRange);
		criticalRangeforOrdinalandContinuousObservations.setAdministrativeSex(objAdministrativeSex);
		criticalRangeforOrdinalandContinuousObservations.setAgeRange(objAgeRange);
		criticalRangeforOrdinalandContinuousObservations.setGestationalAgeRange(objGestationalAgeRange);
		criticalRangeforOrdinalandContinuousObservations.setSpecies(strSpecies);
		criticalRangeforOrdinalandContinuousObservations.setRacesubspecies(strRacesubspecies);
		criticalRangeforOrdinalandContinuousObservations.setConditions(strConditions);
		addCriticalRangeforOrdinalandContinuousObservations(criticalRangeforOrdinalandContinuousObservations);
	}

	/**
	 * Add the Critical Range for Ordinal and Continuous Observations.
	 * This field Critical Range for Ordinal and Continuous Observations.
	 * @param objcriticalRangeforOrdinalandContinuousObservations Object of Critical Range for Ordinal and Continuous Observations.
	 */
	public void addCriticalRangeforOrdinalandContinuousObservations(RFR objcriticalRangeforOrdinalandContinuousObservations)
	{
		addDataType(632,objcriticalRangeforOrdinalandContinuousObservations);
	}

	/**
	 * Set the Critical Range for Ordinal and Continuous Observations.
	 * This field Critical Range for Ordinal and Continuous Observations.
	 * @param objcriticalRangeforOrdinalandContinuousObservationsList List of Critical Range for Ordinal and Continuous Observations.
	 */
	@SuppressWarnings("unchecked")
	public void setCriticalRangeforOrdinalandContinuousObservations(ISingleCollection<RFR> objcriticalRangeforOrdinalandContinuousObservationsList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objcriticalRangeforOrdinalandContinuousObservationsList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(908,objCollection);
	}

	/**
	 * Add the Reference Normal Range Ordinal and Continuous Observations.
	 * This field contains the reference(normal) ranges for "numeric" observations/tests with a nature code of A or C.
	 * @param objNumericRange This component specifies the numeric interval of the reference data. 
	 * @param objAdministrativeSex This component specifies which gender for which the reference range is valid. 
	 * @param objAgeRange This component specifies the age range for which the reference range is valid.
	 * @param objGestationalAgeRange This component specifies the gestational age range for which the reference range is valid. 
	 * @param strSpecies This component specifies the species for which the reference range is valid. 
	 * @param strRacesubspecies This component specifies the race or subspecies for which the reference range is valid. 
	 * @param strConditions This component specifies any arbitrary condition for which the reference range is valid. 
	 */
	public void addReferenceNormalRangeOrdinalandContinuousObservations(NR objNumericRange,CWE objAdministrativeSex,NR objAgeRange,NR objGestationalAgeRange,
			String strSpecies,String strRacesubspecies,String strConditions)
	{
		RFR referenceNormalRangeOrdinalandContinuousObservations =(RFR)getDataElement(631);
		referenceNormalRangeOrdinalandContinuousObservations.setNumericRange(objNumericRange);
		referenceNormalRangeOrdinalandContinuousObservations.setAdministrativeSex(objAdministrativeSex);
		referenceNormalRangeOrdinalandContinuousObservations.setAgeRange(objAgeRange);
		referenceNormalRangeOrdinalandContinuousObservations.setGestationalAgeRange(objGestationalAgeRange);
		referenceNormalRangeOrdinalandContinuousObservations.setSpecies(strSpecies);
		referenceNormalRangeOrdinalandContinuousObservations.setRacesubspecies(strRacesubspecies);
		referenceNormalRangeOrdinalandContinuousObservations.setConditions(strConditions);
		addReferenceNormalRangeOrdinalandContinuousObservations(referenceNormalRangeOrdinalandContinuousObservations);
	}

	/**
	 * Add the Reference Normal Range Ordinal and Continuous Observations.
	 * This field contains the reference(normal) ranges for "numeric" observations/tests with a nature code of A or C.
	 * @param objreferenceNormalRangeOrdinalandContinuousObservations Object of Reference Normal Range Ordinal and Continuous Observations.
	 */
	public void addReferenceNormalRangeOrdinalandContinuousObservations(RFR objreferenceNormalRangeOrdinalandContinuousObservations)
	{
		addDataType(631,objreferenceNormalRangeOrdinalandContinuousObservations);
	}

	/**
	 * Set the Reference Normal Range Ordinal and Continuous Observations.
	 * This field contains the reference(normal) ranges for "numeric" observations/tests with a nature code of A or C.
	 * @param objreferenceNormalRangeOrdinalandContinuousObservationsList List of Reference Normal Range Ordinal and Continuous Observations.
	 */
	@SuppressWarnings("unchecked")
	public void setReferenceNormalRangeOrdinalandContinuousObservations(ISingleCollection<RFR> objreferenceNormalRangeOrdinalandContinuousObservationsList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objreferenceNormalRangeOrdinalandContinuousObservationsList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(908,objCollection);
	}

	/**
	 * Add the Delta Check Criteria.
	 * This field describes the information that controls delta check warnings.
	 * @param objNormalRange Specifies the normal interval of the reference data 
	 * @param strNumericThreshold Specifies the numeric threshold of the change that is detected. 
	 * @param strChangeComputation Specifies if the change is computed as a percent change or as an absolute change.
	 * 								 [Refer to HL7 Table 0523 - Computation type]valid values %,a.
	 * @param strDaysRetained Specifies of time in days that the value is retained for computing delta checks.
	 */
	public void addDeltaCheckCriteria(NR objNormalRange,String strNumericThreshold,String strChangeComputation,
			String strDaysRetained)
	{
		DLT deltaCheckCriteria =(DLT)getDataElement(634);
		deltaCheckCriteria.setNormalRange(objNormalRange);
		deltaCheckCriteria.setNumericThreshold(strNumericThreshold);
		deltaCheckCriteria.setChangeComputation(strChangeComputation);
		deltaCheckCriteria.setDaysRetained(strDaysRetained);
		addDeltaCheckCriteria(deltaCheckCriteria);
	}

	/**
	 * Add the Delta Check Criteria.
	 * This field describes the information that controls delta check warnings.
	 * @param objdeltaCheckCriteria Object of Delta Check Criteria.
	 */
	public void addDeltaCheckCriteria(DLT objdeltaCheckCriteria)
	{
		addDataType(634,objdeltaCheckCriteria);
	}

	/**
	 * Set the Delta Check Criteria.
	 * This field describes the information that controls delta check warnings.
	 * @param objdeltaCheckCriteriaList List of Delta Check Criteria.
	 */
	@SuppressWarnings("unchecked")
	public void setDeltaCheckCriteria(ISingleCollection<DLT> objdeltaCheckCriteriaList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objdeltaCheckCriteriaList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(908,objCollection);
	}

	/**
	 * Set the Minimum Meaningful Increments.
	 * This field contains the numerically valued single observations.
	 * @param strQuantity This field contains the String Value of Quantity
	 */ 
	public void setMinimumMeaningfulIncrements (String strQuantity) 
	{
		NM minimumMeaningfulIncrements  = (NM)getDataElement(635);
		minimumMeaningfulIncrements.setValue(strQuantity); 
		setMinimumMeaningfulIncrements(minimumMeaningfulIncrements);

	} 

	/** 
	 * Set the Minimum Meaningful Increments.
	 * This field contains the numerically valued single observations.
	 * @param objminimumMeaningfulIncrements Object of Minimum Meaningful Increments.
	 */ 
	public void setMinimumMeaningfulIncrements(NM objminimumMeaningfulIncrements)
	{
		setDataType(635,objminimumMeaningfulIncrements);

	}

	/**
	 * Set the Sequence Number Test Observation Master File.
	 * This field contains the same value as the sequence number of the associated OM1 segment.
	 * @param strQuantity This field contains the String Value of Quantity
	 */ 
	public void setSequenceNumberTestObservationMasterFile (String strQuantity) 
	{
		NM sequenceNumberTestObservationMasterFile  = (NM)getDataElement(586);
		sequenceNumberTestObservationMasterFile.setValue(strQuantity); 
		setSequenceNumberTestObservationMasterFile(sequenceNumberTestObservationMasterFile);

	} 

	/** 
	 * Set the Sequence Number Test Observation Master File.
	 * This field contains the same value as the sequence number of the associated OM1 segment.
	 * @param objsequenceNumberTestObservationMasterFile Object of Sequence Number Test Observation Master File.
	 */ 
	public void setSequenceNumberTestObservationMasterFile(NM objsequenceNumberTestObservationMasterFile)
	{
		setDataType(586,objsequenceNumberTestObservationMasterFile);

	}

	/**
	 * Add the Range of Decimal Precision.
	 * This field contains the numerically valued single observations.
	 * @param strNoOfProductExpReportFiledByDistributor This field contains the String Value of Number 
	 * 													of Product Experiance Report Filed By Distributor
	 */
	public void addRangeofDecimalPrecision(String strNoOfProductExpReportFiledByDistributor) 
	{
		NM rangeofDecimalPrecision  = (NM)getDataElement(628);
		rangeofDecimalPrecision.setValue(strNoOfProductExpReportFiledByDistributor);
		addRangeofDecimalPrecision(rangeofDecimalPrecision);
	}

	/**
	 * Add the Range of Decimal Precision.
	 * This field contains the numerically valued single observations.
	 * @param objrangeofDecimalPrecision Object of Range of Decimal Precision.
	 */
	public void addRangeofDecimalPrecision(NM objrangeofDecimalPrecision)
	{
		addDataType(628,objrangeofDecimalPrecision);
	}

	/**
	 * Set the Range of Decimal Precision.
	 * This field contains the numerically valued single observations.
	 * @param objrangeofDecimalPrecisionList List of Range of Decimal Precision.
	 */
	@SuppressWarnings("unchecked")
	public void setRangeofDecimalPrecision(ISingleCollection<NM> objrangeofDecimalPrecisionList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objrangeofDecimalPrecisionList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(628,objCollection);
	}

	/**
	 * Set the SI Conversion Factor.
	 * This field contains the continuous, numerically valued tests/observations, with a nature code of A or C.
	 * @param strSoftwareProductInformation Use as SoftwareProductInformation.
	 */ 
	public void setSIConversionFactor (String strSoftwareProductInformation) 
	{
		TX sIConversionFactor  = (TX)getDataElement(630); 
		sIConversionFactor.setValue(strSoftwareProductInformation); 
		setSIConversionFactor(sIConversionFactor);

	} 

	/** 
	 * Set the SI Conversion Factor.
	 * This field contains the continuous, numerically valued tests/observations, with a nature code of A or C.
	 * @param objsIConversionFactor Object of SI Conversion Factor.
	 */ 
	public void setSIConversionFactor(TX objsIConversionFactor)
	{
		setDataType(630,objsIConversionFactor);

	}

	/**
	 * 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
	 */	
	@Override
	public boolean validate() throws InvalidSegmentException 
	{
		try
		{
			super.validate();

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