/***************************************************************************** * 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.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.papyrus.uml.alf.alf.AlfPackage; import org.eclipse.papyrus.uml.alf.alf.DocumentedStatement; import org.eclipse.papyrus.uml.alf.alf.Statement; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Documented Statement</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.DocumentedStatementImpl#getComment <em>Comment</em>}</li> * <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.DocumentedStatementImpl#getStatement <em>Statement</em>}</li> * </ul> * </p> * * @generated */ public class DocumentedStatementImpl extends MinimalEObjectImpl.Container implements DocumentedStatement { /** * The default value of the '{@link #getComment() <em>Comment</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getComment() * @generated * @ordered */ protected static final String COMMENT_EDEFAULT = null; /** * The cached value of the '{@link #getComment() <em>Comment</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getComment() * @generated * @ordered */ protected String comment = COMMENT_EDEFAULT; /** * 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 DocumentedStatementImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return AlfPackage.Literals.DOCUMENTED_STATEMENT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getComment() { return comment; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setComment(String newComment) { String oldComment = comment; comment = newComment; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AlfPackage.DOCUMENTED_STATEMENT__COMMENT, oldComment, comment)); } /** * <!-- 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.DOCUMENTED_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.DOCUMENTED_STATEMENT__STATEMENT, null, msgs); if (newStatement != null) msgs = ((InternalEObject)newStatement).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AlfPackage.DOCUMENTED_STATEMENT__STATEMENT, null, msgs); msgs = basicSetStatement(newStatement, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AlfPackage.DOCUMENTED_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.DOCUMENTED_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.DOCUMENTED_STATEMENT__COMMENT: return getComment(); case AlfPackage.DOCUMENTED_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.DOCUMENTED_STATEMENT__COMMENT: setComment((String)newValue); return; case AlfPackage.DOCUMENTED_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.DOCUMENTED_STATEMENT__COMMENT: setComment(COMMENT_EDEFAULT); return; case AlfPackage.DOCUMENTED_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.DOCUMENTED_STATEMENT__COMMENT: return COMMENT_EDEFAULT == null ? comment != null : !COMMENT_EDEFAULT.equals(comment); case AlfPackage.DOCUMENTED_STATEMENT__STATEMENT: return statement != null; } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (comment: "); result.append(comment); result.append(')'); return result.toString(); } } //DocumentedStatementImpl