/*******************************************************************************
 *  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.CQ;
import cdac.medinfo.sdk.hl7282.baselibs.CWE;
import cdac.medinfo.sdk.hl7282.baselibs.DTM;
import cdac.medinfo.sdk.hl7282.baselibs.ID;
import cdac.medinfo.sdk.hl7282.baselibs.NM;
import cdac.medinfo.sdk.hl7282.baselibs.RPT;
import cdac.medinfo.sdk.hl7282.baselibs.SI;
import cdac.medinfo.sdk.hl7282.baselibs.TM;
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.InvalidSegmentException;
import cdac.medinfo.sdk.hl7282.utils.EnumSegments;
import cdac.medinfo.sdk.hl7282.utils.SingleCollection;

/**
 * TQ1 - Timing/Quantity Segment.<p>
 * This segment is used to specify the complex timing of events and actions such as those that occur in 
 * order management and scheduling systems. This segment determines the quantity, frequency, priority,
 * and timing of a service.
 * <p>Represents an HL7 TQ1 message segment. 
 * This segment has the following fields:</p><p>
 * TQ1-1: Set ID - TQ1 (SI)<b>Optional</b><br> 
 * TQ1-2: Quantity (CQ)<b>Optional</b><br> 
 * TQ1-3: Repeat Pattern (RPT)<b>Optional</b><br> 
 * TQ1-4: Explicit Time (TM)<b>Optional</b><br> 
 * TQ1-5: Relative Time and Units (CQ)<b>Optional</b><br> 
 * TQ1-6: Service Duration (CQ)<b>Optional</b><br> 
 * TQ1-7: Start date/time (DTM)<b>Optional</b><br> 
 * TQ1-8: End date/time (DTM)<b>Optional</b><br> 
 * TQ1-9: Priority (CWE)<b>Optional</b><br> 
 * TQ1-10: Condition text (TX)<b>Optional</b><br> 
 * TQ1-11: Text instruction (TX)<b>Optional</b><br> 
 * TQ1-12: Conjunction (ID)<b>Conditional</b><br> 
 * TQ1-13: Occurrence duration (CQ)<b>Optional</b><br> 
 * TQ1-14: Total occurrence's (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 TQ1 extends Segment   
{
	

	/**
	 * Constructs the TQ1 segment.
	 */
	public TQ1()
	{super(EnumSegments.HL7_SEG_TQ1);
	}

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

	/**
	 * Retrieves the Set ID TQ1.
	 * @return String - setID_TQ1
	 */
	public SI getSetID_TQ1() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1627);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (SI)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Quantity.
	 * This field specify the numeric quantity of the service that should be provided at each service interval.
	 * @return CQ - quantity
	 */
	public CQ getQuantity() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1628);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CQ)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Repeat Pattern.
	 * This specify the repeating frequency with which the treatment is to be administered.
	 * @return ISingleCollection<RPT> - repeatPattern
	 */
	public ISingleCollection<RPT> getRepeatPattern() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1629);
		ISingleCollection<RPT> objDataList = new SingleCollection<RPT>();
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				RPT objRPT = (RPT)objDataType;
				objDataList.add(objRPT);
			}
		}

		return objDataList;
	}

	/**
	 * Retrieves the Explicit Time. 
	 * @return ISingleCollection<TM> - explicitTime
	 */
	public ISingleCollection<TM> getExplicitTime() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1630);
		ISingleCollection<TM> objDataList = new SingleCollection<TM>();
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				TM objTM = (TM)objDataType;
				objDataList.add(objTM);
			}
		}

		return objDataList;
	}

	/**
	 * Retrieves the Relative Time And Units.
	 * This field specify the interval between schedules for service request or bottle records. If this field contains a value.
	 * @return ISingleCollection<CQ> - relativeTimeAndUnits
	 */
	public ISingleCollection<CQ> getRelativeTimeAndUnits() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1631);
		ISingleCollection<CQ> objDataList = new SingleCollection<CQ>();
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				CQ objCQ = (CQ)objDataType;
				objDataList.add(objCQ);
			}
		}

		return objDataList;
	}

	/**
	 * Retrieves the Service Duration.
	 * @return CQ - serviceDuration
	 */
	public CQ getServiceDuration() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1632);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CQ)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Start Date Time.
	 * @return DTM - startDateTime
	 */
	public DTM getStartDateTime() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1633);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the End Date Time. 
	 * @return DTM - endDateTime
	 */
	public DTM getEndDateTime() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1634);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Condition Text.
	 * This field specify the conditions under which the drug is to be given.
	 * @return String - conditionText
	 */
	public TX getConditionText() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1636);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (TX)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Text Instruction.
	 * @return String - textInstruction
	 */
	public TX getTextInstruction() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1637);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (TX)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Conjunction.
	 * @return ID - conjunction
	 */
	public ID getConjunction() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1638);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Occurrence Duration.
	 * This field specify the duration for which a single performance of a service is requested.
	 * @return CQ - occurrenceDuration
	 */
	public CQ getOccurrenceDuration() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1639);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CQ)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Total Occurrences.
	 * This field specify the total number of occurrences of a service that should result from this service request. 
	 * @return String - totalOccurrences
	 */
	public NM getTotalOccurrences() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1640);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (NM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Priority.
	 * This field specify the urgency of the request.
	 * @return String - totalOccurrences
	 */
	public ISingleCollection<CWE> getPriority() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1635);
		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;
	}

	/**
	 * Set the Set ID TQ1.
	 * @param strSetID_TQ1 Specifies sequence number for timing specification transmitted.
	 */ 
	public void setSetID_TQ1 (String strSetID_TQ1) 
	{
		SI setID_TQ1  = (SI)getDataElement(1627);
		setID_TQ1.setValue(strSetID_TQ1); 
		setSetID_TQ1(setID_TQ1);

	} 

	/** 
	 * Set the Set ID TQ1.
	 * @param objsetID_TQ1 Object of Set ID TQ1.
	 */ 
	public void setSetID_TQ1(SI objsetID_TQ1)
	{
		setDataType(1627,objsetID_TQ1);

	}

	/**
	 * Set the Quantity.
	 * This field specify the numeric quantity of the service that should be provided at each service interval.
	 * @param strQuantity Specifies the numeric quantity or amount of an entity.
	 * @param objUnits Specifies the units in which the quantity is expressed. 
	 */ 
	public void setQuantity (String strQuantity,CWE objUnits) 
	{
		CQ setID_TQ1  = (CQ)getDataElement(1628);
		setID_TQ1.setQuantity(strQuantity);
		setID_TQ1.setUnits(objUnits); 
		setQuantity(setID_TQ1);

	} 

	/** 
	 * Set the Quantity.
	 * This field specify the numeric quantity of the service that should be provided at each service interval.
	 * @param objsetID_TQ1 Object of Quantity.
	 */ 
	public void setQuantity(CQ objsetID_TQ1)
	{
		setDataType(1628,objsetID_TQ1);

	}

	/**
	 * Add the Repeat Pattern.
	 * This specify the repeating frequency with which the treatment is to be administered.
	 * @param objRepeatPatternCode Represents the repeat pattern defined by the other components of this data type. Refer to User-defined Table 335 - Repeat Pattern for suggested values.
	 * @param strCalendarAlignment Use as CalendarAlignment.
	 * @param strPhaseRangeBeginValue Use as PhaseRangeBeginValue
	 * @param strPhaseRangeEndValue Use as PhaseRangeEndValue.
	 * @param strPeriodQuantity Use as PeriodQuantity.
	 * @param strPeriodUnits Use as PeriodUnits.
	 * @param strInstitutionSpecifiedTime Use as InstitutionSpecifiedTime.
	 * @param strEvent Use as Event.
	 * @param strEventOffsetQuantity Use as EventOffsetQuantity.
	 * @param strEventOffsetUnits Use as EventOffsetUnits.
	 * @param strGeneralTimingSpecification Use as GeneralTimingSpecification.
	 */ 
	public void addRepeatPattern (CWE objRepeatPatternCode,String strCalendarAlignment,String strPhaseRangeBeginValue,
			String strPhaseRangeEndValue, String strPeriodQuantity,String strPeriodUnits,String strInstitutionSpecifiedTime,
			String strEvent,String strEventOffsetQuantity,String strEventOffsetUnits,String strGeneralTimingSpecification)
	{
		RPT repeatPattern = (RPT)getDataElement(1629);
		repeatPattern.setRepeatPatternCode(objRepeatPatternCode); 
		repeatPattern.setCalendarAlignment(strCalendarAlignment);
		repeatPattern.setPhaseRangeBeginValue(strPhaseRangeBeginValue);
		repeatPattern.setPhaseRangeEndValue(strPhaseRangeEndValue);
		repeatPattern.setPeriodQuantity(strPeriodQuantity);
		repeatPattern.setPeriodUnits(strPeriodUnits);
		repeatPattern.setInstitutionSpecifiedTime(strInstitutionSpecifiedTime);
		repeatPattern.setEvent(strEvent);
		repeatPattern.setEventOffsetQuantity(strEventOffsetQuantity);
		repeatPattern.setEventOffsetUnits(strEventOffsetUnits);
		repeatPattern.setGeneralTimingSpecification(strGeneralTimingSpecification);
		addRepeatPattern(repeatPattern);
	} 

	/** Add the Repeat Pattern.
	 * This specify the repeating frequency with which the treatment is to be administered.
	 * @param objrepeatPattern Object of Repeat Pattern.
	 */ 
	public void addRepeatPattern(RPT objrepeatPattern)
	{
		addDataType(1629,objrepeatPattern);

	}

	/**
	 * Set the Repeat Pattern.
	 * This specify the repeating frequency with which the treatment is to be administered.
	 * @param objRepeatPattern List of RepeatPattern.
	 */
	@SuppressWarnings("unchecked")
	public void setRepeatPattern(ISingleCollection<RPT> objRepeatPattern)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objRepeatPattern;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1629,objCollection);
	}

	/**
	 * Add the Explicit Time.
	 * @param strExplicitTime Use as ExplicitTime.
	 */ 
	public void addExplicitTime (String strExplicitTime) 
	{
		TM explicitTime  = (TM)getDataElement(1630);
		explicitTime.setValue(strExplicitTime); 
		addExplicitTime(explicitTime);

	} 

	/** 
	 * Add the Explicit Time.
	 * @param objexplicitTime Object of Explicit Time.
	 */ 
	public void addExplicitTime(TM objexplicitTime)
	{
		addDataType(1630,objexplicitTime);

	}

	/**
	 * Set the Explicit Time.
	 * @param objExplicitTime List of Explicit Time.
	 */
	@SuppressWarnings("unchecked")
	public void setExplicitTime(ISingleCollection<TM> objExplicitTime)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objExplicitTime;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1630,objCollection);
	}

	/**
	 * Add the Relative Time And Units.
	 * This field specify the interval between schedules for service request or bottle records. If this field contains a value. 
	 * @param strQuantity Specifies the numeric quantity or amount of an entity.
	 * @param objUnits Specifies the units in which the quantity is expressed. 
	 */ 
	public void addRelativeTimeAndUnits (String strQuantity,CWE objUnits) 
	{
		CQ relativeTimeAndUnits  = (CQ)getDataElement(1631);
		relativeTimeAndUnits.setQuantity(strQuantity);
		relativeTimeAndUnits.setUnits(objUnits); 
		addRelativeTimeAndUnits(relativeTimeAndUnits);

	} 

	/** 
	 * Add the Relative Time And Units.
	 * This field specify the interval between schedules for service request or bottle records. If this field contains a value. 
	 * @param objrelativeTimeAndUnits Object of Relative Time And Units.
	 */ 
	public void addRelativeTimeAndUnits(CQ objrelativeTimeAndUnits)
	{
		addDataType(1631,objrelativeTimeAndUnits);

	}

	/**
	 * Set the Relative Time And Units.
	 * This field specify the interval between schedules for service request or bottle records. If this field contains a value. 
	 * @param objRelativeTimeAndUnits List of Relative Time And Units.
	 */
	@SuppressWarnings("unchecked")
	public void setRelativeTimeAndUnits(ISingleCollection<CQ> objRelativeTimeAndUnits)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objRelativeTimeAndUnits;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1631,objCollection);
	}

	/**
	 * Set the Service Duration.
	 * @param strQuantity Use as Quantity
	 * @param objUnits Use as Units
	 */ 
	public void setServiceDuration (String strQuantity,CWE objUnits) 
	{
		CQ serviceDuration  = (CQ)getDataElement(1632);
		serviceDuration.setQuantity(strQuantity);
		serviceDuration.setUnits(objUnits); 
		setServiceDuration(serviceDuration);

	} 

	/** 
	 * Set the Service Duration.
	 * @param objserviceDuration Object of Service Duration.
	 */ 
	public void setServiceDuration(CQ objserviceDuration)
	{
		setDataType(1632,objserviceDuration);

	}

	/**
	 * Set the Start Date Time.
	 * @param strTime Specifies a point in time using a 24-hour clock notation. 
	 */ 
	public void setStartDateTime (String strTime) 
	{
		DTM dtm  = (DTM)getDataElement(1633);
		dtm.setValue(strTime);
		setStartDateTime(dtm);

	} 

	/** 
	 * Set the Start Date Time.
	 * @param objstartDateTime Object of Start Date Time.
	 */ 
	public void setStartDateTime(DTM objstartDateTime)
	{
		setDataType(1633,objstartDateTime);

	}

	/**
	 * Set the End Date Time.
	 * @param strTime Specifies a point in time using a 24-hour clock notation. 
	 */ 
	public void setEndDateTime (String strTime) 
	{
		DTM dtm  = (DTM)getDataElement(1634);
		dtm.setValue(strTime);
		setEndDateTime(dtm);

	} 

	/** 
	 * Set the End Date Time.
	 * @param objendDateTime Object of End Date Time.
	 */ 
	public void setEndDateTime(DTM objendDateTime)
	{
		setDataType(1634,objendDateTime);

	}

	/**
	 * Add the Priority.
	 * This field specify the urgency of the request.
	* @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 addPriority(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(1635);
		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);
		addPriority(cwe);

	} 

	/** 
	 * Add the Priority.
	 * This field specify the urgency of the request.
	 * @param objpriority Object of Priority.
	 */ 
	public void addPriority(CWE objpriority)
	{
		addDataType(1635,objpriority);

	}

	/**
	 * Set the Priority.
	 * This field specify the urgency of the request.
	 * @param objPriority List of Priority.
	 */
	@SuppressWarnings("unchecked")
	public void setPriority(ISingleCollection<CWE> objPriority)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objPriority;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1635,objCollection);
	}

	/**
	 * Set the Condition Text.
	 * This field specify the conditions under which the drug is to be given.
	 * @param strConditionText Use as ConditionText
	 */ 
	public void setConditionText (String strConditionText) 
	{
		TX conditionText  = (TX)getDataElement(1636);
		conditionText.setValue(strConditionText); 
		setConditionText(conditionText);

	} 

	/** 
	 * Set the Condition Text.
	 * This field specify the conditions under which the drug is to be given.
	 * @param objconditionText Object of Condition Text.
	 */ 
	public void setConditionText(TX objconditionText)
	{
		setDataType(1636,objconditionText);

	}

	/**
	 * Set the Text Instruction.
	 * @param strTextInstruction Use as TextInstruction.
	 */ 
	public void setTextInstruction (String strTextInstruction) 
	{
		TX textInstruction  = (TX)getDataElement(1637);
		textInstruction.setValue(strTextInstruction); 
		setTextInstruction(textInstruction);

	} 

	/** 
	 * Set the Text Instruction.
	 * @param objtextInstruction Object of Text Instruction.
	 */ 
	public void setTextInstruction(TX objtextInstruction)
	{
		setDataType(1637,objtextInstruction);

	}

	/**
	 * Set the Conjunction.
	 * @param strConjunction Use as Conjunction.
	 */ 
	public void setConjunction (String strConjunction) 
	{
		ID conjunction  = (ID)getDataElement(1638);
		conjunction.setValue(strConjunction); 
		setConjunction(conjunction);

	} 

	/** 
	 * Set the Conjunction.
	 * @param objconjunction Object of Conjunction.
	 */ 
	public void setConjunction(ID objconjunction)
	{
		setDataType(1638,objconjunction);

	}

	/**
	 * Set the Occurrence Duration.
	 * This field specify the duration for which a single performance of a service is requested.
	 * @param strQuantity Specifies the numeric quantity or amount of an entity.
	 * @param objUnits Specifies the units in which the quantity is expressed. 
	 */ 
	public void setOccurrenceDuration (String strQuantity,CWE objUnits) 
	{
		CQ occurrenceDuration  = (CQ)getDataElement(1639);
		occurrenceDuration.setQuantity(strQuantity);
		occurrenceDuration.setUnits(objUnits); 
		setOccurrenceDuration(occurrenceDuration);

	} 

	/** 
	 * Set the Occurrence Duration.
	 * This field specify the duration for which a single performance of a service is requested.
	 * @param objoccurrenceDuration Object of Occurrence Duration.
	 */ 
	public void setOccurrenceDuration(CQ objoccurrenceDuration)
	{
		setDataType(1639,objoccurrenceDuration);

	}

	/**
	 * Set the Total Occurrences.
	 * This field specify the total number of occurrences of a service that should result from this service request.
	 * @param strTotalOccurrences Contains the total number of occurrences of a service that should result from this service request.   	
	 */ 
	public void setTotalOccurrences (String strTotalOccurrences) 
	{
		NM totalOccurrences  = (NM)getDataElement(1640);
		totalOccurrences.setValue(strTotalOccurrences); 
		setTotalOccurrences(totalOccurrences);

	} 

	/** 
	 * Set the Total Occurrences.
	 * This field specify the total number of occurrences of a service that should result from this service request.
	 * @param objtotalOccurrences Object of Total Occurrences.   	
	 */ 
	public void setTotalOccurrences(NM objtotalOccurrences)
	{
		setDataType(1640,objtotalOccurrences);

	}

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

		//Condition Rule: If the TQ1 segment is repeated in the message, this field must be populated with the
		//appropriate Conjunction code indicating the sequencing of the following TQ1 segment.

		return true;
	}
}