/***************************************************************************** * 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.RelationalExpression; import org.eclipse.papyrus.uml.alf.alf.ShiftExpression; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Relational Expression</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.RelationalExpressionImpl#getLeft <em>Left</em>}</li> * <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.RelationalExpressionImpl#getOp <em>Op</em>}</li> * <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.RelationalExpressionImpl#getRight <em>Right</em>}</li> * </ul> * </p> * * @generated */ public class RelationalExpressionImpl extends MinimalEObjectImpl.Container implements RelationalExpression { /** * The cached value of the '{@link #getLeft() <em>Left</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getLeft() * @generated * @ordered */ protected ShiftExpression left; /** * 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 #getRight() <em>Right</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getRight() * @generated * @ordered */ protected ShiftExpression right; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected RelationalExpressionImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return AlfPackage.Literals.RELATIONAL_EXPRESSION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ShiftExpression getLeft() { return left; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetLeft(ShiftExpression newLeft, NotificationChain msgs) { ShiftExpression oldLeft = left; left = newLeft; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AlfPackage.RELATIONAL_EXPRESSION__LEFT, oldLeft, newLeft); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setLeft(ShiftExpression newLeft) { if (newLeft != left) { NotificationChain msgs = null; if (left != null) msgs = ((InternalEObject)left).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AlfPackage.RELATIONAL_EXPRESSION__LEFT, null, msgs); if (newLeft != null) msgs = ((InternalEObject)newLeft).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AlfPackage.RELATIONAL_EXPRESSION__LEFT, null, msgs); msgs = basicSetLeft(newLeft, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AlfPackage.RELATIONAL_EXPRESSION__LEFT, newLeft, newLeft)); } /** * <!-- 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.RELATIONAL_EXPRESSION__OP, oldOp, op)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ShiftExpression getRight() { return right; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetRight(ShiftExpression newRight, NotificationChain msgs) { ShiftExpression oldRight = right; right = newRight; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AlfPackage.RELATIONAL_EXPRESSION__RIGHT, oldRight, newRight); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setRight(ShiftExpression newRight) { if (newRight != right) { NotificationChain msgs = null; if (right != null) msgs = ((InternalEObject)right).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AlfPackage.RELATIONAL_EXPRESSION__RIGHT, null, msgs); if (newRight != null) msgs = ((InternalEObject)newRight).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AlfPackage.RELATIONAL_EXPRESSION__RIGHT, null, msgs); msgs = basicSetRight(newRight, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AlfPackage.RELATIONAL_EXPRESSION__RIGHT, newRight, newRight)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case AlfPackage.RELATIONAL_EXPRESSION__LEFT: return basicSetLeft(null, msgs); case AlfPackage.RELATIONAL_EXPRESSION__RIGHT: return basicSetRight(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.RELATIONAL_EXPRESSION__LEFT: return getLeft(); case AlfPackage.RELATIONAL_EXPRESSION__OP: return getOp(); case AlfPackage.RELATIONAL_EXPRESSION__RIGHT: return getRight(); } 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.RELATIONAL_EXPRESSION__LEFT: setLeft((ShiftExpression)newValue); return; case AlfPackage.RELATIONAL_EXPRESSION__OP: setOp((String)newValue); return; case AlfPackage.RELATIONAL_EXPRESSION__RIGHT: setRight((ShiftExpression)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case AlfPackage.RELATIONAL_EXPRESSION__LEFT: setLeft((ShiftExpression)null); return; case AlfPackage.RELATIONAL_EXPRESSION__OP: setOp(OP_EDEFAULT); return; case AlfPackage.RELATIONAL_EXPRESSION__RIGHT: setRight((ShiftExpression)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case AlfPackage.RELATIONAL_EXPRESSION__LEFT: return left != null; case AlfPackage.RELATIONAL_EXPRESSION__OP: return OP_EDEFAULT == null ? op != null : !OP_EDEFAULT.equals(op); case AlfPackage.RELATIONAL_EXPRESSION__RIGHT: return right != 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(); } } //RelationalExpressionImpl