/***************************************************************************** * 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.ClassificationExpression; import org.eclipse.papyrus.uml.alf.alf.NameExpression; import org.eclipse.papyrus.uml.alf.alf.RelationalExpression; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Classification Expression</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.ClassificationExpressionImpl#getExp <em>Exp</em>}</li> * <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.ClassificationExpressionImpl#getOp <em>Op</em>}</li> * <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.ClassificationExpressionImpl#getTypeName <em>Type Name</em>}</li> * </ul> * </p> * * @generated */ public class ClassificationExpressionImpl extends MinimalEObjectImpl.Container implements ClassificationExpression { /** * The cached value of the '{@link #getExp() <em>Exp</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getExp() * @generated * @ordered */ protected RelationalExpression exp; /** * The default value of the '{@link #getOp() <em>Op</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getOp() * @generated * @ordered */ protected static final String OP_EDEFAULT = null; /** * The cached value of the '{@link #getOp() <em>Op</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getOp() * @generated * @ordered */ protected String op = OP_EDEFAULT; /** * The cached value of the '{@link #getTypeName() <em>Type Name</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTypeName() * @generated * @ordered */ protected NameExpression typeName; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ClassificationExpressionImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return AlfPackage.Literals.CLASSIFICATION_EXPRESSION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public RelationalExpression getExp() { return exp; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetExp(RelationalExpression newExp, NotificationChain msgs) { RelationalExpression oldExp = exp; exp = newExp; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AlfPackage.CLASSIFICATION_EXPRESSION__EXP, oldExp, newExp); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setExp(RelationalExpression newExp) { if (newExp != exp) { NotificationChain msgs = null; if (exp != null) msgs = ((InternalEObject)exp).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AlfPackage.CLASSIFICATION_EXPRESSION__EXP, null, msgs); if (newExp != null) msgs = ((InternalEObject)newExp).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AlfPackage.CLASSIFICATION_EXPRESSION__EXP, null, msgs); msgs = basicSetExp(newExp, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AlfPackage.CLASSIFICATION_EXPRESSION__EXP, newExp, newExp)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getOp() { return op; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setOp(String newOp) { String oldOp = op; op = newOp; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AlfPackage.CLASSIFICATION_EXPRESSION__OP, oldOp, op)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NameExpression getTypeName() { return typeName; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetTypeName(NameExpression newTypeName, NotificationChain msgs) { NameExpression oldTypeName = typeName; typeName = newTypeName; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AlfPackage.CLASSIFICATION_EXPRESSION__TYPE_NAME, oldTypeName, newTypeName); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setTypeName(NameExpression newTypeName) { if (newTypeName != typeName) { NotificationChain msgs = null; if (typeName != null) msgs = ((InternalEObject)typeName).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AlfPackage.CLASSIFICATION_EXPRESSION__TYPE_NAME, null, msgs); if (newTypeName != null) msgs = ((InternalEObject)newTypeName).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AlfPackage.CLASSIFICATION_EXPRESSION__TYPE_NAME, null, msgs); msgs = basicSetTypeName(newTypeName, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AlfPackage.CLASSIFICATION_EXPRESSION__TYPE_NAME, newTypeName, newTypeName)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case AlfPackage.CLASSIFICATION_EXPRESSION__EXP: return basicSetExp(null, msgs); case AlfPackage.CLASSIFICATION_EXPRESSION__TYPE_NAME: return basicSetTypeName(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.CLASSIFICATION_EXPRESSION__EXP: return getExp(); case AlfPackage.CLASSIFICATION_EXPRESSION__OP: return getOp(); case AlfPackage.CLASSIFICATION_EXPRESSION__TYPE_NAME: return getTypeName(); } 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.CLASSIFICATION_EXPRESSION__EXP: setExp((RelationalExpression)newValue); return; case AlfPackage.CLASSIFICATION_EXPRESSION__OP: setOp((String)newValue); return; case AlfPackage.CLASSIFICATION_EXPRESSION__TYPE_NAME: setTypeName((NameExpression)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case AlfPackage.CLASSIFICATION_EXPRESSION__EXP: setExp((RelationalExpression)null); return; case AlfPackage.CLASSIFICATION_EXPRESSION__OP: setOp(OP_EDEFAULT); return; case AlfPackage.CLASSIFICATION_EXPRESSION__TYPE_NAME: setTypeName((NameExpression)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case AlfPackage.CLASSIFICATION_EXPRESSION__EXP: return exp != null; case AlfPackage.CLASSIFICATION_EXPRESSION__OP: return OP_EDEFAULT == null ? op != null : !OP_EDEFAULT.equals(op); case AlfPackage.CLASSIFICATION_EXPRESSION__TYPE_NAME: return typeName != 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(" (op: "); result.append(op); result.append(')'); return result.toString(); } } //ClassificationExpressionImpl