/*******************************************************************************
 * Copyright 2014 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 in.cdac.medinfo.csnotk.csnolib.commons;

import java.io.Serializable;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
 * If component is,<br>
 * CONCEPT-refers to Concept class<br>
 * DESCRIPTION- refers to Description class<br>
 * RELATIONSHIP- refers to Relationship class<br>
 */
public enum EnumComponent implements Serializable
{
	CONCEPT("Concept"),
	DESCRIPTION("Description"),
	RELATIONSHIP("Relationship"),
	CONCRETERELATIONSHIP("ConcreteRelationship"),
	SIMPLEMAP("SimpleMapRefset");

	private static final Map<String, EnumComponent> lookup = new ConcurrentHashMap<String, EnumComponent>();
	static 
	{
		for (EnumComponent d : EnumComponent.values())
			lookup.put(d.getValue(), d);
	}

	private String value;

	private EnumComponent( 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 EnumComponent} enumeration for given string value
	 */
	public static EnumComponent getEnum(String val) 
	{
		return lookup.get(val);
	}
}
