| /** |
| * 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.assignmentStmnt; |
| import delphi.designator; |
| import delphi.expression; |
| |
| 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>assignment Stmnt</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link delphi.impl.assignmentStmntImpl#getDesignator <em>Designator</em>}</li> |
| * <li>{@link delphi.impl.assignmentStmntImpl#getOperator <em>Operator</em>}</li> |
| * <li>{@link delphi.impl.assignmentStmntImpl#getExp <em>Exp</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class assignmentStmntImpl extends simpleStatementImpl implements assignmentStmnt { |
| /** |
| * The cached value of the '{@link #getDesignator() <em>Designator</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDesignator() |
| * @generated |
| * @ordered |
| */ |
| protected designator designator; |
| |
| /** |
| * The default value of the '{@link #getOperator() <em>Operator</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOperator() |
| * @generated |
| * @ordered |
| */ |
| protected static final String OPERATOR_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getOperator() <em>Operator</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOperator() |
| * @generated |
| * @ordered |
| */ |
| protected String operator = OPERATOR_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getExp() <em>Exp</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getExp() |
| * @generated |
| * @ordered |
| */ |
| protected expression exp; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected assignmentStmntImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return DelphiPackage.Literals.ASSIGNMENT_STMNT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public designator getDesignator() { |
| return designator; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetDesignator(designator newDesignator, NotificationChain msgs) { |
| designator oldDesignator = designator; |
| designator = newDesignator; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DelphiPackage.ASSIGNMENT_STMNT__DESIGNATOR, oldDesignator, newDesignator); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setDesignator(designator newDesignator) { |
| if (newDesignator != designator) { |
| NotificationChain msgs = null; |
| if (designator != null) |
| msgs = ((InternalEObject)designator).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DelphiPackage.ASSIGNMENT_STMNT__DESIGNATOR, null, msgs); |
| if (newDesignator != null) |
| msgs = ((InternalEObject)newDesignator).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DelphiPackage.ASSIGNMENT_STMNT__DESIGNATOR, null, msgs); |
| msgs = basicSetDesignator(newDesignator, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DelphiPackage.ASSIGNMENT_STMNT__DESIGNATOR, newDesignator, newDesignator)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getOperator() { |
| return operator; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setOperator(String newOperator) { |
| String oldOperator = operator; |
| operator = newOperator; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DelphiPackage.ASSIGNMENT_STMNT__OPERATOR, oldOperator, operator)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public expression getExp() { |
| return exp; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetExp(expression newExp, NotificationChain msgs) { |
| expression oldExp = exp; |
| exp = newExp; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DelphiPackage.ASSIGNMENT_STMNT__EXP, oldExp, newExp); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setExp(expression newExp) { |
| if (newExp != exp) { |
| NotificationChain msgs = null; |
| if (exp != null) |
| msgs = ((InternalEObject)exp).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DelphiPackage.ASSIGNMENT_STMNT__EXP, null, msgs); |
| if (newExp != null) |
| msgs = ((InternalEObject)newExp).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DelphiPackage.ASSIGNMENT_STMNT__EXP, null, msgs); |
| msgs = basicSetExp(newExp, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DelphiPackage.ASSIGNMENT_STMNT__EXP, newExp, newExp)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case DelphiPackage.ASSIGNMENT_STMNT__DESIGNATOR: |
| return basicSetDesignator(null, msgs); |
| case DelphiPackage.ASSIGNMENT_STMNT__EXP: |
| return basicSetExp(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.ASSIGNMENT_STMNT__DESIGNATOR: |
| return getDesignator(); |
| case DelphiPackage.ASSIGNMENT_STMNT__OPERATOR: |
| return getOperator(); |
| case DelphiPackage.ASSIGNMENT_STMNT__EXP: |
| return getExp(); |
| } |
| 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.ASSIGNMENT_STMNT__DESIGNATOR: |
| setDesignator((designator)newValue); |
| return; |
| case DelphiPackage.ASSIGNMENT_STMNT__OPERATOR: |
| setOperator((String)newValue); |
| return; |
| case DelphiPackage.ASSIGNMENT_STMNT__EXP: |
| setExp((expression)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case DelphiPackage.ASSIGNMENT_STMNT__DESIGNATOR: |
| setDesignator((designator)null); |
| return; |
| case DelphiPackage.ASSIGNMENT_STMNT__OPERATOR: |
| setOperator(OPERATOR_EDEFAULT); |
| return; |
| case DelphiPackage.ASSIGNMENT_STMNT__EXP: |
| setExp((expression)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case DelphiPackage.ASSIGNMENT_STMNT__DESIGNATOR: |
| return designator != null; |
| case DelphiPackage.ASSIGNMENT_STMNT__OPERATOR: |
| return OPERATOR_EDEFAULT == null ? operator != null : !OPERATOR_EDEFAULT.equals(operator); |
| case DelphiPackage.ASSIGNMENT_STMNT__EXP: |
| return exp != 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(" (operator: "); |
| result.append(operator); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| |
| } //assignmentStmntImpl |