| /** |
| * <copyright> |
| * |
| * Copyright (c) 2007, 2008 E.D.Willink and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * E.D.Willink - initial API and implementation |
| * |
| * </copyright> |
| * |
| * $Id: EnumerationLiteralImpl.java,v 1.1 2008/07/23 09:55:18 qglineur Exp $ |
| */ |
| package org.eclipse.qvt.declarative.emof.EMOF.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.emf.ecore.util.EcoreUtil; |
| |
| import org.eclipse.qvt.declarative.emof.EMOF.EMOFPackage; |
| import org.eclipse.qvt.declarative.emof.EMOF.Enumeration; |
| import org.eclipse.qvt.declarative.emof.EMOF.EnumerationLiteral; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Enumeration Literal</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.qvt.declarative.emof.EMOF.impl.EnumerationLiteralImpl#getEnumeration <em>Enumeration</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class EnumerationLiteralImpl extends NamedElementImpl implements EnumerationLiteral { |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected EnumerationLiteralImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return EMOFPackage.Literals.ENUMERATION_LITERAL; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Enumeration getEnumeration() { |
| if (eContainerFeatureID != EMOFPackage.ENUMERATION_LITERAL__ENUMERATION) return null; |
| return (Enumeration)eContainer(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetEnumeration(Enumeration newEnumeration, NotificationChain msgs) { |
| msgs = eBasicSetContainer((InternalEObject)newEnumeration, EMOFPackage.ENUMERATION_LITERAL__ENUMERATION, msgs); |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setEnumeration(Enumeration newEnumeration) { |
| if (newEnumeration != eInternalContainer() || (eContainerFeatureID != EMOFPackage.ENUMERATION_LITERAL__ENUMERATION && newEnumeration != null)) { |
| if (EcoreUtil.isAncestor(this, newEnumeration)) |
| throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| NotificationChain msgs = null; |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| if (newEnumeration != null) |
| msgs = ((InternalEObject)newEnumeration).eInverseAdd(this, EMOFPackage.ENUMERATION__OWNED_LITERAL, Enumeration.class, msgs); |
| msgs = basicSetEnumeration(newEnumeration, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EMOFPackage.ENUMERATION_LITERAL__ENUMERATION, newEnumeration, newEnumeration)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case EMOFPackage.ENUMERATION_LITERAL__ENUMERATION: |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| return basicSetEnumeration((Enumeration)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 EMOFPackage.ENUMERATION_LITERAL__ENUMERATION: |
| return basicSetEnumeration(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| switch (eContainerFeatureID) { |
| case EMOFPackage.ENUMERATION_LITERAL__ENUMERATION: |
| return eInternalContainer().eInverseRemove(this, EMOFPackage.ENUMERATION__OWNED_LITERAL, Enumeration.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 EMOFPackage.ENUMERATION_LITERAL__ENUMERATION: |
| return getEnumeration(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case EMOFPackage.ENUMERATION_LITERAL__ENUMERATION: |
| setEnumeration((Enumeration)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case EMOFPackage.ENUMERATION_LITERAL__ENUMERATION: |
| setEnumeration((Enumeration)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case EMOFPackage.ENUMERATION_LITERAL__ENUMERATION: |
| return getEnumeration() != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //EnumerationLiteralImpl |