/**
 * 
 */
package in.cdac.medinfo.csnotk.csnolib.disb.common;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author root
 *
 */
public enum EnumSemantic {
	MEDICINE("medicine"),
	GENERIC("generic"),
	SUBSTANCE("substance");
	
	
	private String value;
	
	private static final Map<String, EnumSemantic> lookup = new ConcurrentHashMap<String, EnumSemantic>();
    static 
    {
        for (EnumSemantic d : EnumSemantic.values())
            lookup.put(d.getValue(), d);
    }
	
	private EnumSemantic(String value) {
		this.value = value;
	}
	
	/**
	 * Returns the value associated with enumeration.
	 * @return {@link String} value for enumeration.
	 */
	public String getValue() {
		return value;
	}
	
	/**
	 * Sets value for enumeration.
	 * @param value {@link String} value to be set.
	 */
	public void setValue(String value) {
		this.value = value;
	}
	 
	/**
	 * Returns enumeration for given string value.
	 * @param val {@link String} value for which enumeration is to be retrieve.
	 * @return {@link EnumSemantic} enumeration for given string value
	 */
	public static EnumSemantic getEnum(String val) 
	{
		return lookup.get(val);
	}

}
