/*******************************************************************************
 *  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.IDataSet;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDicomValue;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDictionaryReader;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IItem;
import cdac.medinfo.sdk.dcm30_04.commoninterface.ITag;
import cdac.medinfo.sdk.dcm30_04.exceptions.ConditionFailedException;
import cdac.medinfo.sdk.dcm30_04.exceptions.InvalidMacroException;
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;

import cdac.medinfo.sdk.dcm30_04.utils.ISingleCollection;
/**
 * This class contains Macro that specifies the Attributes that identify the value(s) for a Data Element Tag that is used as a Selector Attribute 
 * (0072,0026)in the Image Set Selector Sequence (0072,0022) or Filter Operations Sequence (0072,0400).
 */
public class HangingProtocolSelectorAttributeValueMacro extends Macro   
{
	


	private static final long serialVersionUID = 1L;

	/**
	 * This constructor constructs a Macro with specified DataSet.
	 * @param objDataSet Collection of DataElements 
	 */
	public HangingProtocolSelectorAttributeValueMacro(IDataSet objDataSet)
	{
		super(objDataSet);
	}

	/**
	 * This constructor constructs a Macro with specified DataSet and DictionaryReader
	 * @param objDataSet specifies the DataSet
	 * @param objDictionaryReader specifies the DICOM Dictionary reader to be used 
	 */
	public HangingProtocolSelectorAttributeValueMacro(IDataSet objDataSet,IDictionaryReader objDictionaryReader)
	{
		super(objDataSet,objDictionaryReader);
	}

	/**
	 * This constructor constructs a Macro with the specified Item
	 * @param objItem specifies instance of Item class
	 */
	public HangingProtocolSelectorAttributeValueMacro(IItem objItem)
	{
		super(objItem);
	}

	/**
	 * This constructor constructs a Macro with the specified Item and DictionaryReader
	 * @param objItem specifies instance of Item class
	 * @param objDictionaryReader specifies the DICOM Dictionary reader to be used 
	 */
	public HangingProtocolSelectorAttributeValueMacro(IItem objItem,IDictionaryReader objDictionaryReader)
	{
		super(objItem, objDictionaryReader);
	}

	/**
	 * Validates all the attributes in HangingProtocolSelectorAttributeValueMacro
	 * @return boolean - Success -true, Failure -false.
	 * @throws InvalidMacroException throws InvalidMacroException If Mandatory or Conditional element fails.
	 */
	public boolean validate() throws InvalidMacroException
	{
		if(iMacroLevel == DicomConstants.DCM_MODULE_LEVEL_MACRO)
			return validate(objIDataSet);
		else if(iMacroLevel == DicomConstants.DCM_ITEM_LEVEL_MACRO)
			return validate(objIItem);
		return false;
	}

	/**
	 * Validates all the attributes in HangingProtocolSelectorAttributeValueMacro that are present in the DataSet
	 * @param objIDataSet collection of DataElements
	 * @return boolean - Success -true, Failure - false
	 * @throws InvalidMacroException throws InvalidMacroException If Mandatory or Conditional element fails.
	 */
	public static boolean validate(IDataSet objIDataSet) throws InvalidMacroException
	{
		try
		{ 

			//validate condition here
		}
		catch( ConditionFailedException ce)
		{
			if(DicomConfig.createInstance().isLoggingOn())
			{
				DicomLogger.getLogger().log(ce.getMessage());
			}
			throw new InvalidMacroException( HangingProtocolSelectorAttributeValueMacro.class.getSimpleName() ,ce); 
		}
		catch( MandatoryMissingException me)
		{
			if(DicomConfig.createInstance().isLoggingOn())
			{
				DicomLogger.getLogger().log(me.getMessage());
			}
			throw new InvalidMacroException(HangingProtocolSelectorAttributeValueMacro.class.getSimpleName() ,me);
		}
		return true;
	}

	/**
	 * Validates all the attributes in HangingProtocolSelectorAttributeValueMacro that are present in the DataSet
	 * @param objIItem collection of DataElements in a sequence
	 * @return boolean - Success -true, Failure - false
	 * @throws InvalidMacroException throws InvalidMacroException If Mandatory or Conditional element fails.
	 */
	public static boolean validate(IItem objIItem) throws InvalidMacroException
	{
		try
		{  
			//validate condition here
		}
		catch( ConditionFailedException ce)
		{
			if(DicomConfig.createInstance().isLoggingOn())
			{
				DicomLogger.getLogger().log(ce.getMessage());
			}
			throw new InvalidMacroException(HangingProtocolSelectorAttributeValueMacro.class.getSimpleName(),ce); 
		}
		catch( MandatoryMissingException me)
		{
			if(DicomConfig.createInstance().isLoggingOn())
			{
				DicomLogger.getLogger().log(me.getMessage());
			}
			throw new InvalidMacroException(HangingProtocolSelectorAttributeValueMacro.class.getSimpleName(),me);
		}
		return true;
	}
	
