blob: cd64ea460e8c0efc5f2d56e41a31ac089daac32c [file] [log] [blame]
/**
* Copyright (c) 2020 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\n\nContributors:
* Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr
* - Initial API and Implementation
*/
package org.eclipse.efm.ecore.formalml.expression.impl;
import org.eclipse.efm.ecore.formalml.expression.AssignmentExpression;
import org.eclipse.efm.ecore.formalml.expression.Expression;
import org.eclipse.efm.ecore.formalml.expression.ExpressionPackage;
import org.eclipse.efm.ecore.formalml.expression.LeftHandSideExpression;
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 Expression</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.efm.ecore.formalml.expression.impl.AssignmentExpressionImpl#getOperator <em>Operator</em>}</li>
* <li>{@link org.eclipse.efm.ecore.formalml.expression.impl.AssignmentExpressionImpl#getLeftHandSide <em>Left Hand Side</em>}</li>
* <li>{@link org.eclipse.efm.ecore.formalml.expression.impl.AssignmentExpressionImpl#getRightHandSide <em>Right Hand Side</em>}</li>
* </ul>
*
* @generated
*/
public class AssignmentExpressionImpl extends ExpressionImpl implements AssignmentExpression {
/**
* 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 #getLeftHandSide() <em>Left Hand Side</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLeftHandSide()
* @generated
* @ordered
*/
protected LeftHandSideExpression leftHandSide;
/**
* The cached value of the '{@link #getRightHandSide() <em>Right Hand Side</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRightHandSide()
* @generated
* @ordered
*/
protected Expression rightHandSide;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected AssignmentExpressionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ExpressionPackage.Literals.ASSIGNMENT_EXPRESSION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getOperator() {
return operator;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setOperator(String newOperator) {
String oldOperator = operator;
operator = newOperator;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ExpressionPackage.ASSIGNMENT_EXPRESSION__OPERATOR, oldOperator, operator));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public LeftHandSideExpression getLeftHandSide() {
return leftHandSide;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetLeftHandSide(LeftHandSideExpression newLeftHandSide, NotificationChain msgs) {
LeftHandSideExpression oldLeftHandSide = leftHandSide;
leftHandSide = newLeftHandSide;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ExpressionPackage.ASSIGNMENT_EXPRESSION__LEFT_HAND_SIDE, oldLeftHandSide, newLeftHandSide);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setLeftHandSide(LeftHandSideExpression newLeftHandSide) {
if (newLeftHandSide != leftHandSide) {
NotificationChain msgs = null;
if (leftHandSide != null)
msgs = ((InternalEObject)leftHandSide).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ExpressionPackage.ASSIGNMENT_EXPRESSION__LEFT_HAND_SIDE, null, msgs);
if (newLeftHandSide != null)
msgs = ((InternalEObject)newLeftHandSide).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ExpressionPackage.ASSIGNMENT_EXPRESSION__LEFT_HAND_SIDE, null, msgs);
msgs = basicSetLeftHandSide(newLeftHandSide, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ExpressionPackage.ASSIGNMENT_EXPRESSION__LEFT_HAND_SIDE, newLeftHandSide, newLeftHandSide));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Expression getRightHandSide() {
return rightHandSide;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetRightHandSide(Expression newRightHandSide, NotificationChain msgs) {
Expression oldRightHandSide = rightHandSide;
rightHandSide = newRightHandSide;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ExpressionPackage.ASSIGNMENT_EXPRESSION__RIGHT_HAND_SIDE, oldRightHandSide, newRightHandSide);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setRightHandSide(Expression newRightHandSide) {
if (newRightHandSide != rightHandSide) {
NotificationChain msgs = null;
if (rightHandSide != null)
msgs = ((InternalEObject)rightHandSide).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ExpressionPackage.ASSIGNMENT_EXPRESSION__RIGHT_HAND_SIDE, null, msgs);
if (newRightHandSide != null)
msgs = ((InternalEObject)newRightHandSide).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ExpressionPackage.ASSIGNMENT_EXPRESSION__RIGHT_HAND_SIDE, null, msgs);
msgs = basicSetRightHandSide(newRightHandSide, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ExpressionPackage.ASSIGNMENT_EXPRESSION__RIGHT_HAND_SIDE, newRightHandSide, newRightHandSide));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ExpressionPackage.ASSIGNMENT_EXPRESSION__LEFT_HAND_SIDE:
return basicSetLeftHandSide(null, msgs);
case ExpressionPackage.ASSIGNMENT_EXPRESSION__RIGHT_HAND_SIDE:
return basicSetRightHandSide(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 ExpressionPackage.ASSIGNMENT_EXPRESSION__OPERATOR:
return getOperator();
case ExpressionPackage.ASSIGNMENT_EXPRESSION__LEFT_HAND_SIDE:
return getLeftHandSide();
case ExpressionPackage.ASSIGNMENT_EXPRESSION__RIGHT_HAND_SIDE:
return getRightHandSide();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ExpressionPackage.ASSIGNMENT_EXPRESSION__OPERATOR:
setOperator((String)newValue);
return;
case ExpressionPackage.ASSIGNMENT_EXPRESSION__LEFT_HAND_SIDE:
setLeftHandSide((LeftHandSideExpression)newValue);
return;
case ExpressionPackage.ASSIGNMENT_EXPRESSION__RIGHT_HAND_SIDE:
setRightHandSide((Expression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ExpressionPackage.ASSIGNMENT_EXPRESSION__OPERATOR:
setOperator(OPERATOR_EDEFAULT);
return;
case ExpressionPackage.ASSIGNMENT_EXPRESSION__LEFT_HAND_SIDE:
setLeftHandSide((LeftHandSideExpression)null);
return;
case ExpressionPackage.ASSIGNMENT_EXPRESSION__RIGHT_HAND_SIDE:
setRightHandSide((Expression)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ExpressionPackage.ASSIGNMENT_EXPRESSION__OPERATOR:
return OPERATOR_EDEFAULT == null ? operator != null : !OPERATOR_EDEFAULT.equals(operator);
case ExpressionPackage.ASSIGNMENT_EXPRESSION__LEFT_HAND_SIDE:
return leftHandSide != null;
case ExpressionPackage.ASSIGNMENT_EXPRESSION__RIGHT_HAND_SIDE:
return rightHandSide != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (operator: ");
result.append(operator);
result.append(')');
return result.toString();
}
} //AssignmentExpressionImpl