/**
 */
package demo.catalog.democatalog.impl;

import demo.catalog.democatalog.*;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EFactoryImpl;

import org.eclipse.emf.ecore.plugin.EcorePlugin;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class DemoCatalogFactoryImpl extends EFactoryImpl implements DemoCatalogFactory {
	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static DemoCatalogFactory init() {
		try {
			DemoCatalogFactory theDemoCatalogFactory = (DemoCatalogFactory) EPackage.Registry.INSTANCE
					.getEFactory(DemoCatalogPackage.eNS_URI);
			if (theDemoCatalogFactory != null) {
				return theDemoCatalogFactory;
			}
		} catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new DemoCatalogFactoryImpl();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DemoCatalogFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG:
			return createEnergyComponentsCatalog();
		case DemoCatalogPackage.BOILER:
			return createBoiler();
		case DemoCatalogPackage.COMBINED_HEAT_POWER:
			return createCombinedHeatPower();
		case DemoCatalogPackage.SOLAR_PANEL:
			return createSolarPanel();
		case DemoCatalogPackage.INVERTER:
			return createInverter();
		case DemoCatalogPackage.MANUFACTURER:
			return createManufacturer();
		default:
			throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
		case DemoCatalogPackage.BOILER_TYPE:
			return createBoilerTypeFromString(eDataType, initialValue);
		default:
			throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
		case DemoCatalogPackage.BOILER_TYPE:
			return convertBoilerTypeToString(eDataType, instanceValue);
		default:
			throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EnergyComponentsCatalog createEnergyComponentsCatalog() {
		EnergyComponentsCatalogImpl energyComponentsCatalog = new EnergyComponentsCatalogImpl();
		return energyComponentsCatalog;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Boiler createBoiler() {
		BoilerImpl boiler = new BoilerImpl();
		return boiler;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CombinedHeatPower createCombinedHeatPower() {
		CombinedHeatPowerImpl combinedHeatPower = new CombinedHeatPowerImpl();
		return combinedHeatPower;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SolarPanel createSolarPanel() {
		SolarPanelImpl solarPanel = new SolarPanelImpl();
		return solarPanel;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Inverter createInverter() {
		InverterImpl inverter = new InverterImpl();
		return inverter;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Manufacturer createManufacturer() {
		ManufacturerImpl manufacturer = new ManufacturerImpl();
		return manufacturer;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BoilerType createBoilerTypeFromString(EDataType eDataType, String initialValue) {
		BoilerType result = BoilerType.get(initialValue);
		if (result == null)
			throw new IllegalArgumentException(
					"The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertBoilerTypeToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DemoCatalogPackage getDemoCatalogPackage() {
		return (DemoCatalogPackage) getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	@Deprecated
	public static DemoCatalogPackage getPackage() {
		return DemoCatalogPackage.eINSTANCE;
	}

} //DemoCatalogFactoryImpl
