/***************************************************************************** * Copyright (c) 2011 CEA LIST. * * * 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: * CEA LIST - Initial API and implementation * *****************************************************************************/ package org.eclipse.papyrus.uml.alf.alf.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.papyrus.uml.alf.alf.AlfPackage; import org.eclipse.papyrus.uml.alf.alf.TemplateBinding; import org.eclipse.papyrus.uml.alf.alf.UnqualifiedName; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Unqualified Name</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.UnqualifiedNameImpl#getName <em>Name</em>}</li> * <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.UnqualifiedNameImpl#getTemplateBinding <em>Template Binding</em>}</li> * </ul> * </p> * * @generated */ public class UnqualifiedNameImpl extends MinimalEObjectImpl.Container implements UnqualifiedName { /** * 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 #getTemplateBinding() <em>Template Binding</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTemplateBinding() * @generated * @ordered */ protected TemplateBinding templateBinding; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected UnqualifiedNameImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return AlfPackage.Literals.UNQUALIFIED_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, AlfPackage.UNQUALIFIED_NAME__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TemplateBinding getTemplateBinding() { return templateBinding; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetTemplateBinding(TemplateBinding newTemplateBinding, NotificationChain msgs) { TemplateBinding oldTemplateBinding = templateBinding; templateBinding = newTemplateBinding; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AlfPackage.UNQUALIFIED_NAME__TEMPLATE_BINDING, oldTemplateBinding, newTemplateBinding); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setTemplateBinding(TemplateBinding newTemplateBinding) { if (newTemplateBinding != templateBinding) { NotificationChain msgs = null; if (templateBinding != null) msgs = ((InternalEObject)templateBinding).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AlfPackage.UNQUALIFIED_NAME__TEMPLATE_BINDING, null, msgs); if (newTemplateBinding != null) msgs = ((InternalEObject)newTemplateBinding).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AlfPackage.UNQUALIFIED_NAME__TEMPLATE_BINDING, null, msgs); msgs = basicSetTemplateBinding(newTemplateBinding, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AlfPackage.UNQUALIFIED_NAME__TEMPLATE_BINDING, newTemplateBinding, newTemplateBinding)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case AlfPackage.UNQUALIFIED_NAME__TEMPLATE_BINDING: return basicSetTemplateBinding(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 AlfPackage.UNQUALIFIED_NAME__NAME: return getName(); case AlfPackage.UNQUALIFIED_NAME__TEMPLATE_BINDING: return getTemplateBinding(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case AlfPackage.UNQUALIFIED_NAME__NAME: setName((String)newValue); return; case AlfPackage.UNQUALIFIED_NAME__TEMPLATE_BINDING: setTemplateBinding((TemplateBinding)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case AlfPackage.UNQUALIFIED_NAME__NAME: setName(NAME_EDEFAULT); return; case AlfPackage.UNQUALIFIED_NAME__TEMPLATE_BINDING: setTemplateBinding((TemplateBinding)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case AlfPackage.UNQUALIFIED_NAME__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case AlfPackage.UNQUALIFIED_NAME__TEMPLATE_BINDING: return templateBinding != 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(); } } //UnqualifiedNameImpl