/** * 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.AttributeDefinitionString; import org.eclipse.rmf.reqif10.AttributeValueString; import org.eclipse.rmf.reqif10.DatatypeDefinitionString; import org.eclipse.rmf.reqif10.ReqIF10Package; /** * <!-- begin-user-doc --> An implementation of the model object '<em><b>Attribute Definition String</b></em>'. <!-- * end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.rmf.reqif10.impl.AttributeDefinitionStringImpl#getType <em>Type</em>}</li> * <li>{@link org.eclipse.rmf.reqif10.impl.AttributeDefinitionStringImpl#getDefaultValue <em>Default Value</em>}</li> * </ul> * </p> * * @generated */ public class AttributeDefinitionStringImpl extends AttributeDefinitionSimpleImpl implements AttributeDefinitionString { /** * The cached value of the '{@link #getType() <em>Type</em>}' reference. <!-- begin-user-doc --> <!-- end-user-doc * --> * * @see #getType() * @generated * @ordered */ protected DatatypeDefinitionString 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 AttributeValueString 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 AttributeDefinitionStringImpl() { super(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override protected EClass eStaticClass() { return ReqIF10Package.Literals.ATTRIBUTE_DEFINITION_STRING; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public DatatypeDefinitionString getType() { if (type != null && type.eIsProxy()) { InternalEObject oldType = (InternalEObject) type; type = (DatatypeDefinitionString) eResolveProxy(oldType); if (type != oldType) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, ReqIF10Package.ATTRIBUTE_DEFINITION_STRING__TYPE, oldType, type)); } } return type; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public DatatypeDefinitionString basicGetType() { return type; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public void setType(DatatypeDefinitionString newType) { DatatypeDefinitionString oldType = type; type = newType; boolean oldTypeESet = typeESet; typeESet = true; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ReqIF10Package.ATTRIBUTE_DEFINITION_STRING__TYPE, oldType, type, !oldTypeESet)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public void unsetType() { DatatypeDefinitionString oldType = type; boolean oldTypeESet = typeESet; type = null; typeESet = false; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.UNSET, ReqIF10Package.ATTRIBUTE_DEFINITION_STRING__TYPE, oldType, null, oldTypeESet)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public boolean isSetType() { return typeESet; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public AttributeValueString getDefaultValue() { return defaultValue; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public NotificationChain basicSetDefaultValue(AttributeValueString newDefaultValue, NotificationChain msgs) { AttributeValueString oldDefaultValue = defaultValue; defaultValue = newDefaultValue; boolean oldDefaultValueESet = defaultValueESet; defaultValueESet = true; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ReqIF10Package.ATTRIBUTE_DEFINITION_STRING__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(AttributeValueString newDefaultValue) { if (newDefaultValue != defaultValue) { NotificationChain msgs = null; if (defaultValue != null) msgs = ((InternalEObject) defaultValue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ReqIF10Package.ATTRIBUTE_DEFINITION_STRING__DEFAULT_VALUE, null, msgs); if (newDefaultValue != null) msgs = ((InternalEObject) newDefaultValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ReqIF10Package.ATTRIBUTE_DEFINITION_STRING__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_STRING__DEFAULT_VALUE, newDefaultValue, newDefaultValue, !oldDefaultValueESet)); } } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public NotificationChain basicUnsetDefaultValue(NotificationChain msgs) { AttributeValueString oldDefaultValue = defaultValue; defaultValue = null; boolean oldDefaultValueESet = defaultValueESet; defaultValueESet = false; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, ReqIF10Package.ATTRIBUTE_DEFINITION_STRING__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_STRING__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_STRING__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_STRING__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_STRING__TYPE: if (resolve) return getType(); return basicGetType(); case ReqIF10Package.ATTRIBUTE_DEFINITION_STRING__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_STRING__TYPE: setType((DatatypeDefinitionString) newValue); return; case ReqIF10Package.ATTRIBUTE_DEFINITION_STRING__DEFAULT_VALUE: setDefaultValue((AttributeValueString) 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_STRING__TYPE: unsetType(); return; case ReqIF10Package.ATTRIBUTE_DEFINITION_STRING__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_STRING__TYPE: return isSetType(); case ReqIF10Package.ATTRIBUTE_DEFINITION_STRING__DEFAULT_VALUE: return isSetDefaultValue(); } return super.eIsSet(featureID); } } // AttributeDefinitionStringImpl