| /** |
| * Copyright (c) 2016 Willink Transformations, Univesity of York and others. |
| * 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: |
| * Adolfo Sanchez-Barbudo Herrera - initial API and implementation |
| */ |
| package delphi.impl; |
| |
| import delphi.DelphiPackage; |
| import delphi.expression; |
| import delphi.relExp; |
| import delphi.relOp; |
| import delphi.simpleExpression; |
| |
| 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; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>rel Exp</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link delphi.impl.relExpImpl#getLeft <em>Left</em>}</li> |
| * <li>{@link delphi.impl.relExpImpl#getRelOp <em>Rel Op</em>}</li> |
| * <li>{@link delphi.impl.relExpImpl#getRight <em>Right</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class relExpImpl extends expressionImpl implements relExp { |
| /** |
| * The cached value of the '{@link #getLeft() <em>Left</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getLeft() |
| * @generated |
| * @ordered |
| */ |
| protected expression left; |
| |
| /** |
| * The cached value of the '{@link #getRelOp() <em>Rel Op</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRelOp() |
| * @generated |
| * @ordered |
| */ |
| protected relOp relOp; |
| |
| /** |
| * The cached value of the '{@link #getRight() <em>Right</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRight() |
| * @generated |
| * @ordered |
| */ |
| protected simpleExpression right; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected relExpImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return DelphiPackage.Literals.REL_EXP; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public expression getLeft() { |
| return left; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetLeft(expression newLeft, NotificationChain msgs) { |
| expression oldLeft = left; |
| left = newLeft; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DelphiPackage.REL_EXP__LEFT, oldLeft, newLeft); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setLeft(expression newLeft) { |
| if (newLeft != left) { |
| NotificationChain msgs = null; |
| if (left != null) |
| msgs = ((InternalEObject)left).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DelphiPackage.REL_EXP__LEFT, null, msgs); |
| if (newLeft != null) |
| msgs = ((InternalEObject)newLeft).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DelphiPackage.REL_EXP__LEFT, null, msgs); |
| msgs = basicSetLeft(newLeft, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DelphiPackage.REL_EXP__LEFT, newLeft, newLeft)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public relOp getRelOp() { |
| return relOp; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetRelOp(relOp newRelOp, NotificationChain msgs) { |
| relOp oldRelOp = relOp; |
| relOp = newRelOp; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DelphiPackage.REL_EXP__REL_OP, oldRelOp, newRelOp); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setRelOp(relOp newRelOp) { |
| if (newRelOp != relOp) { |
| NotificationChain msgs = null; |
| if (relOp != null) |
| msgs = ((InternalEObject)relOp).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DelphiPackage.REL_EXP__REL_OP, null, msgs); |
| if (newRelOp != null) |
| msgs = ((InternalEObject)newRelOp).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DelphiPackage.REL_EXP__REL_OP, null, msgs); |
| msgs = basicSetRelOp(newRelOp, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DelphiPackage.REL_EXP__REL_OP, newRelOp, newRelOp)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public simpleExpression getRight() { |
| return right; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetRight(simpleExpression newRight, NotificationChain msgs) { |
| simpleExpression oldRight = right; |
| right = newRight; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DelphiPackage.REL_EXP__RIGHT, oldRight, newRight); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setRight(simpleExpression newRight) { |
| if (newRight != right) { |
| NotificationChain msgs = null; |
| if (right != null) |
| msgs = ((InternalEObject)right).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DelphiPackage.REL_EXP__RIGHT, null, msgs); |
| if (newRight != null) |
| msgs = ((InternalEObject)newRight).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DelphiPackage.REL_EXP__RIGHT, null, msgs); |
| msgs = basicSetRight(newRight, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DelphiPackage.REL_EXP__RIGHT, newRight, newRight)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case DelphiPackage.REL_EXP__LEFT: |
| return basicSetLeft(null, msgs); |
| case DelphiPackage.REL_EXP__REL_OP: |
| return basicSetRelOp(null, msgs); |
| case DelphiPackage.REL_EXP__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 DelphiPackage.REL_EXP__LEFT: |
| return getLeft(); |
| case DelphiPackage.REL_EXP__REL_OP: |
| return getRelOp(); |
| case DelphiPackage.REL_EXP__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 DelphiPackage.REL_EXP__LEFT: |
| setLeft((expression)newValue); |
| return; |
| case DelphiPackage.REL_EXP__REL_OP: |
| setRelOp((relOp)newValue); |
| return; |
| case DelphiPackage.REL_EXP__RIGHT: |
| setRight((simpleExpression)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case DelphiPackage.REL_EXP__LEFT: |
| setLeft((expression)null); |
| return; |
| case DelphiPackage.REL_EXP__REL_OP: |
| setRelOp((relOp)null); |
| return; |
| case DelphiPackage.REL_EXP__RIGHT: |
| setRight((simpleExpression)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case DelphiPackage.REL_EXP__LEFT: |
| return left != null; |
| case DelphiPackage.REL_EXP__REL_OP: |
| return relOp != null; |
| case DelphiPackage.REL_EXP__RIGHT: |
| return right != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| |
| } //relExpImpl |