/** * 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.EmbeddedValue; import org.eclipse.rmf.reqif10.EnumValue; import org.eclipse.rmf.reqif10.ReqIF10Package; /** * <!-- begin-user-doc --> An implementation of the model object '<em><b>Enum Value</b></em>'. <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.rmf.reqif10.impl.EnumValueImpl#getProperties <em>Properties</em>}</li> * </ul> * </p> * * @generated */ public class EnumValueImpl extends IdentifiableImpl implements EnumValue { /** * The cached value of the '{@link #getProperties() <em>Properties</em>}' containment reference. <!-- begin-user-doc * --> <!-- end-user-doc --> * * @see #getProperties() * @generated * @ordered */ protected EmbeddedValue properties; /** * This is true if the Properties containment reference has been set. <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated * @ordered */ protected boolean propertiesESet; /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ protected EnumValueImpl() { super(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override protected EClass eStaticClass() { return ReqIF10Package.Literals.ENUM_VALUE; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public EmbeddedValue getProperties() { return properties; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public NotificationChain basicSetProperties(EmbeddedValue newProperties, NotificationChain msgs) { EmbeddedValue oldProperties = properties; properties = newProperties; boolean oldPropertiesESet = propertiesESet; propertiesESet = true; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ReqIF10Package.ENUM_VALUE__PROPERTIES, oldProperties, newProperties, !oldPropertiesESet); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public void setProperties(EmbeddedValue newProperties) { if (newProperties != properties) { NotificationChain msgs = null; if (properties != null) msgs = ((InternalEObject) properties) .eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ReqIF10Package.ENUM_VALUE__PROPERTIES, null, msgs); if (newProperties != null) msgs = ((InternalEObject) newProperties) .eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ReqIF10Package.ENUM_VALUE__PROPERTIES, null, msgs); msgs = basicSetProperties(newProperties, msgs); if (msgs != null) msgs.dispatch(); } else { boolean oldPropertiesESet = propertiesESet; propertiesESet = true; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ReqIF10Package.ENUM_VALUE__PROPERTIES, newProperties, newProperties, !oldPropertiesESet)); } } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public NotificationChain basicUnsetProperties(NotificationChain msgs) { EmbeddedValue oldProperties = properties; properties = null; boolean oldPropertiesESet = propertiesESet; propertiesESet = false; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, ReqIF10Package.ENUM_VALUE__PROPERTIES, oldProperties, null, oldPropertiesESet); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public void unsetProperties() { if (properties != null) { NotificationChain msgs = null; msgs = ((InternalEObject) properties).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ReqIF10Package.ENUM_VALUE__PROPERTIES, null, msgs); msgs = basicUnsetProperties(msgs); if (msgs != null) msgs.dispatch(); } else { boolean oldPropertiesESet = propertiesESet; propertiesESet = false; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.UNSET, ReqIF10Package.ENUM_VALUE__PROPERTIES, null, null, oldPropertiesESet)); } } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public boolean isSetProperties() { return propertiesESet; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case ReqIF10Package.ENUM_VALUE__PROPERTIES: return basicUnsetProperties(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.ENUM_VALUE__PROPERTIES: return getProperties(); } 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.ENUM_VALUE__PROPERTIES: setProperties((EmbeddedValue) newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ReqIF10Package.ENUM_VALUE__PROPERTIES: unsetProperties(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ReqIF10Package.ENUM_VALUE__PROPERTIES: return isSetProperties(); } return super.eIsSet(featureID); } } // EnumValueImpl