/** * <copyright> * </copyright> * * $Id$ */ package net.sf.etl.samples.ej.ast.impl; import java.util.Collection; import net.sf.etl.samples.ej.ast.AstPackage; import net.sf.etl.samples.ej.ast.ClassStatement; import net.sf.etl.samples.ej.ast.Expression; import net.sf.etl.samples.ej.ast.Modifier; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Class Statement</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link net.sf.etl.samples.ej.ast.impl.ClassStatementImpl#getStaticModifier <em>Static Modifier</em>}</li> * <li>{@link net.sf.etl.samples.ej.ast.impl.ClassStatementImpl#getExtendedType <em>Extended Type</em>}</li> * <li>{@link net.sf.etl.samples.ej.ast.impl.ClassStatementImpl#getImplementedTypes <em>Implemented Types</em>}</li> * </ul> * </p> * * @generated */ public class ClassStatementImpl extends ImplemenationClassifierStatementImpl implements ClassStatement { /** * The cached value of the '{@link #getStaticModifier() <em>Static Modifier</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getStaticModifier() * @generated * @ordered */ protected Modifier staticModifier = null; /** * The cached value of the '{@link #getExtendedType() <em>Extended Type</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getExtendedType() * @generated * @ordered */ protected Expression extendedType = null; /** * The cached value of the '{@link #getImplementedTypes() <em>Implemented Types</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getImplementedTypes() * @generated * @ordered */ protected EList implementedTypes = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ClassStatementImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected EClass eStaticClass() { return AstPackage.Literals.CLASS_STATEMENT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Modifier getStaticModifier() { return staticModifier; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetStaticModifier(Modifier newStaticModifier, NotificationChain msgs) { Modifier oldStaticModifier = staticModifier; staticModifier = newStaticModifier; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AstPackage.CLASS_STATEMENT__STATIC_MODIFIER, oldStaticModifier, newStaticModifier); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setStaticModifier(Modifier newStaticModifier) { if (newStaticModifier != staticModifier) { NotificationChain msgs = null; if (staticModifier != null) msgs = ((InternalEObject)staticModifier).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AstPackage.CLASS_STATEMENT__STATIC_MODIFIER, null, msgs); if (newStaticModifier != null) msgs = ((InternalEObject)newStaticModifier).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstPackage.CLASS_STATEMENT__STATIC_MODIFIER, null, msgs); msgs = basicSetStaticModifier(newStaticModifier, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AstPackage.CLASS_STATEMENT__STATIC_MODIFIER, newStaticModifier, newStaticModifier)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Expression getExtendedType() { return extendedType; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetExtendedType(Expression newExtendedType, NotificationChain msgs) { Expression oldExtendedType = extendedType; extendedType = newExtendedType; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AstPackage.CLASS_STATEMENT__EXTENDED_TYPE, oldExtendedType, newExtendedType); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setExtendedType(Expression newExtendedType) { if (newExtendedType != extendedType) { NotificationChain msgs = null; if (extendedType != null) msgs = ((InternalEObject)extendedType).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AstPackage.CLASS_STATEMENT__EXTENDED_TYPE, null, msgs); if (newExtendedType != null) msgs = ((InternalEObject)newExtendedType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstPackage.CLASS_STATEMENT__EXTENDED_TYPE, null, msgs); msgs = basicSetExtendedType(newExtendedType, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AstPackage.CLASS_STATEMENT__EXTENDED_TYPE, newExtendedType, newExtendedType)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList getImplementedTypes() { if (implementedTypes == null) { implementedTypes = new EObjectContainmentEList(Expression.class, this, AstPackage.CLASS_STATEMENT__IMPLEMENTED_TYPES); } return implementedTypes; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case AstPackage.CLASS_STATEMENT__STATIC_MODIFIER: return basicSetStaticModifier(null, msgs); case AstPackage.CLASS_STATEMENT__EXTENDED_TYPE: return basicSetExtendedType(null, msgs); case AstPackage.CLASS_STATEMENT__IMPLEMENTED_TYPES: return ((InternalEList)getImplementedTypes()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case AstPackage.CLASS_STATEMENT__STATIC_MODIFIER: return getStaticModifier(); case AstPackage.CLASS_STATEMENT__EXTENDED_TYPE: return getExtendedType(); case AstPackage.CLASS_STATEMENT__IMPLEMENTED_TYPES: return getImplementedTypes(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eSet(int featureID, Object newValue) { switch (featureID) { case AstPackage.CLASS_STATEMENT__STATIC_MODIFIER: setStaticModifier((Modifier)newValue); return; case AstPackage.CLASS_STATEMENT__EXTENDED_TYPE: setExtendedType((Expression)newValue); return; case AstPackage.CLASS_STATEMENT__IMPLEMENTED_TYPES: getImplementedTypes().clear(); getImplementedTypes().addAll((Collection)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eUnset(int featureID) { switch (featureID) { case AstPackage.CLASS_STATEMENT__STATIC_MODIFIER: setStaticModifier((Modifier)null); return; case AstPackage.CLASS_STATEMENT__EXTENDED_TYPE: setExtendedType((Expression)null); return; case AstPackage.CLASS_STATEMENT__IMPLEMENTED_TYPES: getImplementedTypes().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean eIsSet(int featureID) { switch (featureID) { case AstPackage.CLASS_STATEMENT__STATIC_MODIFIER: return staticModifier != null; case AstPackage.CLASS_STATEMENT__EXTENDED_TYPE: return extendedType != null; case AstPackage.CLASS_STATEMENT__IMPLEMENTED_TYPES: return implementedTypes != null && !implementedTypes.isEmpty(); } return super.eIsSet(featureID); } } //ClassStatementImpl