| /******************************************************************************* |
| * Copyright (c) 2015, 2016 Willink Transformations 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 |
| *******************************************************************************/ |
| /** |
| */ |
| package manualuml2rdbms.uml.impl; |
| |
| import manualuml2rdbms.uml.PackageElement; |
| import manualuml2rdbms.uml.UMLPackage; |
| |
| 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; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Package Element</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link manualuml2rdbms.uml.impl.PackageElementImpl#getNamespace <em>Namespace</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public abstract class PackageElementImpl extends UMLModelElementImpl implements PackageElement { |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected PackageElementImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return UMLPackage.Literals.PACKAGE_ELEMENT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public manualuml2rdbms.uml.Package getNamespace() { |
| if (eContainerFeatureID() != UMLPackage.PACKAGE_ELEMENT__NAMESPACE) return null; |
| return (manualuml2rdbms.uml.Package)eInternalContainer(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetNamespace(manualuml2rdbms.uml.Package newNamespace, NotificationChain msgs) { |
| msgs = eBasicSetContainer((InternalEObject)newNamespace, UMLPackage.PACKAGE_ELEMENT__NAMESPACE, msgs); |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setNamespace(manualuml2rdbms.uml.Package newNamespace) { |
| if (newNamespace != eInternalContainer() || (eContainerFeatureID() != UMLPackage.PACKAGE_ELEMENT__NAMESPACE && newNamespace != null)) { |
| if (EcoreUtil.isAncestor(this, newNamespace)) |
| throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| NotificationChain msgs = null; |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| if (newNamespace != null) |
| msgs = ((InternalEObject)newNamespace).eInverseAdd(this, UMLPackage.PACKAGE__ELEMENTS, manualuml2rdbms.uml.Package.class, msgs); |
| msgs = basicSetNamespace(newNamespace, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, UMLPackage.PACKAGE_ELEMENT__NAMESPACE, newNamespace, newNamespace)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case UMLPackage.PACKAGE_ELEMENT__NAMESPACE: |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| return basicSetNamespace((manualuml2rdbms.uml.Package)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 UMLPackage.PACKAGE_ELEMENT__NAMESPACE: |
| return basicSetNamespace(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| switch (eContainerFeatureID()) { |
| case UMLPackage.PACKAGE_ELEMENT__NAMESPACE: |
| return eInternalContainer().eInverseRemove(this, UMLPackage.PACKAGE__ELEMENTS, manualuml2rdbms.uml.Package.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 UMLPackage.PACKAGE_ELEMENT__NAMESPACE: |
| return getNamespace(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case UMLPackage.PACKAGE_ELEMENT__NAMESPACE: |
| setNamespace((manualuml2rdbms.uml.Package)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case UMLPackage.PACKAGE_ELEMENT__NAMESPACE: |
| setNamespace((manualuml2rdbms.uml.Package)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case UMLPackage.PACKAGE_ELEMENT__NAMESPACE: |
| return getNamespace() != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //PackageElementImpl |