/** | |
* <copyright> | |
* Copyright (c) 2009, 2010 Open Canarias, S.L. | |
* 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 | |
* | |
* </copyright> | |
*/ | |
package org.eclipse.modisco.omg.gastm.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.modisco.omg.gastm.BinaryExpression; | |
import org.eclipse.modisco.omg.gastm.BinaryOperator; | |
import org.eclipse.modisco.omg.gastm.Expression; | |
import org.eclipse.modisco.omg.gastm.GASTMPackage; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Binary Expression</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* <ul> | |
* <li>{@link org.eclipse.modisco.omg.gastm.impl.BinaryExpressionImpl#getOperator <em>Operator</em>}</li> | |
* <li>{@link org.eclipse.modisco.omg.gastm.impl.BinaryExpressionImpl#getLeftOperand <em>Left Operand</em>}</li> | |
* <li>{@link org.eclipse.modisco.omg.gastm.impl.BinaryExpressionImpl#getRightOperand <em>Right Operand</em>}</li> | |
* </ul> | |
* </p> | |
* | |
* @generated | |
*/ | |
public class BinaryExpressionImpl extends ExpressionImpl implements BinaryExpression { | |
/** | |
* The cached value of the '{@link #getOperator() <em>Operator</em>}' containment reference. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getOperator() | |
* @generated | |
* @ordered | |
*/ | |
protected BinaryOperator operator; | |
/** | |
* The cached value of the '{@link #getLeftOperand() <em>Left Operand</em>}' containment reference. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getLeftOperand() | |
* @generated | |
* @ordered | |
*/ | |
protected Expression leftOperand; | |
/** | |
* The cached value of the '{@link #getRightOperand() <em>Right Operand</em>}' containment reference. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getRightOperand() | |
* @generated | |
* @ordered | |
*/ | |
protected Expression rightOperand; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected BinaryExpressionImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return GASTMPackage.eINSTANCE.getBinaryExpression(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public BinaryOperator getOperator() { | |
return operator; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public NotificationChain basicSetOperator(BinaryOperator newOperator, NotificationChain msgs) { | |
BinaryOperator oldOperator = operator; | |
operator = newOperator; | |
if (eNotificationRequired()) { | |
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GASTMPackage.BINARY_EXPRESSION__OPERATOR, oldOperator, newOperator); | |
if (msgs == null) msgs = notification; else msgs.add(notification); | |
} | |
return msgs; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setOperator(BinaryOperator newOperator) { | |
if (newOperator != operator) { | |
NotificationChain msgs = null; | |
if (operator != null) | |
msgs = ((InternalEObject)operator).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GASTMPackage.BINARY_EXPRESSION__OPERATOR, null, msgs); | |
if (newOperator != null) | |
msgs = ((InternalEObject)newOperator).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GASTMPackage.BINARY_EXPRESSION__OPERATOR, null, msgs); | |
msgs = basicSetOperator(newOperator, msgs); | |
if (msgs != null) msgs.dispatch(); | |
} | |
else if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, GASTMPackage.BINARY_EXPRESSION__OPERATOR, newOperator, newOperator)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public Expression getLeftOperand() { | |
return leftOperand; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public NotificationChain basicSetLeftOperand(Expression newLeftOperand, NotificationChain msgs) { | |
Expression oldLeftOperand = leftOperand; | |
leftOperand = newLeftOperand; | |
if (eNotificationRequired()) { | |
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GASTMPackage.BINARY_EXPRESSION__LEFT_OPERAND, oldLeftOperand, newLeftOperand); | |
if (msgs == null) msgs = notification; else msgs.add(notification); | |
} | |
return msgs; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setLeftOperand(Expression newLeftOperand) { | |
if (newLeftOperand != leftOperand) { | |
NotificationChain msgs = null; | |
if (leftOperand != null) | |
msgs = ((InternalEObject)leftOperand).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GASTMPackage.BINARY_EXPRESSION__LEFT_OPERAND, null, msgs); | |
if (newLeftOperand != null) | |
msgs = ((InternalEObject)newLeftOperand).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GASTMPackage.BINARY_EXPRESSION__LEFT_OPERAND, null, msgs); | |
msgs = basicSetLeftOperand(newLeftOperand, msgs); | |
if (msgs != null) msgs.dispatch(); | |
} | |
else if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, GASTMPackage.BINARY_EXPRESSION__LEFT_OPERAND, newLeftOperand, newLeftOperand)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public Expression getRightOperand() { | |
return rightOperand; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public NotificationChain basicSetRightOperand(Expression newRightOperand, NotificationChain msgs) { | |
Expression oldRightOperand = rightOperand; | |
rightOperand = newRightOperand; | |
if (eNotificationRequired()) { | |
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GASTMPackage.BINARY_EXPRESSION__RIGHT_OPERAND, oldRightOperand, newRightOperand); | |
if (msgs == null) msgs = notification; else msgs.add(notification); | |
} | |
return msgs; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setRightOperand(Expression newRightOperand) { | |
if (newRightOperand != rightOperand) { | |
NotificationChain msgs = null; | |
if (rightOperand != null) | |
msgs = ((InternalEObject)rightOperand).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GASTMPackage.BINARY_EXPRESSION__RIGHT_OPERAND, null, msgs); | |
if (newRightOperand != null) | |
msgs = ((InternalEObject)newRightOperand).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GASTMPackage.BINARY_EXPRESSION__RIGHT_OPERAND, null, msgs); | |
msgs = basicSetRightOperand(newRightOperand, msgs); | |
if (msgs != null) msgs.dispatch(); | |
} | |
else if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, GASTMPackage.BINARY_EXPRESSION__RIGHT_OPERAND, newRightOperand, newRightOperand)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case GASTMPackage.BINARY_EXPRESSION__OPERATOR: | |
return basicSetOperator(null, msgs); | |
case GASTMPackage.BINARY_EXPRESSION__LEFT_OPERAND: | |
return basicSetLeftOperand(null, msgs); | |
case GASTMPackage.BINARY_EXPRESSION__RIGHT_OPERAND: | |
return basicSetRightOperand(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 GASTMPackage.BINARY_EXPRESSION__OPERATOR: | |
return getOperator(); | |
case GASTMPackage.BINARY_EXPRESSION__LEFT_OPERAND: | |
return getLeftOperand(); | |
case GASTMPackage.BINARY_EXPRESSION__RIGHT_OPERAND: | |
return getRightOperand(); | |
} | |
return super.eGet(featureID, resolve, coreType); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eSet(int featureID, Object newValue) { | |
switch (featureID) { | |
case GASTMPackage.BINARY_EXPRESSION__OPERATOR: | |
setOperator((BinaryOperator)newValue); | |
return; | |
case GASTMPackage.BINARY_EXPRESSION__LEFT_OPERAND: | |
setLeftOperand((Expression)newValue); | |
return; | |
case GASTMPackage.BINARY_EXPRESSION__RIGHT_OPERAND: | |
setRightOperand((Expression)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case GASTMPackage.BINARY_EXPRESSION__OPERATOR: | |
setOperator((BinaryOperator)null); | |
return; | |
case GASTMPackage.BINARY_EXPRESSION__LEFT_OPERAND: | |
setLeftOperand((Expression)null); | |
return; | |
case GASTMPackage.BINARY_EXPRESSION__RIGHT_OPERAND: | |
setRightOperand((Expression)null); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case GASTMPackage.BINARY_EXPRESSION__OPERATOR: | |
return operator != null; | |
case GASTMPackage.BINARY_EXPRESSION__LEFT_OPERAND: | |
return leftOperand != null; | |
case GASTMPackage.BINARY_EXPRESSION__RIGHT_OPERAND: | |
return rightOperand != null; | |
} | |
return super.eIsSet(featureID); | |
} | |
} //BinaryExpressionImpl |