package in.cdac.medinfo.csnotk.csnolib.commons;

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

/**
 * 	If EnumDirection value is,<br>
 *  	SOURCE - refers to Parents direction.<br>
 * 		DESTINATION - refers to Children direction.<br>
 * 		
 */
public enum EnumDirection implements Serializable {
	

	SOURCE("source"),
	DESTINATION("destination");
	
	private static final Map<String, EnumDirection> lookup = new ConcurrentHashMap<String, EnumDirection>();
    static 
    {
        for (EnumDirection d : EnumDirection.values())
            lookup.put(d.getValue(), d);
    }
    
private String value;
	
	private EnumDirection( 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 EnumDirection} enumeration for given string value
	 */
	public static EnumDirection getEnum(String val) 
	{
		return lookup.get(val);
	}	
	    
}
