blob: c19a92f505b8771c601ddf967b7257f0f8d067e8 [file] [log] [blame]
/**
* <copyright>
* Copyright (c) 2009, 2010 Open Canarias, S.L.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Adolfo Sanchez-Barbudo Herrera - Initial API and implementation
*
* </copyright>
*/
package org.eclipse.modisco.omg.gastm.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.modisco.omg.gastm.GASTMPackage;
import org.eclipse.modisco.omg.gastm.MacroCall;
import org.eclipse.modisco.omg.gastm.MacroDefinition;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Macro Call</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.modisco.omg.gastm.impl.MacroCallImpl#getRefersTo <em>Refers To</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class MacroCallImpl extends PreprocessorElementImpl implements MacroCall {
/**
* The cached value of the '{@link #getRefersTo() <em>Refers To</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRefersTo()
* @generated
* @ordered
*/
protected MacroDefinition refersTo;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected MacroCallImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return GASTMPackage.eINSTANCE.getMacroCall();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public MacroDefinition getRefersTo() {
return refersTo;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetRefersTo(MacroDefinition newRefersTo, NotificationChain msgs) {
MacroDefinition oldRefersTo = refersTo;
refersTo = newRefersTo;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GASTMPackage.MACRO_CALL__REFERS_TO, oldRefersTo, newRefersTo);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRefersTo(MacroDefinition newRefersTo) {
if (newRefersTo != refersTo) {
NotificationChain msgs = null;
if (refersTo != null)
msgs = ((InternalEObject)refersTo).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GASTMPackage.MACRO_CALL__REFERS_TO, null, msgs);
if (newRefersTo != null)
msgs = ((InternalEObject)newRefersTo).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GASTMPackage.MACRO_CALL__REFERS_TO, null, msgs);
msgs = basicSetRefersTo(newRefersTo, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, GASTMPackage.MACRO_CALL__REFERS_TO, newRefersTo, newRefersTo));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case GASTMPackage.MACRO_CALL__REFERS_TO:
return basicSetRefersTo(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 GASTMPackage.MACRO_CALL__REFERS_TO:
return getRefersTo();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case GASTMPackage.MACRO_CALL__REFERS_TO:
setRefersTo((MacroDefinition)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case GASTMPackage.MACRO_CALL__REFERS_TO:
setRefersTo((MacroDefinition)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case GASTMPackage.MACRO_CALL__REFERS_TO:
return refersTo != null;
}
return super.eIsSet(featureID);
}
} //MacroCallImpl