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

import demo.catalog.democatalog.DemoCatalogPackage;
import demo.catalog.democatalog.EnergyComponent;
import demo.catalog.democatalog.Manufacturer;

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

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;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Energy Component</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 *   <li>{@link demo.catalog.democatalog.impl.EnergyComponentImpl#getModelName <em>Model Name</em>}</li>
 *   <li>{@link demo.catalog.democatalog.impl.EnergyComponentImpl#getRevisionYear <em>Revision Year</em>}</li>
 *   <li>{@link demo.catalog.democatalog.impl.EnergyComponentImpl#getProducedBy <em>Produced By</em>}</li>
 * </ul>
 *
 * @generated
 */
public abstract class EnergyComponentImpl extends MinimalEObjectImpl.Container implements EnergyComponent {
	/**
	 * The default value of the '{@link #getModelName() <em>Model Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getModelName()
	 * @generated
	 * @ordered
	 */
	protected static final String MODEL_NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getModelName() <em>Model Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getModelName()
	 * @generated
	 * @ordered
	 */
	protected String modelName = MODEL_NAME_EDEFAULT;

	/**
	 * The default value of the '{@link #getRevisionYear() <em>Revision Year</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRevisionYear()
	 * @generated
	 * @ordered
	 */
	protected static final int REVISION_YEAR_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getRevisionYear() <em>Revision Year</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRevisionYear()
	 * @generated
	 * @ordered
	 */
	protected int revisionYear = REVISION_YEAR_EDEFAULT;

	/**
	 * The cached value of the '{@link #getProducedBy() <em>Produced By</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getProducedBy()
	 * @generated
	 * @ordered
	 */
	protected Manufacturer producedBy;

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

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

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

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setModelName(String newModelName) {
		String oldModelName = modelName;
		modelName = newModelName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, DemoCatalogPackage.ENERGY_COMPONENT__MODEL_NAME,
					oldModelName, modelName));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getRevisionYear() {
		return revisionYear;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRevisionYear(int newRevisionYear) {
		int oldRevisionYear = revisionYear;
		revisionYear = newRevisionYear;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, DemoCatalogPackage.ENERGY_COMPONENT__REVISION_YEAR,
					oldRevisionYear, revisionYear));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Manufacturer getProducedBy() {
		if (producedBy != null && producedBy.eIsProxy()) {
			InternalEObject oldProducedBy = (InternalEObject) producedBy;
			producedBy = (Manufacturer) eResolveProxy(oldProducedBy);
			if (producedBy != oldProducedBy) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE,
							DemoCatalogPackage.ENERGY_COMPONENT__PRODUCED_BY, oldProducedBy, producedBy));
			}
		}
		return producedBy;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Manufacturer basicGetProducedBy() {
		return producedBy;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setProducedBy(Manufacturer newProducedBy) {
		Manufacturer oldProducedBy = producedBy;
		producedBy = newProducedBy;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, DemoCatalogPackage.ENERGY_COMPONENT__PRODUCED_BY,
					oldProducedBy, producedBy));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
		case DemoCatalogPackage.ENERGY_COMPONENT__MODEL_NAME:
			return getModelName();
		case DemoCatalogPackage.ENERGY_COMPONENT__REVISION_YEAR:
			return getRevisionYear();
		case DemoCatalogPackage.ENERGY_COMPONENT__PRODUCED_BY:
			if (resolve)
				return getProducedBy();
			return basicGetProducedBy();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
		case DemoCatalogPackage.ENERGY_COMPONENT__MODEL_NAME:
			setModelName((String) newValue);
			return;
		case DemoCatalogPackage.ENERGY_COMPONENT__REVISION_YEAR:
			setRevisionYear((Integer) newValue);
			return;
		case DemoCatalogPackage.ENERGY_COMPONENT__PRODUCED_BY:
			setProducedBy((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_COMPONENT__MODEL_NAME:
			setModelName(MODEL_NAME_EDEFAULT);
			return;
		case DemoCatalogPackage.ENERGY_COMPONENT__REVISION_YEAR:
			setRevisionYear(REVISION_YEAR_EDEFAULT);
			return;
		case DemoCatalogPackage.ENERGY_COMPONENT__PRODUCED_BY:
			setProducedBy((Manufacturer) null);
			return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
		case DemoCatalogPackage.ENERGY_COMPONENT__MODEL_NAME:
			return MODEL_NAME_EDEFAULT == null ? modelName != null : !MODEL_NAME_EDEFAULT.equals(modelName);
		case DemoCatalogPackage.ENERGY_COMPONENT__REVISION_YEAR:
			return revisionYear != REVISION_YEAR_EDEFAULT;
		case DemoCatalogPackage.ENERGY_COMPONENT__PRODUCED_BY:
			return producedBy != null;
		}
		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(" (modelName: ");
		result.append(modelName);
		result.append(", revisionYear: ");
		result.append(revisionYear);
		result.append(')');
		return result.toString();
	}

} //EnergyComponentImpl
