| /** |
| * 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.AttributeDefinitionEnumeration; |
| import org.eclipse.rmf.reqif10.AttributeValueEnumeration; |
| import org.eclipse.rmf.reqif10.DatatypeDefinitionEnumeration; |
| import org.eclipse.rmf.reqif10.ReqIF10Package; |
| |
| /** |
| * <!-- begin-user-doc --> An implementation of the model object '<em><b>Attribute Definition Enumeration</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.rmf.reqif10.impl.AttributeDefinitionEnumerationImpl#isMultiValued <em>Multi Valued</em>}</li> |
| * <li>{@link org.eclipse.rmf.reqif10.impl.AttributeDefinitionEnumerationImpl#getType <em>Type</em>}</li> |
| * <li>{@link org.eclipse.rmf.reqif10.impl.AttributeDefinitionEnumerationImpl#getDefaultValue <em>Default Value</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class AttributeDefinitionEnumerationImpl extends AttributeDefinitionImpl implements AttributeDefinitionEnumeration { |
| /** |
| * The default value of the '{@link #isMultiValued() <em>Multi Valued</em>}' attribute. <!-- begin-user-doc --> <!-- |
| * end-user-doc --> |
| * |
| * @see #isMultiValued() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean MULTI_VALUED_EDEFAULT = false; |
| |
| /** |
| * The cached value of the '{@link #isMultiValued() <em>Multi Valued</em>}' attribute. <!-- begin-user-doc --> <!-- |
| * end-user-doc --> |
| * |
| * @see #isMultiValued() |
| * @generated |
| * @ordered |
| */ |
| protected boolean multiValued = MULTI_VALUED_EDEFAULT; |
| |
| /** |
| * This is true if the Multi Valued attribute has been set. <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| * @ordered |
| */ |
| protected boolean multiValuedESet; |
| |
| /** |
| * The cached value of the '{@link #getType() <em>Type</em>}' reference. <!-- begin-user-doc --> <!-- end-user-doc |
| * --> |
| * |
| * @see #getType() |
| * @generated |
| * @ordered |
| */ |
| protected DatatypeDefinitionEnumeration 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 AttributeValueEnumeration 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 AttributeDefinitionEnumerationImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ReqIF10Package.Literals.ATTRIBUTE_DEFINITION_ENUMERATION; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public boolean isMultiValued() { |
| return multiValued; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setMultiValued(boolean newMultiValued) { |
| boolean oldMultiValued = multiValued; |
| multiValued = newMultiValued; |
| boolean oldMultiValuedESet = multiValuedESet; |
| multiValuedESet = true; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ReqIF10Package.ATTRIBUTE_DEFINITION_ENUMERATION__MULTI_VALUED, oldMultiValued, |
| multiValued, !oldMultiValuedESet)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void unsetMultiValued() { |
| boolean oldMultiValued = multiValued; |
| boolean oldMultiValuedESet = multiValuedESet; |
| multiValued = MULTI_VALUED_EDEFAULT; |
| multiValuedESet = false; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.UNSET, ReqIF10Package.ATTRIBUTE_DEFINITION_ENUMERATION__MULTI_VALUED, oldMultiValued, |
| MULTI_VALUED_EDEFAULT, oldMultiValuedESet)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public boolean isSetMultiValued() { |
| return multiValuedESet; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public DatatypeDefinitionEnumeration getType() { |
| if (type != null && type.eIsProxy()) { |
| InternalEObject oldType = (InternalEObject) type; |
| type = (DatatypeDefinitionEnumeration) eResolveProxy(oldType); |
| if (type != oldType) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, ReqIF10Package.ATTRIBUTE_DEFINITION_ENUMERATION__TYPE, oldType, type)); |
| } |
| } |
| return type; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public DatatypeDefinitionEnumeration basicGetType() { |
| return type; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setType(DatatypeDefinitionEnumeration newType) { |
| DatatypeDefinitionEnumeration oldType = type; |
| type = newType; |
| boolean oldTypeESet = typeESet; |
| typeESet = true; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ReqIF10Package.ATTRIBUTE_DEFINITION_ENUMERATION__TYPE, oldType, type, !oldTypeESet)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void unsetType() { |
| DatatypeDefinitionEnumeration oldType = type; |
| boolean oldTypeESet = typeESet; |
| type = null; |
| typeESet = false; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.UNSET, ReqIF10Package.ATTRIBUTE_DEFINITION_ENUMERATION__TYPE, oldType, null, oldTypeESet)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public boolean isSetType() { |
| return typeESet; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public AttributeValueEnumeration getDefaultValue() { |
| return defaultValue; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public NotificationChain basicSetDefaultValue(AttributeValueEnumeration newDefaultValue, NotificationChain msgs) { |
| AttributeValueEnumeration oldDefaultValue = defaultValue; |
| defaultValue = newDefaultValue; |
| boolean oldDefaultValueESet = defaultValueESet; |
| defaultValueESet = true; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, |
| ReqIF10Package.ATTRIBUTE_DEFINITION_ENUMERATION__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(AttributeValueEnumeration newDefaultValue) { |
| if (newDefaultValue != defaultValue) { |
| NotificationChain msgs = null; |
| if (defaultValue != null) |
| msgs = ((InternalEObject) defaultValue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE |
| - ReqIF10Package.ATTRIBUTE_DEFINITION_ENUMERATION__DEFAULT_VALUE, null, msgs); |
| if (newDefaultValue != null) |
| msgs = ((InternalEObject) newDefaultValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE |
| - ReqIF10Package.ATTRIBUTE_DEFINITION_ENUMERATION__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_ENUMERATION__DEFAULT_VALUE, |
| newDefaultValue, newDefaultValue, !oldDefaultValueESet)); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public NotificationChain basicUnsetDefaultValue(NotificationChain msgs) { |
| AttributeValueEnumeration oldDefaultValue = defaultValue; |
| defaultValue = null; |
| boolean oldDefaultValueESet = defaultValueESet; |
| defaultValueESet = false; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, |
| ReqIF10Package.ATTRIBUTE_DEFINITION_ENUMERATION__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_ENUMERATION__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_ENUMERATION__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_ENUMERATION__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_ENUMERATION__MULTI_VALUED: |
| return isMultiValued(); |
| case ReqIF10Package.ATTRIBUTE_DEFINITION_ENUMERATION__TYPE: |
| if (resolve) |
| return getType(); |
| return basicGetType(); |
| case ReqIF10Package.ATTRIBUTE_DEFINITION_ENUMERATION__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_ENUMERATION__MULTI_VALUED: |
| setMultiValued((Boolean) newValue); |
| return; |
| case ReqIF10Package.ATTRIBUTE_DEFINITION_ENUMERATION__TYPE: |
| setType((DatatypeDefinitionEnumeration) newValue); |
| return; |
| case ReqIF10Package.ATTRIBUTE_DEFINITION_ENUMERATION__DEFAULT_VALUE: |
| setDefaultValue((AttributeValueEnumeration) 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_ENUMERATION__MULTI_VALUED: |
| unsetMultiValued(); |
| return; |
| case ReqIF10Package.ATTRIBUTE_DEFINITION_ENUMERATION__TYPE: |
| unsetType(); |
| return; |
| case ReqIF10Package.ATTRIBUTE_DEFINITION_ENUMERATION__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_ENUMERATION__MULTI_VALUED: |
| return isSetMultiValued(); |
| case ReqIF10Package.ATTRIBUTE_DEFINITION_ENUMERATION__TYPE: |
| return isSetType(); |
| case ReqIF10Package.ATTRIBUTE_DEFINITION_ENUMERATION__DEFAULT_VALUE: |
| return isSetDefaultValue(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) |
| return super.toString(); |
| |
| StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (multiValued: "); //$NON-NLS-1$ |
| if (multiValuedESet) |
| result.append(multiValued); |
| else |
| result.append("<unset>"); //$NON-NLS-1$ |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } // AttributeDefinitionEnumerationImpl |