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

import demo.catalog.democatalog.Boiler;
import demo.catalog.democatalog.CombinedHeatPower;
import demo.catalog.democatalog.DemoCatalogPackage;
import demo.catalog.democatalog.EnergyComponentsCatalog;
import demo.catalog.democatalog.Inverter;
import demo.catalog.democatalog.Manufacturer;
import demo.catalog.democatalog.SolarPanel;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Energy Components Catalog</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 *   <li>{@link demo.catalog.democatalog.impl.EnergyComponentsCatalogImpl#getAuthor <em>Author</em>}</li>
 *   <li>{@link demo.catalog.democatalog.impl.EnergyComponentsCatalogImpl#getBoilers <em>Boilers</em>}</li>
 *   <li>{@link demo.catalog.democatalog.impl.EnergyComponentsCatalogImpl#getChps <em>Chps</em>}</li>
 *   <li>{@link demo.catalog.democatalog.impl.EnergyComponentsCatalogImpl#getSolarpanels <em>Solarpanels</em>}</li>
 *   <li>{@link demo.catalog.democatalog.impl.EnergyComponentsCatalogImpl#getInverters <em>Inverters</em>}</li>
 *   <li>{@link demo.catalog.democatalog.impl.EnergyComponentsCatalogImpl#getManufacturers <em>Manufacturers</em>}</li>
 * </ul>
 *
 * @generated
 */
public class EnergyComponentsCatalogImpl extends MinimalEObjectImpl.Container implements EnergyComponentsCatalog {
	/**
	 * The default value of the '{@link #getAuthor() <em>Author</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAuthor()
	 * @generated
	 * @ordered
	 */
	protected static final String AUTHOR_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getAuthor() <em>Author</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAuthor()
	 * @generated
	 * @ordered
	 */
	protected String author = AUTHOR_EDEFAULT;

	/**
	 * The cached value of the '{@link #getBoilers() <em>Boilers</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBoilers()
	 * @generated
	 * @ordered
	 */
	protected EList<Boiler> boilers;

	/**
	 * The cached value of the '{@link #getChps() <em>Chps</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getChps()
	 * @generated
	 * @ordered
	 */
	protected EList<CombinedHeatPower> chps;

	/**
	 * The cached value of the '{@link #getSolarpanels() <em>Solarpanels</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSolarpanels()
	 * @generated
	 * @ordered
	 */
	protected EList<SolarPanel> solarpanels;

	/**
	 * The cached value of the '{@link #getInverters() <em>Inverters</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getInverters()
	 * @generated
	 * @ordered
	 */
	protected EList<Inverter> inverters;

	/**
	 * The cached value of the '{@link #getManufacturers() <em>Manufacturers</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getManufacturers()
	 * @generated
	 * @ordered
	 */
	protected EList<Manufacturer> manufacturers;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EnergyComponentsCatalogImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return DemoCatalogPackage.Literals.ENERGY_COMPONENTS_CATALOG;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getAuthor() {
		return author;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setAuthor(String newAuthor) {
		String oldAuthor = author;
		author = newAuthor;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__AUTHOR,
					oldAuthor, author));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Boiler> getBoilers() {
		if (boilers == null) {
			boilers = new EObjectContainmentEList<Boiler>(Boiler.class, this,
					DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__BOILERS);
		}
		return boilers;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<CombinedHeatPower> getChps() {
		if (chps == null) {
			chps = new EObjectContainmentEList<CombinedHeatPower>(CombinedHeatPower.class, this,
					DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__CHPS);
		}
		return chps;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<SolarPanel> getSolarpanels() {
		if (solarpanels == null) {
			solarpanels = new EObjectContainmentEList<SolarPanel>(SolarPanel.class, this,
					DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__SOLARPANELS);
		}
		return solarpanels;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Inverter> getInverters() {
		if (inverters == null) {
			inverters = new EObjectContainmentEList<Inverter>(Inverter.class, this,
					DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__INVERTERS);
		}
		return inverters;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Manufacturer> getManufacturers() {
		if (manufacturers == null) {
			manufacturers = new EObjectContainmentEList<Manufacturer>(Manufacturer.class, this,
					DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__MANUFACTURERS);
		}
		return manufacturers;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__BOILERS:
			return ((InternalEList<?>) getBoilers()).basicRemove(otherEnd, msgs);
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__CHPS:
			return ((InternalEList<?>) getChps()).basicRemove(otherEnd, msgs);
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__SOLARPANELS:
			return ((InternalEList<?>) getSolarpanels()).basicRemove(otherEnd, msgs);
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__INVERTERS:
			return ((InternalEList<?>) getInverters()).basicRemove(otherEnd, msgs);
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__MANUFACTURERS:
			return ((InternalEList<?>) getManufacturers()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__AUTHOR:
			return getAuthor();
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__BOILERS:
			return getBoilers();
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__CHPS:
			return getChps();
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__SOLARPANELS:
			return getSolarpanels();
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__INVERTERS:
			return getInverters();
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__MANUFACTURERS:
			return getManufacturers();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__AUTHOR:
			setAuthor((String) newValue);
			return;
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__BOILERS:
			getBoilers().clear();
			getBoilers().addAll((Collection<? extends Boiler>) newValue);
			return;
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__CHPS:
			getChps().clear();
			getChps().addAll((Collection<? extends CombinedHeatPower>) newValue);
			return;
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__SOLARPANELS:
			getSolarpanels().clear();
			getSolarpanels().addAll((Collection<? extends SolarPanel>) newValue);
			return;
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__INVERTERS:
			getInverters().clear();
			getInverters().addAll((Collection<? extends Inverter>) newValue);
			return;
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__MANUFACTURERS:
			getManufacturers().clear();
			getManufacturers().addAll((Collection<? extends Manufacturer>) newValue);
			return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__AUTHOR:
			setAuthor(AUTHOR_EDEFAULT);
			return;
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__BOILERS:
			getBoilers().clear();
			return;
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__CHPS:
			getChps().clear();
			return;
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__SOLARPANELS:
			getSolarpanels().clear();
			return;
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__INVERTERS:
			getInverters().clear();
			return;
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__MANUFACTURERS:
			getManufacturers().clear();
			return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__AUTHOR:
			return AUTHOR_EDEFAULT == null ? author != null : !AUTHOR_EDEFAULT.equals(author);
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__BOILERS:
			return boilers != null && !boilers.isEmpty();
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__CHPS:
			return chps != null && !chps.isEmpty();
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__SOLARPANELS:
			return solarpanels != null && !solarpanels.isEmpty();
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__INVERTERS:
			return inverters != null && !inverters.isEmpty();
		case DemoCatalogPackage.ENERGY_COMPONENTS_CATALOG__MANUFACTURERS:
			return manufacturers != null && !manufacturers.isEmpty();
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy())
			return super.toString();

		StringBuilder result = new StringBuilder(super.toString());
		result.append(" (author: ");
		result.append(author);
		result.append(')');
		return result.toString();
	}

} //EnergyComponentsCatalogImpl
