| /** |
| * ******************************************************************************* |
| * Copyright (c) 2015-2021 Robert Bosch GmbH and others. |
| * |
| * This program and the accompanying materials are made |
| * available under the terms of the Eclipse Public License 2.0 |
| * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Generated using Eclipse EMF |
| * |
| * ******************************************************************************* |
| */ |
| package org.eclipse.app4mc.amalthea.model.impl; |
| |
| import org.eclipse.app4mc.amalthea.model.AmaltheaPackage; |
| import org.eclipse.app4mc.amalthea.model.DataSize; |
| import org.eclipse.app4mc.amalthea.model.INamespaceMember; |
| import org.eclipse.app4mc.amalthea.model.Namespace; |
| import org.eclipse.app4mc.amalthea.model.TypeDefinition; |
| |
| 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; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Type Definition</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.TypeDefinitionImpl#getNamespace <em>Namespace</em>}</li> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.TypeDefinitionImpl#getSize <em>Size</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public abstract class TypeDefinitionImpl extends ReferableBaseObjectImpl implements TypeDefinition { |
| /** |
| * The cached value of the '{@link #getNamespace() <em>Namespace</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getNamespace() |
| * @generated |
| * @ordered |
| */ |
| protected Namespace namespace; |
| |
| /** |
| * The cached value of the '{@link #getSize() <em>Size</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSize() |
| * @generated |
| * @ordered |
| */ |
| protected DataSize size; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected TypeDefinitionImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AmaltheaPackage.eINSTANCE.getTypeDefinition(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Namespace getNamespace() { |
| if (namespace != null && namespace.eIsProxy()) { |
| InternalEObject oldNamespace = (InternalEObject)namespace; |
| namespace = (Namespace)eResolveProxy(oldNamespace); |
| if (namespace != oldNamespace) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, AmaltheaPackage.TYPE_DEFINITION__NAMESPACE, oldNamespace, namespace)); |
| } |
| } |
| return namespace; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Namespace basicGetNamespace() { |
| return namespace; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setNamespace(Namespace newNamespace) { |
| Namespace oldNamespace = namespace; |
| namespace = newNamespace; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.TYPE_DEFINITION__NAMESPACE, oldNamespace, namespace)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public DataSize getSize() { |
| return size; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetSize(DataSize newSize, NotificationChain msgs) { |
| DataSize oldSize = size; |
| size = newSize; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AmaltheaPackage.TYPE_DEFINITION__SIZE, oldSize, newSize); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setSize(DataSize newSize) { |
| if (newSize != size) { |
| NotificationChain msgs = null; |
| if (size != null) |
| msgs = ((InternalEObject)size).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.TYPE_DEFINITION__SIZE, null, msgs); |
| if (newSize != null) |
| msgs = ((InternalEObject)newSize).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.TYPE_DEFINITION__SIZE, null, msgs); |
| msgs = basicSetSize(newSize, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.TYPE_DEFINITION__SIZE, newSize, newSize)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case AmaltheaPackage.TYPE_DEFINITION__SIZE: |
| return basicSetSize(null, 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 AmaltheaPackage.TYPE_DEFINITION__NAMESPACE: |
| if (resolve) return getNamespace(); |
| return basicGetNamespace(); |
| case AmaltheaPackage.TYPE_DEFINITION__SIZE: |
| return getSize(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case AmaltheaPackage.TYPE_DEFINITION__NAMESPACE: |
| setNamespace((Namespace)newValue); |
| return; |
| case AmaltheaPackage.TYPE_DEFINITION__SIZE: |
| setSize((DataSize)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.TYPE_DEFINITION__NAMESPACE: |
| setNamespace((Namespace)null); |
| return; |
| case AmaltheaPackage.TYPE_DEFINITION__SIZE: |
| setSize((DataSize)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.TYPE_DEFINITION__NAMESPACE: |
| return namespace != null; |
| case AmaltheaPackage.TYPE_DEFINITION__SIZE: |
| return size != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { |
| if (baseClass == INamespaceMember.class) { |
| switch (derivedFeatureID) { |
| case AmaltheaPackage.TYPE_DEFINITION__NAMESPACE: return AmaltheaPackage.INAMESPACE_MEMBER__NAMESPACE; |
| default: return -1; |
| } |
| } |
| return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { |
| if (baseClass == INamespaceMember.class) { |
| switch (baseFeatureID) { |
| case AmaltheaPackage.INAMESPACE_MEMBER__NAMESPACE: return AmaltheaPackage.TYPE_DEFINITION__NAMESPACE; |
| default: return -1; |
| } |
| } |
| return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); |
| } |
| |
| } //TypeDefinitionImpl |