/**
* <copyright>
* </copyright>
*
* $Id$
*/
package com.sap.furcas.metamodel.FURCAS.TCS.impl;
import com.sap.furcas.metamodel.FURCAS.TCS.Block;
import com.sap.furcas.metamodel.FURCAS.TCS.BlockArg;
import com.sap.furcas.metamodel.FURCAS.TCS.TCSPackage;
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.EObjectImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Block Arg</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link com.sap.furcas.metamodel.FURCAS.TCS.impl.BlockArgImpl#getBlock <em>Block</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public abstract class BlockArgImpl extends EObjectImpl implements BlockArg {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected BlockArgImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return TCSPackage.Literals.BLOCK_ARG;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Block getBlock() {
if (eContainerFeatureID() != TCSPackage.BLOCK_ARG__BLOCK) return null;
return (Block)eContainer();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetBlock(Block newBlock, NotificationChain msgs) {
msgs = eBasicSetContainer((InternalEObject)newBlock, TCSPackage.BLOCK_ARG__BLOCK, msgs);
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBlock(Block newBlock) {
if (newBlock != eInternalContainer() || (eContainerFeatureID() != TCSPackage.BLOCK_ARG__BLOCK && newBlock != null)) {
if (EcoreUtil.isAncestor(this, newBlock))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newBlock != null)
msgs = ((InternalEObject)newBlock).eInverseAdd(this, TCSPackage.BLOCK__BLOCK_ARGS, Block.class, msgs);
msgs = basicSetBlock(newBlock, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TCSPackage.BLOCK_ARG__BLOCK, newBlock, newBlock));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case TCSPackage.BLOCK_ARG__BLOCK:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetBlock((Block)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 TCSPackage.BLOCK_ARG__BLOCK:
return basicSetBlock(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
switch (eContainerFeatureID()) {
case TCSPackage.BLOCK_ARG__BLOCK:
return eInternalContainer().eInverseRemove(this, TCSPackage.BLOCK__BLOCK_ARGS, Block.class, msgs);
}
return super.eBasicRemoveFromContainerFeature(msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case TCSPackage.BLOCK_ARG__BLOCK:
return getBlock();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case TCSPackage.BLOCK_ARG__BLOCK:
setBlock((Block)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case TCSPackage.BLOCK_ARG__BLOCK:
setBlock((Block)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case TCSPackage.BLOCK_ARG__BLOCK:
return getBlock() != null;
}
return super.eIsSet(featureID);
}
} //BlockArgImpl