/***************************************************************************** * 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.papyrus.uml.alf.alf.AlfPackage; import org.eclipse.papyrus.uml.alf.alf.AnnotatedStatement; import org.eclipse.papyrus.uml.alf.alf.Annotation; import org.eclipse.papyrus.uml.alf.alf.Statement; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Annotated Statement</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.AnnotatedStatementImpl#getAnnotation <em>Annotation</em>}</li> * <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.AnnotatedStatementImpl#getStatement <em>Statement</em>}</li> * </ul> * </p> * * @generated */ public class AnnotatedStatementImpl extends StatementImpl implements AnnotatedStatement { /** * The cached value of the '{@link #getAnnotation() <em>Annotation</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getAnnotation() * @generated * @ordered */ protected Annotation annotation; /** * The cached value of the '{@link #getStatement() <em>Statement</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getStatement() * @generated * @ordered */ protected Statement statement; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected AnnotatedStatementImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return AlfPackage.Literals.ANNOTATED_STATEMENT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Annotation getAnnotation() { return annotation; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetAnnotation(Annotation newAnnotation, NotificationChain msgs) { Annotation oldAnnotation = annotation; annotation = newAnnotation; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AlfPackage.ANNOTATED_STATEMENT__ANNOTATION, oldAnnotation, newAnnotation); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setAnnotation(Annotation newAnnotation) { if (newAnnotation != annotation) { NotificationChain msgs = null; if (annotation != null) msgs = ((InternalEObject)annotation).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AlfPackage.ANNOTATED_STATEMENT__ANNOTATION, null, msgs); if (newAnnotation != null) msgs = ((InternalEObject)newAnnotation).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AlfPackage.ANNOTATED_STATEMENT__ANNOTATION, null, msgs); msgs = basicSetAnnotation(newAnnotation, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AlfPackage.ANNOTATED_STATEMENT__ANNOTATION, newAnnotation, newAnnotation)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Statement getStatement() { return statement; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetStatement(Statement newStatement, NotificationChain msgs) { Statement oldStatement = statement; statement = newStatement; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AlfPackage.ANNOTATED_STATEMENT__STATEMENT, oldStatement, newStatement); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setStatement(Statement newStatement) { if (newStatement != statement) { NotificationChain msgs = null; if (statement != null) msgs = ((InternalEObject)statement).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AlfPackage.ANNOTATED_STATEMENT__STATEMENT, null, msgs); if (newStatement != null) msgs = ((InternalEObject)newStatement).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AlfPackage.ANNOTATED_STATEMENT__STATEMENT, null, msgs); msgs = basicSetStatement(newStatement, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AlfPackage.ANNOTATED_STATEMENT__STATEMENT, newStatement, newStatement)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case AlfPackage.ANNOTATED_STATEMENT__ANNOTATION: return basicSetAnnotation(null, msgs); case AlfPackage.ANNOTATED_STATEMENT__STATEMENT: return basicSetStatement(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.ANNOTATED_STATEMENT__ANNOTATION: return getAnnotation(); case AlfPackage.ANNOTATED_STATEMENT__STATEMENT: return getStatement(); } 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.ANNOTATED_STATEMENT__ANNOTATION: setAnnotation((Annotation)newValue); return; case AlfPackage.ANNOTATED_STATEMENT__STATEMENT: setStatement((Statement)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case AlfPackage.ANNOTATED_STATEMENT__ANNOTATION: setAnnotation((Annotation)null); return; case AlfPackage.ANNOTATED_STATEMENT__STATEMENT: setStatement((Statement)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case AlfPackage.ANNOTATED_STATEMENT__ANNOTATION: return annotation != null; case AlfPackage.ANNOTATED_STATEMENT__STATEMENT: return statement != null; } return super.eIsSet(featureID); } } //AnnotatedStatementImpl