/*******************************************************************************
 *  Copyright 2017-2018 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.dcm30_04.baselibs;



import cdac.medinfo.sdk.dcm30_04.commoninterface.IDataElement;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDicomValue;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDictionaryReader;
import cdac.medinfo.sdk.dcm30_04.commoninterface.ITransferSyntax;
import cdac.medinfo.sdk.dcm30_04.enums.EnumSourceApplicatorType;
import cdac.medinfo.sdk.dcm30_04.enums.EnumSourceMovementType;
import cdac.medinfo.sdk.dcm30_04.exceptions.ConditionFailedException;
import cdac.medinfo.sdk.dcm30_04.exceptions.InvalidItemException;
import cdac.medinfo.sdk.dcm30_04.exceptions.MandatoryMissingException;
import cdac.medinfo.sdk.dcm30_04.utils.DicomConfig;
import cdac.medinfo.sdk.dcm30_04.utils.DicomConstants;
import cdac.medinfo.sdk.dcm30_04.utils.DicomLogger;




/**
* This item class contains methods to validate,set and get the attributes in Channel Sequence.
 */
public class ChannelSequenceItem extends Item  
{
	

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 1L;


	/**
	 * This constructor creates the item and internal code sequence macro with default TransferSyntax 
	 */
	ChannelSequenceItem()
	{
		super();
	}


	/**
	 * This constructor creates the item and internal code sequence macro with default TransferSyntax 
	 * and default DictionaryReader
	 * @param objITransferSyntax specifies the DICOM Standard defined TransfeSyntax
	 */
	ChannelSequenceItem(ITransferSyntax objITransferSyntax)
	{
		super(objITransferSyntax);
	}

	/**
	 * This constructor creates ChannelSequenceItem with specified TransferSyntax and
	 * specified DictionaryReader
	 * @param objTransferSyntax specifies the DICOM Standard defined TransfeSyntax
	 * @param objDictionaryReader specifies the DICOM Dictionary reader to be used 
	 */
	ChannelSequenceItem(ITransferSyntax objTransferSyntax, IDictionaryReader objDictionaryReader)
	{
		super(objTransferSyntax,objDictionaryReader);
	}


	/**
	 * Validates all the attributes in ChannelSequenceItem that are present in the DataSet
	 * @return boolean - Success -true, Failure - false
	 * @throws InvalidItemException throws InvalidItemException If Conditional element fails.
	 */
	public boolean validateForModule()  throws InvalidItemException
	{
		try
		{
			/**
			 * conditions for Number of Pulses(300A,028A) and Pulse Repetition Interval(300A,028C) and
			 * Final Cumulative Time Weight(300A,02C8) is not mentioned.
			 * Because Brachy Treatment Type (300A,0202) and Cumulative Time Weight(300A,02D6)  are in other sequences.
			 */
			String strSourceMovememtType = getSourceMovementType();
			String strTransferTubeNumber = getTransferTubeNumber();

			if(!contains(0x300A,0x0282))
				throw new MandatoryMissingException("300A,0282");
			if(!contains(0x300A,0x02A2))
				throw new MandatoryMissingException("300A,02A2");
			if(!contains(0x300A,0x0284))
				throw new MandatoryMissingException("300A,0284");
			if(!contains(0x300A,0x0286))
				throw new MandatoryMissingException("300A,0286");
			if(!contains(0x300A,0x0288))
				throw new MandatoryMissingException("300A,0288");
			if(!contains(0x300C,0x000E))
				throw new MandatoryMissingException("300C,000E");
			if(!contains(0x300A,0x0110))
				throw new MandatoryMissingException("300A,0110");
			if(!contains(0x300A,0x02D0))
				throw new MandatoryMissingException("300A,02D0");
			if((contains(0x300A,0x0290)  && !contains(0x300A,0x010C)))
				throw new ConditionFailedException("value of conditional Element 0x300A,0x010C required if 0x300A,0x0290 is present") ;
			if((contains(0x300A,0x0290)  && !contains(0x300A,0x0292)))
				throw new ConditionFailedException("value of conditional Element 0x300A,0x0292 required if 0x300A,0x0290 is present") ;
			if((contains(0x300A,0x0290)  && !contains(0x300A,0x0296)))
				throw new ConditionFailedException("value of conditional Element 0x300A,0x0296 required if 0x300A,0x0290 is present") ;
			if((strSourceMovememtType.equalsIgnoreCase(EnumSourceMovementType.STEPWISE.getValue()) && !contains(0x300A,0x02A0)))
				throw new ConditionFailedException("value of conditional Element 0x300A,0x02A0 required if Required if Source Movement Type (300A,0288) is STEPWISE") ;
			if((contains(0x300A,0x0290)  && !contains(0x3006,0x0084)))
				throw new ConditionFailedException("value of conditional Element 0x3006,0x0084 required if 0x300A,0x0290 is present") ;
			if(((strTransferTubeNumber != null)&& !contains(0x300A,0x02A4)))
				throw new ConditionFailedException("value of conditional Element 0x300A,0x02A4 required if Required if value Transfer Tube Number (300A,02A2) is non-null.") ;

			if(contains(0x300A,0x02B0))
				getChannelShieldSequence().validateForModule();
			if(contains(0x300A,0x02D0))
				getBrachyControlPointSequence().validateForModule();
		}
		catch( ConditionFailedException ce)
		{
			if(DicomConfig.createInstance().isLoggingOn())
			{
				DicomLogger.getLogger().log(ce.getMessage());
			}
			throw new InvalidItemException(this.getClass().getSimpleName(),ce); 
		}
		catch( MandatoryMissingException me)
		{
			if(DicomConfig.createInstance().isLoggingOn())
			{
				DicomLogger.getLogger().log(me.getMessage());
			}
			throw new InvalidItemException(this.getClass().getSimpleName(),me);
		}
		return true;
	}

