/** */ package org.xtest.xTest.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.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.xtext.xbase.XExpression; import org.xtest.xTest.UniqueName; import org.xtest.xTest.XTestPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Unique Name</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.xtest.xTest.impl.UniqueNameImpl#getName <em>Name</em>}</li> * <li>{@link org.xtest.xTest.impl.UniqueNameImpl#getIdentifier <em>Identifier</em>}</li> * </ul> * </p> * * @generated */ public class UniqueNameImpl extends MinimalEObjectImpl.Container implements UniqueName { /** * The default value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The cached value of the '{@link #getIdentifier() <em>Identifier</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getIdentifier() * @generated * @ordered */ protected XExpression identifier; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected UniqueNameImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return XTestPackage.Literals.UNIQUE_NAME; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, XTestPackage.UNIQUE_NAME__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public XExpression getIdentifier() { return identifier; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetIdentifier(XExpression newIdentifier, NotificationChain msgs) { XExpression oldIdentifier = identifier; identifier = newIdentifier; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XTestPackage.UNIQUE_NAME__IDENTIFIER, oldIdentifier, newIdentifier); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setIdentifier(XExpression newIdentifier) { if (newIdentifier != identifier) { NotificationChain msgs = null; if (identifier != null) msgs = ((InternalEObject)identifier).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XTestPackage.UNIQUE_NAME__IDENTIFIER, null, msgs); if (newIdentifier != null) msgs = ((InternalEObject)newIdentifier).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XTestPackage.UNIQUE_NAME__IDENTIFIER, null, msgs); msgs = basicSetIdentifier(newIdentifier, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, XTestPackage.UNIQUE_NAME__IDENTIFIER, newIdentifier, newIdentifier)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case XTestPackage.UNIQUE_NAME__IDENTIFIER: return basicSetIdentifier(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 XTestPackage.UNIQUE_NAME__NAME: return getName(); case XTestPackage.UNIQUE_NAME__IDENTIFIER: return getIdentifier(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case XTestPackage.UNIQUE_NAME__NAME: setName((String)newValue); return; case XTestPackage.UNIQUE_NAME__IDENTIFIER: setIdentifier((XExpression)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case XTestPackage.UNIQUE_NAME__NAME: setName(NAME_EDEFAULT); return; case XTestPackage.UNIQUE_NAME__IDENTIFIER: setIdentifier((XExpression)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case XTestPackage.UNIQUE_NAME__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case XTestPackage.UNIQUE_NAME__IDENTIFIER: return identifier != null; } 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(" (name: "); result.append(name); result.append(')'); return result.toString(); } } //UniqueNameImpl