| /** |
| * Copyright (c) 2013 itemis AG 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: |
| * Mark Broerkens - initial API and implementation |
| * |
| */ |
| package org.eclipse.rmf.reqif10.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.rmf.reqif10.AttributeDefinitionReal; |
| import org.eclipse.rmf.reqif10.AttributeValueReal; |
| import org.eclipse.rmf.reqif10.DatatypeDefinitionReal; |
| import org.eclipse.rmf.reqif10.ReqIF10Package; |
| |
| /** |
| * <!-- begin-user-doc --> An implementation of the model object '<em><b>Attribute Definition Real</b></em>'. <!-- |
| * end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.rmf.reqif10.impl.AttributeDefinitionRealImpl#getType <em>Type</em>}</li> |
| * <li>{@link org.eclipse.rmf.reqif10.impl.AttributeDefinitionRealImpl#getDefaultValue <em>Default Value</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class AttributeDefinitionRealImpl extends AttributeDefinitionSimpleImpl implements AttributeDefinitionReal { |
| /** |
| * The cached value of the '{@link #getType() <em>Type</em>}' reference. <!-- begin-user-doc --> <!-- end-user-doc |
| * --> |
| * |
| * @see #getType() |
| * @generated |
| * @ordered |
| */ |
| protected DatatypeDefinitionReal type; |
| |
| /** |
| * This is true if the Type reference has been set. <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| * @ordered |
| */ |
| protected boolean typeESet; |
| |
| /** |
| * The cached value of the '{@link #getDefaultValue() <em>Default Value</em>}' containment reference. <!-- |
| * begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @see #getDefaultValue() |
| * @generated |
| * @ordered |
| */ |
| protected AttributeValueReal defaultValue; |
| |
| /** |
| * This is true if the Default Value containment reference has been set. <!-- begin-user-doc --> <!-- end-user-doc |
| * --> |
| * |
| * @generated |
| * @ordered |
| */ |
| protected boolean defaultValueESet; |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| protected AttributeDefinitionRealImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ReqIF10Package.Literals.ATTRIBUTE_DEFINITION_REAL; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public DatatypeDefinitionReal getType() { |
| if (type != null && type.eIsProxy()) { |
| InternalEObject oldType = (InternalEObject) type; |
| type = (DatatypeDefinitionReal) eResolveProxy(oldType); |
| if (type != oldType) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, ReqIF10Package.ATTRIBUTE_DEFINITION_REAL__TYPE, oldType, type)); |
| } |
| } |
| return type; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public DatatypeDefinitionReal basicGetType() { |
| return type; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setType(DatatypeDefinitionReal newType) { |
| DatatypeDefinitionReal oldType = type; |
| type = newType; |
| boolean oldTypeESet = typeESet; |
| typeESet = true; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ReqIF10Package.ATTRIBUTE_DEFINITION_REAL__TYPE, oldType, type, !oldTypeESet)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void unsetType() { |
| DatatypeDefinitionReal oldType = type; |
| boolean oldTypeESet = typeESet; |
| type = null; |
| typeESet = false; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.UNSET, ReqIF10Package.ATTRIBUTE_DEFINITION_REAL__TYPE, oldType, null, oldTypeESet)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public boolean isSetType() { |
| return typeESet; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public AttributeValueReal getDefaultValue() { |
| return defaultValue; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public NotificationChain basicSetDefaultValue(AttributeValueReal newDefaultValue, NotificationChain msgs) { |
| AttributeValueReal oldDefaultValue = defaultValue; |
| defaultValue = newDefaultValue; |
| boolean oldDefaultValueESet = defaultValueESet; |
| defaultValueESet = true; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ReqIF10Package.ATTRIBUTE_DEFINITION_REAL__DEFAULT_VALUE, |
| oldDefaultValue, newDefaultValue, !oldDefaultValueESet); |
| if (msgs == null) |
| msgs = notification; |
| else |
| msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setDefaultValue(AttributeValueReal newDefaultValue) { |
| if (newDefaultValue != defaultValue) { |
| NotificationChain msgs = null; |
| if (defaultValue != null) |
| msgs = ((InternalEObject) defaultValue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE |
| - ReqIF10Package.ATTRIBUTE_DEFINITION_REAL__DEFAULT_VALUE, null, msgs); |
| if (newDefaultValue != null) |
| msgs = ((InternalEObject) newDefaultValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE |
| - ReqIF10Package.ATTRIBUTE_DEFINITION_REAL__DEFAULT_VALUE, null, msgs); |
| msgs = basicSetDefaultValue(newDefaultValue, msgs); |
| if (msgs != null) |
| msgs.dispatch(); |
| } else { |
| boolean oldDefaultValueESet = defaultValueESet; |
| defaultValueESet = true; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ReqIF10Package.ATTRIBUTE_DEFINITION_REAL__DEFAULT_VALUE, newDefaultValue, |
| newDefaultValue, !oldDefaultValueESet)); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public NotificationChain basicUnsetDefaultValue(NotificationChain msgs) { |
| AttributeValueReal oldDefaultValue = defaultValue; |
| defaultValue = null; |
| boolean oldDefaultValueESet = defaultValueESet; |
| defaultValueESet = false; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, ReqIF10Package.ATTRIBUTE_DEFINITION_REAL__DEFAULT_VALUE, |
| oldDefaultValue, null, oldDefaultValueESet); |
| if (msgs == null) |
| msgs = notification; |
| else |
| msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void unsetDefaultValue() { |
| if (defaultValue != null) { |
| NotificationChain msgs = null; |
| msgs = ((InternalEObject) defaultValue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE |
| - ReqIF10Package.ATTRIBUTE_DEFINITION_REAL__DEFAULT_VALUE, null, msgs); |
| msgs = basicUnsetDefaultValue(msgs); |
| if (msgs != null) |
| msgs.dispatch(); |
| } else { |
| boolean oldDefaultValueESet = defaultValueESet; |
| defaultValueESet = false; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.UNSET, ReqIF10Package.ATTRIBUTE_DEFINITION_REAL__DEFAULT_VALUE, null, null, |
| oldDefaultValueESet)); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public boolean isSetDefaultValue() { |
| return defaultValueESet; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case ReqIF10Package.ATTRIBUTE_DEFINITION_REAL__DEFAULT_VALUE: |
| return basicUnsetDefaultValue(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 ReqIF10Package.ATTRIBUTE_DEFINITION_REAL__TYPE: |
| if (resolve) |
| return getType(); |
| return basicGetType(); |
| case ReqIF10Package.ATTRIBUTE_DEFINITION_REAL__DEFAULT_VALUE: |
| return getDefaultValue(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case ReqIF10Package.ATTRIBUTE_DEFINITION_REAL__TYPE: |
| setType((DatatypeDefinitionReal) newValue); |
| return; |
| case ReqIF10Package.ATTRIBUTE_DEFINITION_REAL__DEFAULT_VALUE: |
| setDefaultValue((AttributeValueReal) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ReqIF10Package.ATTRIBUTE_DEFINITION_REAL__TYPE: |
| unsetType(); |
| return; |
| case ReqIF10Package.ATTRIBUTE_DEFINITION_REAL__DEFAULT_VALUE: |
| unsetDefaultValue(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ReqIF10Package.ATTRIBUTE_DEFINITION_REAL__TYPE: |
| return isSetType(); |
| case ReqIF10Package.ATTRIBUTE_DEFINITION_REAL__DEFAULT_VALUE: |
| return isSetDefaultValue(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } // AttributeDefinitionRealImpl |