/**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.eclipse.buckminster.cspec.impl;
import org.eclipse.buckminster.cspec.Action;
import org.eclipse.buckminster.cspec.ActionAttribute;
import org.eclipse.buckminster.cspec.CspecPackage;
import org.eclipse.buckminster.cspec.IContext;
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;
/**
* <!-- begin-user-doc --> An implementation of the model object '
* <em><b>Action Attribute</b></em>'. <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.buckminster.cspec.impl.ActionAttributeImpl#getAlias
* <em>Alias</em>}</li>
* <li>{@link org.eclipse.buckminster.cspec.impl.ActionAttributeImpl#getAction
* <em>Action</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ActionAttributeImpl extends ArtifactImpl implements ActionAttribute {
/**
* The default value of the '{@link #getAlias() <em>Alias</em>}' attribute.
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #getAlias()
* @generated
* @ordered
*/
protected static final String ALIAS_EDEFAULT = null;
/**
* The cached value of the '{@link #getAlias() <em>Alias</em>}' attribute.
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #getAlias()
* @generated
* @ordered
*/
protected String alias = ALIAS_EDEFAULT;
/**
* The cached value of the '{@link #getAction() <em>Action</em>}' reference.
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #getAction()
* @generated
* @ordered
*/
protected Action action;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected ActionAttributeImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public Action basicGetAction() {
return action;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public NotificationChain basicSetAction(Action newAction, NotificationChain msgs) {
Action oldAction = action;
action = newAction;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CspecPackage.ACTION_ATTRIBUTE__ACTION, oldAction,
newAction);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case CspecPackage.ACTION_ATTRIBUTE__ALIAS:
return getAlias();
case CspecPackage.ACTION_ATTRIBUTE__ACTION:
if (resolve)
return getAction();
return basicGetAction();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case CspecPackage.ACTION_ATTRIBUTE__ACTION:
if (action != null)
msgs = ((InternalEObject) action).eInverseRemove(this, CspecPackage.ACTION__PRODUCTS, Action.class, msgs);
return basicSetAction((Action) otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case CspecPackage.ACTION_ATTRIBUTE__ACTION:
return basicSetAction(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case CspecPackage.ACTION_ATTRIBUTE__ALIAS:
return ALIAS_EDEFAULT == null ? alias != null : !ALIAS_EDEFAULT.equals(alias);
case CspecPackage.ACTION_ATTRIBUTE__ACTION:
return action != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case CspecPackage.ACTION_ATTRIBUTE__ALIAS:
setAlias((String) newValue);
return;
case CspecPackage.ACTION_ATTRIBUTE__ACTION:
setAction((Action) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case CspecPackage.ACTION_ATTRIBUTE__ALIAS:
setAlias(ALIAS_EDEFAULT);
return;
case CspecPackage.ACTION_ATTRIBUTE__ACTION:
setAction((Action) null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public Action getAction() {
if (action != null && action.eIsProxy()) {
InternalEObject oldAction = (InternalEObject) action;
action = (Action) eResolveProxy(oldAction);
if (action != oldAction) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, CspecPackage.ACTION_ATTRIBUTE__ACTION, oldAction, action));
}
}
return action;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public String getAlias() {
return alias;
}
@Override
public boolean isDerived(IContext context) {
return true;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setAction(Action newAction) {
if (newAction != action) {
NotificationChain msgs = null;
if (action != null)
msgs = ((InternalEObject) action).eInverseRemove(this, CspecPackage.ACTION__PRODUCTS, Action.class, msgs);
if (newAction != null)
msgs = ((InternalEObject) newAction).eInverseAdd(this, CspecPackage.ACTION__PRODUCTS, Action.class, msgs);
msgs = basicSetAction(newAction, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CspecPackage.ACTION_ATTRIBUTE__ACTION, newAction, newAction));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setAlias(String newAlias) {
String oldAlias = alias;
alias = newAlias;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CspecPackage.ACTION_ATTRIBUTE__ALIAS, oldAlias, alias));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy())
return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (alias: ");
result.append(alias);
result.append(')');
return result.toString();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return CspecPackage.Literals.ACTION_ATTRIBUTE;
}
} // ActionAttributeImpl