	/**
	 * Sets a list of Selector AT Value.
	 * @param objSingleCollection collection of Selector AT Value.
	 */
	public void setSelectorATValue(ISingleCollection<ITag> objSingleCollection)
	{
		/*Accept the Selector AT Value in String format of type AT.
		 * 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(0x0072, 0x0060, objSingleCollection, objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0072, 0x0060,DicomConstants.DCM_DT_AT, objSingleCollection);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves a list of Selector AT Value.
	 * @return ISingleCollection<ITag> - collection of Selector AT Value.
	 */
	@SuppressWarnings("unchecked")
	public ISingleCollection<ITag> getSelectorATValue()
	{
		Object objValue = getValue(0x0072, 0x0060);
		if(objValue != null)
			return (ISingleCollection<ITag>)objValue;
		return null;
	}
	
	/**
	 * Sets the Selector CS Value
	 * @param strSelectorCSValue Specifies Selector CS Value
	 */
	public void setSelectorCSValue(String strSelectorCSValue)
	{
		/*Accept the Selector CS Value 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(0x0072, 0x0062, strSelectorCSValue, objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0072, 0x0062,DicomConstants.DCM_DT_CS, strSelectorCSValue);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Selector CS Value
	 * @return String - Selector CS Value
	 */
	public String getSelectorCSValue()
	{
		Object objValue = getValue(0x0072, 0x0062);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets Selector IS Value.
	 * @param strArrSelectorISValue String value of Selector IS Value.
	 */
	public void setSelectorISValue (String[] strArrSelectorISValue )
	{
		/*Accept the Selector IS Value  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(0x0072,0x0064, strArrSelectorISValue , objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0072,0x0064,DicomConstants.DCM_DT_IS, strArrSelectorISValue );

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Selector IS Value.
	 * @return String - value of Selector IS Value.
	 */
	public String[] getSelectorISValue()
	{
		Object objValue = getValue(0x0072,0x0064);
		if(objValue != null)
			return (String[])objValue;
		return null;
	}
	
	/**
	 * Sets Selector LO Value.
	 * @param strArrSelectorLOValue String value of Selector LO Value.
	 */
	public void setSelectorLOValue(String[] strArrSelectorLOValue)
	{
		/* Accept the Selector LO Value 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(0x0072,0x0066, strArrSelectorLOValue, objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0072,0x0066,DicomConstants.DCM_DT_LO, strArrSelectorLOValue);

		addDataElement(objIDataElement);
	}

	/**
	 * Return Selector LO Value.
	 * @return String - value of Selector LO Value.
	 */
	public String[] getSelectorLOValue()
	{
		Object objValue = getValue(0x0072,0x0066);
		if(objValue != null)
			return (String[])objValue;
		return null;
	}
	
	/**
	 * Sets Selector LT Value.
	 * @param strSelectorLTValue String value of Selector LT Value.
	 */
	public void setSelectorLTValue(String[] strSelectorLTValue)
	{
		/* Accept Selector LT Value of type LT.
		 * 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(0x0072,0x0068, strSelectorLTValue, objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0072,0x0068,DicomConstants.DCM_DT_LT, strSelectorLTValue);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves Selector LT Value.
	 * @return String - value of Selector LT Value.
	 */
	public String[] getSelectorLTValue()
	{
		Object objValue = getValue(0x0072,0x0068);
		if(objValue != null)
			return (String[])objValue;
		return null;
	}
	
	/**
	 * Sets Selector PN Value.
	 * @param strArrSelectorPNValue String Selector PN Value.
	 */	
	public void setSelectorPNValue(String[] strArrSelectorPNValue)
	{
		/*Accept Selector PN Value in String format of type PN.
		 * Read the Transfer Syntax and check to create ImplicitDE or ExplicitDE .
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Hash Map
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0072,0x006A,strArrSelectorPNValue,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0072,0x006A, DicomConstants.DCM_DT_PN,strArrSelectorPNValue);
		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves Selector PN Value.
	 * @return String - Selector PN Value.
	 */
	public String[] getSelectorPNValue()
	{
		Object objValue = getValue(0x0072,0x006A);
		if(objValue != null)
			return (String[])objValue;
		return null;
	}
	
	/**
	 * Sets Selector SH Value.
	 * @param strArrSelectorSHValue
	 */
	public void setSelectorSHValue(String[] strArrSelectorSHValue)
	{
		/*Accept the Selector SH Value 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(0x0072, 0x006C, strArrSelectorSHValue,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0072, 0x006C,DicomConstants.DCM_DT_SH, strArrSelectorSHValue);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves Selector SH Value.
	 * @return String - value of Selector SH Value.
	 */
	public String[] getSelectorSHValue()
	{
		Object objValue = getValue(0x0072, 0x006C);
		if(objValue != null)
			return (String[])objValue;
		return null;
	}
	
	/**
	 * Sets the Selector ST Value.
	 * @param strSelectorSTValue - String Selector ST Value.
	 */
	public void setSelectorSTValue(String strSelectorSTValue)
	{
		/*Accept the Selector ST Value in String format of type ST.
		 * 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(0x0072, 0x006E, strSelectorSTValue, objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0072, 0x006E,DicomConstants.DCM_DT_ST, strSelectorSTValue);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves the Selector ST Value.
	 * @return String value of Selector ST Value.
	 */
	public String getSelectorSTValue()
	{
		Object objValue = getValue(0x0072, 0x006E);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets the Selector UT Value.
	 * @param strSelectorUTValue String Selector UT Value.
	 */
	public void setSelectorUTValue(String strSelectorUTValue)
	{
		/* Accept the Selector UT Value in String format of type UT.
		 * 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(0x0072, 0x0070, strSelectorUTValue,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0072, 0x0070,DicomConstants.DCM_DT_UT, strSelectorUTValue);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves the value of Selector UT Value.
	 * @return String - value of the Selector UT Value.
	 */
	public String getSelectorUTValue()
	{
		Object objValue = getValue(0x0072, 0x0070);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets Selector DS Value.
	 * @param strArrSelectorDSValue String value of Selector DS Value.
	 */
	public void setSelectorDSValue(String[] strArrSelectorDSValue)
	{
		/*Accept the Selector DS Value 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(0x0072,0x0072, strArrSelectorDSValue, objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0072,0x0072,DicomConstants.DCM_DT_DS, strArrSelectorDSValue);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Selector DS Value.
	 * @return String - value of Selector DS Value.
	 */
	public String[] getSelectorDSValue()
	{
		Object objValue = getValue(0x0072,0x0072);
		if(objValue != null)
			return (String[])objValue;
		return null;
	}
	
	/**
	 * Sets the Selector FD Value.
	 * @param dblArrSelectorFDValue Double value of Selector FD Value
	 */
	public void setSelectorFDValue(double[] dblArrSelectorFDValue)
	{
		/*Accept the Selector FD Value in double format of type FD.
		 * 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(0x0072,0x0074, dblArrSelectorFDValue, objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0072,0x0074,DicomConstants.DCM_DT_FD, dblArrSelectorFDValue);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves the Selector FD Value.
	 * @return double - double value of Selector FD Value
	 */
	public double[] getSelectorFDValue()
	{
		Object objValue = getValue(0x0072,0x0074);
		if(objValue != null)
			return (double[])objValue;
		return null;
	}
	
	/**
	 * Sets a Selector FL Value.
	 * @param fArrSelectorFLValue Selector FL Value
	 */
	public void setSelectorFLValue(float[] fArrSelectorFLValue)
	{
		/* Accept the Selector FL Value in short format of type FL.
		 * 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(0x0072,0x0076, fArrSelectorFLValue, objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0072,0x0076,DicomConstants.DCM_DT_FL, fArrSelectorFLValue);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves Selector FL Value.
	 * @return float[] - Float Selector FL Value.
	 */
	public float[] getSelectorFLValue()
	{
		Object objValue = getValue(0x0072,0x0076);
		if(objValue != null)
			return (float[])objValue;
		return null;
	}
	
	/**
	 * Sets Selector UL Value.
	 * @param lArrSelectorULValue Long value of Selector UL Value
	 */
	public void setSelectorULValue(int[] lArrSelectorULValue)
	{
		/* Accept the Referenced Content Item Identifier in long format of type UL
		 * 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(0x0072,0x0078, lArrSelectorULValue, objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0072,0x0078,DicomConstants.DCM_DT_UL, lArrSelectorULValue);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves Selector UL Value.
	 * @return long[] - long value of Selector UL Value.
	 */
	public int[] getSelectorULValue()
	{
		Object objValue = getValue(0x0072,0x0078);
		if(objValue != null)
			return (int[])objValue;
		return null;
	}
	
	/**
	 * Sets Selector US Value
	 * @param arrShSelectorUSValue
	 */
	public void setSelectorUSValue(short[] arrShSelectorUSValue)
	{
		/*Accept the Selector US Value in Array of short format of type US.
		 * 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(0x0072, 0x007A, arrShSelectorUSValue, objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0072, 0x007A,DicomConstants.DCM_DT_US, arrShSelectorUSValue);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves Selector US Value.
	 * @return short Array - Selector US Value.
	 */
	public short[] getSelectorUSValue()
	{
		Object objValue = getValue(0x0072, 0x007A);
		if(objValue != null)
			return (short[])objValue;
		return null;
	}
	
	/**
	 * Sets Selector SL Value.
	 * @param lArrSelectorSLValue Long array of Selector SL Value.
	 */
	public void setSelectorSLValue(Long[] lArrSelectorSLValue)
	{
		/* 
		 * Accept the Selector SL Value in String format of type SL.
		 * 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(0x0072,0x007C, lArrSelectorSLValue, objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0072,0x007C,DicomConstants.DCM_DT_SL, lArrSelectorSLValue);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves the Selector SL Value.
	 * @return Long[] - Long array of Selector SL Value.
	 */
	public Long[] getSelectorSLValue()
	{
		Object objValue = getValue(0x0072,0x007C);
		if(objValue != null)
			return (Long[])objValue;
		return null;
	}
	
	/**
	 * Sets Selector SS Value.
	 * @param shArrSelectorSSValue short array of Selector SS Value. 
	 */
	public void setSelectorSSValue(short[] shArrSelectorSSValue)
	{
		/* Accept the Selector SS Value in short Array format of type US or SS.
		 * 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(0x0072, 0x007E, shArrSelectorSSValue,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0072, 0x007E,DicomConstants.DCM_DT_SS, shArrSelectorSSValue);
		addDataElement(objIDataElement);
	}
	/**
	 * Returns the Selector SS Value.
	 * @return short[] - short array of Selector SS Value.
	 */
	public short[] getSelectorSSValue()
	{
		Object objValue = getValue(0x0072, 0x007E);
		if(objValue != null)
			return (short[])objValue;
		return null;
	}

	/**
	 * Retrieves pre-initialized object of Selector Code Sequence Value.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 SelectorCodeSequenceValue - instance of SelectorCodeSequenceValue. 
	 */
	public SelectorCodeSequenceValue getSelectorCodeSequenceValue()
	{
		SelectorCodeSequenceValue objSelectorCodeSequenceValue = null;
		IDataElement objIDataElement =  getDataElement(0x0072, 0x0080);
		if(objIDataElement != null)
		{
			IDicomValue objIDicomValue = objIDataElement.getDicomValue();
			if(objIDicomValue != null)
				objSelectorCodeSequenceValue = (SelectorCodeSequenceValue)objIDicomValue;
		}
		else
		{
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			int iVRTransferSyntax = objITransferSyntax.getVRTransferSyntax();
			objIDataElement = null;
			objSelectorCodeSequenceValue = (SelectorCodeSequenceValue)objDicomV3Factory.createSequence(0x0072, 0x0080, objITransferSyntax, objIDictionaryReader);

			if(iVRTransferSyntax == DicomConstants.DCM_VR_IMPLICIT)
				objIDataElement = new ImplicitDE(0x0072, 0x0080, objSelectorCodeSequenceValue.getValue(),objIDictionaryReader);
			else
				objIDataElement = new ExplicitDE(0x0072, 0x0080, DicomConstants.DCM_DT_SQ, objSelectorCodeSequenceValue.getValue());
			objIDataElement.setTransferSyntax(objITransferSyntax);
			if(objIDataElement != null)
				addDataElement(objIDataElement);
		}
		return objSelectorCodeSequenceValue;
	}
	
	/**
	 * Sets Selector UI Value.
	 * @param strArrSelectorUIValue String array of Selector UI Value.
	 */
	public void setSelectorUIValue(String[] strArrSelectorUIValue)
	{
		/* Accept the Selector UI Value of type UI.
		 * 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(0x0072,0x007F, strArrSelectorUIValue, objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0072,0x007F,DicomConstants.DCM_DT_UI, strArrSelectorUIValue);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves  Selector UI Value.
	 * @return String - value of  Selector UI Value
	 */
	public String[] getSelectorUIValue()
	{
		Object objValue = getValue(0x0072,0x007F);
		if(objValue != null)
			return (String[])objValue;
		return null;
	}
}
