/** * <copyright> * </copyright> * * $Id$ */ package org.dresdenocl.examples.pml.impl; 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.EObjectImpl; import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; import org.eclipse.emf.ecore.util.InternalEList; import org.dresdenocl.examples.pml.Feature; import org.dresdenocl.examples.pml.Plugin; import org.dresdenocl.examples.pml.PmlPackage; /** * <!-- begin-user-doc --> An implementation of the model object ' * <em><b>Feature</b></em>'. <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.dresdenocl.examples.pml.impl.FeatureImpl#getId <em>Id</em>}</li> * <li>{@link org.dresdenocl.examples.pml.impl.FeatureImpl#getName <em>Name</em>}</li> * <li>{@link org.dresdenocl.examples.pml.impl.FeatureImpl#getVersion <em>Version</em>}</li> * <li>{@link org.dresdenocl.examples.pml.impl.FeatureImpl#getPlugins <em>Plugins</em>}</li> * </ul> * </p> * * @generated */ public class FeatureImpl extends EObjectImpl implements Feature { /** * The default value of the '{@link #getId() <em>Id</em>}' attribute. <!-- * begin-user-doc --> <!-- end-user-doc --> * * @see #getId() * @generated * @ordered */ protected static final String ID_EDEFAULT = null; /** * The cached value of the '{@link #getId() <em>Id</em>}' attribute. <!-- * begin-user-doc --> <!-- end-user-doc --> * * @see #getId() * @generated * @ordered */ protected String id = ID_EDEFAULT; /** * The default value of the '{@link #getName() <em>Name</em>}' attribute. <!-- * begin-user-doc --> <!-- end-user-doc --> * * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() <em>Name</em>}' attribute. <!-- * begin-user-doc --> <!-- end-user-doc --> * * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The default value of the '{@link #getVersion() <em>Version</em>}' attribute. * <!-- begin-user-doc --> <!-- end-user-doc --> * @see #getVersion() * @generated * @ordered */ protected static final String VERSION_EDEFAULT = null; /** * The cached value of the '{@link #getVersion() <em>Version</em>}' attribute. * <!-- begin-user-doc --> <!-- end-user-doc --> * @see #getVersion() * @generated * @ordered */ protected String version = VERSION_EDEFAULT; /** * The cached value of the '{@link #getPlugins() <em>Plugins</em>}' containment reference list. * <!-- begin-user-doc --> <!-- end-user-doc --> * @see #getPlugins() * @generated * @ordered */ protected EList<Plugin> plugins; /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ protected FeatureImpl() { super(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return PmlPackage.Literals.FEATURE; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public String getId() { return id; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public void setId(String newId) { String oldId = id; id = newId; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PmlPackage.FEATURE__ID, oldId, id)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PmlPackage.FEATURE__NAME, oldName, name)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public String getVersion() { return version; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public void setVersion(String newVersion) { String oldVersion = version; version = newVersion; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PmlPackage.FEATURE__VERSION, oldVersion, version)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public EList<Plugin> getPlugins() { if (plugins == null) { plugins = new EObjectContainmentWithInverseEList<Plugin>(Plugin.class, this, PmlPackage.FEATURE__PLUGINS, PmlPackage.PLUGIN__FEATURE); } return plugins; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case PmlPackage.FEATURE__PLUGINS: return ((InternalEList<InternalEObject>)(InternalEList<?>)getPlugins()).basicAdd(otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case PmlPackage.FEATURE__PLUGINS: return ((InternalEList<?>)getPlugins()).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 PmlPackage.FEATURE__ID: return getId(); case PmlPackage.FEATURE__NAME: return getName(); case PmlPackage.FEATURE__VERSION: return getVersion(); case PmlPackage.FEATURE__PLUGINS: return getPlugins(); } 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 PmlPackage.FEATURE__ID: setId((String)newValue); return; case PmlPackage.FEATURE__NAME: setName((String)newValue); return; case PmlPackage.FEATURE__VERSION: setVersion((String)newValue); return; case PmlPackage.FEATURE__PLUGINS: getPlugins().clear(); getPlugins().addAll((Collection<? extends Plugin>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case PmlPackage.FEATURE__ID: setId(ID_EDEFAULT); return; case PmlPackage.FEATURE__NAME: setName(NAME_EDEFAULT); return; case PmlPackage.FEATURE__VERSION: setVersion(VERSION_EDEFAULT); return; case PmlPackage.FEATURE__PLUGINS: getPlugins().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case PmlPackage.FEATURE__ID: return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); case PmlPackage.FEATURE__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case PmlPackage.FEATURE__VERSION: return VERSION_EDEFAULT == null ? version != null : !VERSION_EDEFAULT.equals(version); case PmlPackage.FEATURE__PLUGINS: return plugins != null && !plugins.isEmpty(); } return super.eIsSet(featureID); } /** * (non-Javadoc) * * @see org.eclipse.emf.ecore.impl.BasicEObjectImpl#toString() * @generated NOT */ public String toString() { String result; result = this.getClass().getSimpleName(); result += "["; result += "id = " + id; result += ", name = " + name; result += ", version = " + version; if (plugins != null) { result += "plugins = ["; for (int index = 0; index < plugins.size(); index++) { if (index > 0) { result += ", "; } // no else. result += plugins.get(index).getId(); } result += "]"; } // no else. result += "]"; return result; } } // FeatureImpl