	/**
	 * Sets Channel Number .Uniquely identifies Channel Number(300A,0282) in Channel Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param strChannelNumber-String value of Channel Number.
	 */
	public void setChannelNumber(String strChannelNumber)
	{
		/*Accept the ChannelNumber in String format of type IS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x300A,0x0282, strChannelNumber,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300A,0x0282,DicomConstants.DCM_DT_IS, strChannelNumber);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Channel Number.
	 * @return String - value of Channel Number.
	 */
	public String getChannelNumber()
	{
		Object objValue = getValue(0x300A,0x0282);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Sets Channel Length .Uniquely identifies Channel Length(300A,0284) in Channel
	 *  Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param strChannelLength -String value of Channel Length.
	 */
	public void setChannelLength(String strChannelLength)
	{
		/*Accept the ChannelLength in String format of type DS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x300A,0x0284, strChannelLength,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300A,0x0284,DicomConstants.DCM_DT_DS,strChannelLength);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Channel Length.
	 * @return String - value of Channel Length.
	 */
	public String getChannelLength()
	{
		Object objValue = getValue(0x300A,0x0284);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Sets Channel Total Time.Uniquely identifies Channel Total Time(300A,0286) in Channel Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param strChannelTotalTime- String value of Channel Total Time.
	 */
	public void setChannelTotalTime(String strChannelTotalTime)
	{
		/*Accept the ChannelTotalTime in String format of type DS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x300A,0x0286, strChannelTotalTime,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300A,0x0286,DicomConstants.DCM_DT_DS,strChannelTotalTime);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Channel Total Time.
	 * @return String - value of Channel Total Time.
	 */
	public String getChannelTotalTime()
	{
		Object objValue = getValue(0x300A,0x0286);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Sets Source Movement Type.Uniquely identifies Source Movement Type(300A,0286) in Channel Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param enumSourceMovementType- Enum value of Source Movement Type.
	 */
	public void setSourceMovementType(EnumSourceMovementType enumSourceMovementType)
	{
		/*Accept the SourceMovementType in String format of type DS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */

		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)	
			objIDataElement = new ImplicitDE(0x300A,0x0288, enumSourceMovementType.getValue(),getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300A,0x0288,DicomConstants.DCM_DT_CS,enumSourceMovementType.getValue());

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Source Movement Type.
	 * @return String - value of Source Movement Type.
	 */
	public String getSourceMovementType()
	{
		Object objValue = getValue(0x300A,0x0288);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Sets Number of Pulses.Uniquely identifies Number of Pulses(300A,028A) in Channel Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param strNumberofPulses-String value of Number of Pulses.
	 */
	public void setNumberofPulses(String strNumberofPulses)
	{
		/*Accept the NumberofPulses in String format of type IS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x300A,0x028A, strNumberofPulses,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300A,0x028A,DicomConstants.DCM_DT_IS,strNumberofPulses);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Number of Pulses.
	 * @return String value of Number of Pulses.
	 */
	public String getNumberofPulses()
	{
		Object objValue = getValue(0x300A,0x028A);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Sets Pulse Repetition Interval.Uniquely identifies Pulse Repetition Interval(300A,028C) in Channel Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param strPulseRepetitionInterval -String value of Pulse Repetition Interval.
	 */
	public void setPulseRepetitionInterval(String strPulseRepetitionInterval)
	{
		/*Accept the PulseRepetitionInterval in String format of type DS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)	
			objIDataElement = new ImplicitDE(0x300A,0x028C, strPulseRepetitionInterval,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300A,0x028C,DicomConstants.DCM_DT_DS,strPulseRepetitionInterval);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Pulse Repetition Interval.
	 * @return String - value of Pulse Repetition Interval.
	 */
	public String getPulseRepetitionInterval()
	{
		Object objValue = getValue(0x300A,0x028C);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Sets Source Applicator Number.Uniquely identifies Source Applicator Number(300A,0290) in Channel Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param strSourceApplicatorNumber String value of Source Applicator Number.
	 */
	public void setSourceApplicatorNumber(String strSourceApplicatorNumber)
	{
		/*Accept the SourceApplicatorNumber in String format of type IS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)		
			objIDataElement = new ImplicitDE(0x300A,0x0290, strSourceApplicatorNumber,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300A,0x0290,DicomConstants.DCM_DT_IS,strSourceApplicatorNumber);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Source Applicator Number.
	 * @return String - value of Source Applicator Number.
	 */
	public String getSourceApplicatorNumber()
	{
		Object objValue = getValue(0x300A,0x0290);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Sets Source Applicator ID.Uniquely identifies Source Source Applicator ID(300A,0291) in Channel Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param strSourceApplicatorID String value of Source Applicator ID.
	 */
	public void setSourceApplicatorID(String strSourceApplicatorID)
	{
		/*Accept the SourceApplicatorID in String format of type SH.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)	
			objIDataElement = new ImplicitDE(0x300A,0x0291, strSourceApplicatorID,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300A,0x0291,DicomConstants.DCM_DT_SH,strSourceApplicatorID);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Source Applicator ID.
	 * @return String value of Source Applicator ID.
	 */
	public String getSourceApplicatorID()
	{
		Object objValue = getValue(0x300A,0x0291);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Sets Source Applicator Type.Uniquely identifies Source Source Applicator Type(300A,0292) in Channel Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param enumSourceApplicatorType Enum value of Source Applicator Type.
	 */
	public void setSourceApplicatorType(EnumSourceApplicatorType enumSourceApplicatorType)
	{
		/*Accept the SourceApplicatorType in String format of type CS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */

		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x300A,0x0292, enumSourceApplicatorType.getValue(),getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300A,0x0292,DicomConstants.DCM_DT_CS,enumSourceApplicatorType.getValue());

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Source Applicator Type.
	 * @return String - value of Source Applicator Type.
	 */
	public String getSourceApplicatorType()
	{
		Object objValue = getValue(0x300A,0x0292);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Sets Source Applicator Name.Uniquely identifies Source Source Applicator Name(300A,0294) in Channel Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param strSourceApplicatorName- String value of Source Applicator Name.
	 */
	public void setSourceApplicatorName(String strSourceApplicatorName)
	{
		/*Accept the SourceApplicatorName in String format of type LO.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x300A,0x0294, strSourceApplicatorName,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300A,0x0294,DicomConstants.DCM_DT_LO,strSourceApplicatorName);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Source Applicator Name.
	 * @return String - value of Source Applicator Name.
	 */
	public String getSourceApplicatorName()
	{
		Object objValue = getValue(0x300A,0x0294);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Sets Source Applicator Length.Uniquely identifies Source Source Applicator Length(300A,0296) in Channel Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param strSourceApplicatorLength- String value of Source Applicator Length.
	 */
	public void setSourceApplicatorLength(String strSourceApplicatorLength)
	{
		/*Accept the SourceApplicatorLength in String format of type DS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x300A,0x0296, strSourceApplicatorLength,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300A,0x0296,DicomConstants.DCM_DT_DS,strSourceApplicatorLength);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Source Applicator Length.
	 * @return String - value of Source Applicator Length.
	 */
	public String getSourceApplicatorLength()
	{
		Object objValue = getValue(0x300A,0x0296);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Sets Source Applicator Manufacturer.Uniquely identifies Source Source Applicator Manufacturer(300A,0298) in Channel Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param strSourceApplicatorManufacturer -String value of Source Applicator Manufacturer.
	 */
	public void setSourceApplicatorManufacturer(String strSourceApplicatorManufacturer)
	{
		/*Accept the SourceApplicatorManufacturer in String format of type LO.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x300A,0x0298, strSourceApplicatorManufacturer,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300A,0x0298,DicomConstants.DCM_DT_LO,strSourceApplicatorManufacturer);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Source Applicator Manufacturer.
	 * @return String - value of Source Applicator Manufacturer.
	 */
	public String getSourceApplicatorManufacturer()
	{
		Object objValue = getValue(0x300A,0x0298);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Sets Material ID.Uniquely identifies Material ID(300A,00E1) in Channel Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param strMaterialID String value of Material ID.
	 */
	public void setMaterialID(String strMaterialID)
	{
		/*Accept the MaterialID in String format of type SH.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)	
			objIDataElement = new ImplicitDE(0x300A,0x00E1, strMaterialID,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300A,0x00E1,DicomConstants.DCM_DT_SH,strMaterialID);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Material ID.
	 * @return String - value of Material ID.
	 */
	public String getMaterialID()
	{
		Object objValue = getValue(0x300A,0x00E1);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Sets Source Applicator Wall Nominal Thickness.Uniquely identifies Source Applicator Wall Nominal Thickness(300A,029C) in Channel Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param strSourceApplicatorWallNominalThickness String value of Source Applicator Wall Nominal Thickness.
	 */
	public void setSourceApplicatorWallNominalThickness(String strSourceApplicatorWallNominalThickness)
	{
		/*Accept the SourceApplicatorWallNominalThickness in String format of type DS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x300A,0x029C, strSourceApplicatorWallNominalThickness,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300A,0x029C,DicomConstants.DCM_DT_DS,strSourceApplicatorWallNominalThickness);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Source Applicator Wall Nominal Thickness.
	 * @return String - value of Source Applicator Wall Nominal Thickness.
	 */
	public String getSourceApplicatorWallNominalThickness()
	{
		Object objValue = getValue(0x300A,0x029C);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Sets Source Applicator Wall Nominal Transmission.Uniquely identifies Source
	 * Applicator Wall Nominal Transmission(300A,029E) in Channel Sequence (300A,0280)
	 * in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param strSourceApplicatorWallNominalTransmission String value of Source Applicator Wall Nominal Transmission.
	 */
	public void setSourceApplicatorWallNominalTransmission(String strSourceApplicatorWallNominalTransmission)
	{
		/*Accept the SourceApplicatorWallNominalTransmission in String format of type DS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x300A,0x029E, strSourceApplicatorWallNominalTransmission,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300A,0x029E,DicomConstants.DCM_DT_DS,strSourceApplicatorWallNominalTransmission);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Source Applicator Wall Nominal Transmission.
	 * @return String - value of Source Applicator Wall Nominal Transmission.
	 */
	public String getSourceApplicatorWallNominalTransmission()
	{
		Object objValue = getValue(0x300A,0x029E);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Sets Source Applicator Step Size.Uniquely identifies Source Applicator Step Size(300A,02A0) in Channel Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param strSourceApplicatorStepSize String value of Source Applicator Step Size.
	 */
	public void setSourceApplicatorStepSize(String strSourceApplicatorStepSize)
	{
		/*Accept the SourceApplicatorStepSize in String format of type DS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)	
			objIDataElement = new ImplicitDE(0x300A,0x02A0, strSourceApplicatorStepSize,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300A,0x02A0,DicomConstants.DCM_DT_DS,strSourceApplicatorStepSize);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Source Applicator Step Size.
	 * @return String - value of Source Applicator Step Size.
	 */
	public String getSourceApplicatorStepSize()
	{
		Object objValue = getValue(0x300A,0x02A0);
		if(objValue != null)
			return objValue.toString();
		return null;
	}

	/**
	 * Sets Referenced ROI Number.Uniquely identifies Referenced ROI Number(3006,0084) in Channel Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param strReferencedROINumber String value of Referenced ROI Number.
	 */
	public void setReferencedROINumber(String strReferencedROINumber)
	{
		/*Accept the ReferencedROINumber in String format of type IS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)	
			objIDataElement = new ImplicitDE(0x3006,0x0084, strReferencedROINumber,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x3006,0x0084,DicomConstants.DCM_DT_IS,strReferencedROINumber);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Referenced ROI Number.
	 * @return String - value of Referenced ROI Number.
	 */
	public String getReferencedROINumber()
	{
		Object objValue = getValue(0x3006,0x0084);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Sets Transfer Tube Number.Uniquely identifies Transfer Tube Number(300A,02A2) in Channel Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param strTransferTubeNumber String value of Transfer Tube Number.
	 */
	public void setTransferTubeNumber(String strTransferTubeNumber)
	{
		/*Accept the TransferTubeNumber in String format of type IS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)	
			objIDataElement = new ImplicitDE(0x300A,0x02A2,strTransferTubeNumber,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300A,0x02A2,DicomConstants.DCM_DT_IS,strTransferTubeNumber);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Transfer Tube Number.
	 * @return String - value of Transfer Tube Number.
	 */
	public String getTransferTubeNumber()
	{
		Object objValue = getValue(0x300A,0x02A2);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Sets Transfer Tube Length.Uniquely identifies Transfer Tube Length(300A,02A4) in Channel Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param strTransferTubeLength String value of Transfer Tube Length.
	 */
	public void setTransferTubeLength(String strTransferTubeLength)
	{
		/*Accept the TransferTubeLength in String format of type DS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)	
			objIDataElement = new ImplicitDE(0x300A,0x02A4,strTransferTubeLength,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300A,0x02A4,DicomConstants.DCM_DT_DS,strTransferTubeLength);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Transfer Tube Length.
	 * @return String - value of Transfer Tube Length.
	 */
	public String getTransferTubeLength()
	{
		Object objValue = getValue(0x300A,0x02A4);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Sets Referenced Source Number.Uniquely identifies Referenced Source Number(300C,000E) in Channel Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param strReferencedSourceNumber String value of Referenced Source Number.
	 */
	public void setReferencedSourceNumber(String strReferencedSourceNumber)
	{
		/*Accept the ReferencedSourceNumber in String format of type IS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x300C,0x000E,strReferencedSourceNumber,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300C,0x000E,DicomConstants.DCM_DT_IS,strReferencedSourceNumber);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Referenced Source Number.
	 * @return String - value of Referenced Source Number.
	 */
	public String getReferencedSourceNumber()
	{
		Object objValue = getValue(0x300C,0x000E);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Sets Number of Control Points.Uniquely identifies Number of Control Points(300A,0110) in Channel Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param strNumberofControlPoints String value of Number of Control Points.
	 */
	public void setNumberofControlPoints(String strNumberofControlPoints)
	{
		/*Accept the NumberofControlPoints in String format of type IS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x300A,0x0110,strNumberofControlPoints,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300A,0x0110,DicomConstants.DCM_DT_IS,strNumberofControlPoints);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Number of Control Points.
	 * @return String - value of Number of Control Points.
	 */
	public String getNumberofControlPoints()
	{
		Object objValue = getValue(0x300A,0x0110);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Sets Final Cumulative Time Weight.Uniquely identifies Final Cumulative Time Weight(300A,02C8) in Channel Sequence (300A,0280) in RT BRACHY APPLICATION SETUPS MODULE of RT Plan IOD.
	 * @param strFinalCumulativeTimeWeight String value of Final Cumulative Time Weight.
	 */
	public void setFinalCumulativeTimeWeight(String strFinalCumulativeTimeWeight)
	{
		/*Accept the FinalCumulativeTimeWeight in String format of type DS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;

		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)	
			objIDataElement = new ImplicitDE(0x300A,0x02C8,strFinalCumulativeTimeWeight,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x300A,0x02C8,DicomConstants.DCM_DT_DS,strFinalCumulativeTimeWeight);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Final Cumulative Time Weight.
	 * @return String - value of Final Cumulative Time Weight.
	 */
	public String getFinalCumulativeTimeWeight()
	{
		Object objValue = getValue(0x300A,0x02C8);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/**
	 * Retrieves pre-initialized object of Channel Shield Sequence.If the module contains the sequence object
	 * it returns the same otherwise it creates the sequence adds to the module with proper initialization
	 * and then returns the object of sequence
	 * @return ChannelShieldSequence - instance of Channel Shield Sequence. 
	 */
	public ChannelShieldSequence getChannelShieldSequence()
	{
		ChannelShieldSequence objChannelShieldSequence = null;
		IDataElement objIDataElement =  getDataForTag(0x300A,0x02B0);
		if(objIDataElement != null)
		{
			IDicomValue objIDicomValue = objIDataElement.getDicomValue();
			if(objIDicomValue != null)
				objChannelShieldSequence = (ChannelShieldSequence)objIDicomValue;
		}
		else
		{
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			int iVRTransferSyntax = objITransferSyntax.getVRTransferSyntax();
			objIDataElement = null;
			objChannelShieldSequence = (ChannelShieldSequence)objDicomV3Factory.createSequence(0x300A,0x02B0, objITransferSyntax, objIDictionaryReader);

			if(iVRTransferSyntax == DicomConstants.DCM_VR_IMPLICIT)
				objIDataElement = new ImplicitDE(0x300A,0x02B0, objChannelShieldSequence.getValue(),objIDictionaryReader);
			else
				objIDataElement = new ExplicitDE(0x300A,0x02B0, DicomConstants.DCM_DT_SQ, objChannelShieldSequence.getValue());
			objIDataElement.setTransferSyntax(objITransferSyntax);
			if(objIDataElement != null)
				addDataElement(objIDataElement);
		}
		return objChannelShieldSequence;
	}


	/**
	 * Retrieves pre-initialized object of Brachy Control Point Sequence.If the module contains the sequence object
	 * it returns the same otherwise it creates the sequence adds to the module with proper initialization
	 * and then returns the object of sequence
	 * @return BrachyControlPointSequence - instance of Brachy Control Point Sequence. 
	 */
	public BrachyControlPointSequence getBrachyControlPointSequence()
	{
		BrachyControlPointSequence objBrachyControlPointSequence = null;
		IDataElement objIDataElement =  getDataForTag(0x300A,0x02D0);
		if(objIDataElement != null)
		{
			IDicomValue objIDicomValue = objIDataElement.getDicomValue();
			if(objIDicomValue != null)
				objBrachyControlPointSequence = (BrachyControlPointSequence)objIDicomValue;
		}
		else
		{
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			int iVRTransferSyntax = objITransferSyntax.getVRTransferSyntax();
			objIDataElement = null;
			objBrachyControlPointSequence = (BrachyControlPointSequence)objDicomV3Factory.createSequence(0x300A,0x02D0, objITransferSyntax, objIDictionaryReader);

			if(iVRTransferSyntax == DicomConstants.DCM_VR_IMPLICIT)
				objIDataElement = new ImplicitDE(0x300A,0x02D0, objBrachyControlPointSequence.getValue(),objIDictionaryReader);
			else
				objIDataElement = new ExplicitDE(0x300A,0x02D0, DicomConstants.DCM_DT_SQ, objBrachyControlPointSequence.getValue());
			objIDataElement.setTransferSyntax(objITransferSyntax);
			if(objIDataElement != null)
				addDataElement(objIDataElement);
		}
		return objBrachyControlPointSequence;
	}
}
