| /** |
| */ |
| package example2.classes.lookup.impl; |
| |
| import example2.classes.NamedElement; |
| |
| import example2.classes.lookup.EnvEntry; |
| import example2.classes.lookup.EnvironmentPackage; |
| import example2.classes.lookup.LookupEnvironment; |
| |
| 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.EObjectResolvingEList; |
| import org.eclipse.emf.ecore.util.EcoreUtil; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Env Entry</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link example2.classes.lookup.impl.EnvEntryImpl#getName <em>Name</em>}</li> |
| * <li>{@link example2.classes.lookup.impl.EnvEntryImpl#getNamedElements <em>Named Elements</em>}</li> |
| * <li>{@link example2.classes.lookup.impl.EnvEntryImpl#getEnv <em>Env</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class EnvEntryImpl extends MinimalEObjectImpl.Container implements EnvEntry { |
| /** |
| * 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 cached value of the '{@link #getNamedElements() <em>Named Elements</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getNamedElements() |
| * @generated |
| * @ordered |
| */ |
| protected EList<NamedElement> namedElements; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected EnvEntryImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return EnvironmentPackage.Literals.ENV_ENTRY; |
| } |
| |
| /** |
| * <!-- 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, EnvironmentPackage.ENV_ENTRY__NAME, oldName, name)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<NamedElement> getNamedElements() { |
| if (namedElements == null) { |
| namedElements = new EObjectResolvingEList<NamedElement>(NamedElement.class, this, EnvironmentPackage.ENV_ENTRY__NAMED_ELEMENTS); |
| } |
| return namedElements; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public LookupEnvironment getEnv() { |
| if (eContainerFeatureID() != EnvironmentPackage.ENV_ENTRY__ENV) return null; |
| return (LookupEnvironment)eInternalContainer(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetEnv(LookupEnvironment newEnv, NotificationChain msgs) { |
| msgs = eBasicSetContainer((InternalEObject)newEnv, EnvironmentPackage.ENV_ENTRY__ENV, msgs); |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setEnv(LookupEnvironment newEnv) { |
| if (newEnv != eInternalContainer() || (eContainerFeatureID() != EnvironmentPackage.ENV_ENTRY__ENV && newEnv != null)) { |
| if (EcoreUtil.isAncestor(this, newEnv)) |
| throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| NotificationChain msgs = null; |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| if (newEnv != null) |
| msgs = ((InternalEObject)newEnv).eInverseAdd(this, EnvironmentPackage.LOOKUP_ENVIRONMENT__ENTRIES, LookupEnvironment.class, msgs); |
| msgs = basicSetEnv(newEnv, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EnvironmentPackage.ENV_ENTRY__ENV, newEnv, newEnv)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case EnvironmentPackage.ENV_ENTRY__ENV: |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| return basicSetEnv((LookupEnvironment)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 EnvironmentPackage.ENV_ENTRY__ENV: |
| return basicSetEnv(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| switch (eContainerFeatureID()) { |
| case EnvironmentPackage.ENV_ENTRY__ENV: |
| return eInternalContainer().eInverseRemove(this, EnvironmentPackage.LOOKUP_ENVIRONMENT__ENTRIES, LookupEnvironment.class, msgs); |
| } |
| return super.eBasicRemoveFromContainerFeature(msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case EnvironmentPackage.ENV_ENTRY__NAME: |
| return getName(); |
| case EnvironmentPackage.ENV_ENTRY__NAMED_ELEMENTS: |
| return getNamedElements(); |
| case EnvironmentPackage.ENV_ENTRY__ENV: |
| return getEnv(); |
| } |
| 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 EnvironmentPackage.ENV_ENTRY__NAME: |
| setName((String)newValue); |
| return; |
| case EnvironmentPackage.ENV_ENTRY__NAMED_ELEMENTS: |
| getNamedElements().clear(); |
| getNamedElements().addAll((Collection<? extends NamedElement>)newValue); |
| return; |
| case EnvironmentPackage.ENV_ENTRY__ENV: |
| setEnv((LookupEnvironment)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case EnvironmentPackage.ENV_ENTRY__NAME: |
| setName(NAME_EDEFAULT); |
| return; |
| case EnvironmentPackage.ENV_ENTRY__NAMED_ELEMENTS: |
| getNamedElements().clear(); |
| return; |
| case EnvironmentPackage.ENV_ENTRY__ENV: |
| setEnv((LookupEnvironment)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case EnvironmentPackage.ENV_ENTRY__NAME: |
| return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
| case EnvironmentPackage.ENV_ENTRY__NAMED_ELEMENTS: |
| return namedElements != null && !namedElements.isEmpty(); |
| case EnvironmentPackage.ENV_ENTRY__ENV: |
| return getEnv() != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (name: "); |
| result.append(name); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| |
| } //EnvEntryImpl |