| /******************************************************************************* |
| * Copyright (c) 2015, 2019 Willink Transformations and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v2.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v20.html |
| * |
| * Contributors: |
| * E.D.Willink - initial API and implementation |
| *******************************************************************************/ |
| /** |
| */ |
| package manualuml2rdbms.uml2rdbms.impl; |
| |
| import manualuml2rdbms.uml.PrimitiveDataType; |
| |
| import manualuml2rdbms.uml2rdbms.PackageToSchema; |
| import manualuml2rdbms.uml2rdbms.PrimitiveToName; |
| import manualuml2rdbms.uml2rdbms.UML2RDBMSPackage; |
| |
| 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.impl.MinimalEObjectImpl; |
| |
| import org.eclipse.emf.ecore.util.EcoreUtil; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Primitive To Name</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link manualuml2rdbms.uml2rdbms.impl.PrimitiveToNameImpl#getOwner <em>Owner</em>}</li> |
| * <li>{@link manualuml2rdbms.uml2rdbms.impl.PrimitiveToNameImpl#getName <em>Name</em>}</li> |
| * <li>{@link manualuml2rdbms.uml2rdbms.impl.PrimitiveToNameImpl#getPrimitive <em>Primitive</em>}</li> |
| * <li>{@link manualuml2rdbms.uml2rdbms.impl.PrimitiveToNameImpl#getTypeName <em>Type Name</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class PrimitiveToNameImpl extends MinimalEObjectImpl.Container implements PrimitiveToName { |
| /** |
| * The number of structural features of the '<em>Primitive To Name</em>' class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| * @ordered |
| */ |
| public static final int PRIMITIVE_TO_NAME_FEATURE_COUNT = 4; |
| |
| /** |
| * The number of operations of the '<em>Primitive To Name</em>' class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| * @ordered |
| */ |
| public static final int PRIMITIVE_TO_NAME_OPERATION_COUNT = 0; |
| |
| /** |
| * 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 #getPrimitive() <em>Primitive</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPrimitive() |
| * @generated |
| * @ordered |
| */ |
| protected PrimitiveDataType primitive; |
| |
| /** |
| * The default value of the '{@link #getTypeName() <em>Type Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTypeName() |
| * @generated |
| * @ordered |
| */ |
| protected static final String TYPE_NAME_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getTypeName() <em>Type Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTypeName() |
| * @generated |
| * @ordered |
| */ |
| protected String typeName = TYPE_NAME_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected PrimitiveToNameImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return UML2RDBMSPackage.Literals.PRIMITIVE_TO_NAME; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public PackageToSchema getOwner() { |
| if (eContainerFeatureID() != (0)) return null; |
| return (PackageToSchema)eInternalContainer(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetOwner(PackageToSchema newOwner, NotificationChain msgs) { |
| msgs = eBasicSetContainer((InternalEObject)newOwner, 0, msgs); |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setOwner(PackageToSchema newOwner) { |
| if (newOwner != eInternalContainer() || (eContainerFeatureID() != (0) && newOwner != null)) { |
| if (EcoreUtil.isAncestor(this, newOwner)) |
| throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| NotificationChain msgs = null; |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| if (newOwner != null) |
| msgs = ((InternalEObject)newOwner).eInverseAdd(this, 1, PackageToSchema.class, msgs); |
| msgs = basicSetOwner(newOwner, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, 0, newOwner, newOwner)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String getName() { |
| return name; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setName(String newName) { |
| String oldName = name; |
| name = newName; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, 1, oldName, name)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public PrimitiveDataType getPrimitive() { |
| if (primitive != null && primitive.eIsProxy()) { |
| InternalEObject oldPrimitive = (InternalEObject)primitive; |
| primitive = (PrimitiveDataType)eResolveProxy(oldPrimitive); |
| if (primitive != oldPrimitive) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, 2, oldPrimitive, primitive)); |
| } |
| } |
| return primitive; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public PrimitiveDataType basicGetPrimitive() { |
| return primitive; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setPrimitive(PrimitiveDataType newPrimitive) { |
| PrimitiveDataType oldPrimitive = primitive; |
| primitive = newPrimitive; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, 2, oldPrimitive, primitive)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String getTypeName() { |
| return typeName; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setTypeName(String newTypeName) { |
| String oldTypeName = typeName; |
| typeName = newTypeName; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, 3, oldTypeName, typeName)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case 0: |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| return basicSetOwner((PackageToSchema)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 0: |
| return basicSetOwner(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| switch (eContainerFeatureID()) { |
| case 0: |
| return eInternalContainer().eInverseRemove(this, 1, PackageToSchema.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 0: |
| return getOwner(); |
| case 1: |
| return getName(); |
| case 2: |
| if (resolve) return getPrimitive(); |
| return basicGetPrimitive(); |
| case 3: |
| return getTypeName(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case 0: |
| setOwner((PackageToSchema)newValue); |
| return; |
| case 1: |
| setName((String)newValue); |
| return; |
| case 2: |
| setPrimitive((PrimitiveDataType)newValue); |
| return; |
| case 3: |
| setTypeName((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case 0: |
| setOwner((PackageToSchema)null); |
| return; |
| case 1: |
| setName(NAME_EDEFAULT); |
| return; |
| case 2: |
| setPrimitive((PrimitiveDataType)null); |
| return; |
| case 3: |
| setTypeName(TYPE_NAME_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case 0: |
| return getOwner() != null; |
| case 1: |
| return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
| case 2: |
| return primitive != null; |
| case 3: |
| return TYPE_NAME_EDEFAULT == null ? typeName != null : !TYPE_NAME_EDEFAULT.equals(typeName); |
| } |
| 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(" (name: "); |
| result.append(name); |
| result.append(", typeName: "); |
| result.append(typeName); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //PrimitiveToNameImpl |