diff options
Diffstat (limited to 'rba.model.core/src/rba/core/impl/IfStatementImpl.java')
-rw-r--r-- | rba.model.core/src/rba/core/impl/IfStatementImpl.java | 354 |
1 files changed, 354 insertions, 0 deletions
diff --git a/rba.model.core/src/rba/core/impl/IfStatementImpl.java b/rba.model.core/src/rba/core/impl/IfStatementImpl.java new file mode 100644 index 0000000..60ab034 --- /dev/null +++ b/rba.model.core/src/rba/core/impl/IfStatementImpl.java @@ -0,0 +1,354 @@ +/** + */ +package rba.core.impl; + +import java.lang.reflect.InvocationTargetException; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import rba.core.Expression; +import rba.core.ExpressionType; +import rba.core.IfStatement; +import rba.core.RBACorePackage; + +/** + * <!-- begin-user-doc --> An implementation of the model object '<em><b>If Statement</b></em>'. <!-- end-user-doc --> + * <p> + * The following features are implemented: + * </p> + * <ul> + * <li>{@link rba.core.impl.IfStatementImpl#getCondition <em>Condition</em>}</li> + * <li>{@link rba.core.impl.IfStatementImpl#getThenExpression <em>Then Expression</em>}</li> + * <li>{@link rba.core.impl.IfStatementImpl#getElseExpression <em>Else Expression</em>}</li> + * </ul> + * + * @generated + */ +public class IfStatementImpl extends ExpressionImpl implements IfStatement { + /** + * The cached value of the '{@link #getCondition() <em>Condition</em>}' containment reference. + * <!-- begin-user-doc --> <!-- + * end-user-doc --> + * @see #getCondition() + * @generated + * @ordered + */ + protected Expression condition; + + /** + * The cached value of the '{@link #getThenExpression() <em>Then Expression</em>}' containment reference. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * @see #getThenExpression() + * @generated + * @ordered + */ + protected Expression thenExpression; + + /** + * The cached value of the '{@link #getElseExpression() <em>Else Expression</em>}' containment reference. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * @see #getElseExpression() + * @generated + * @ordered + */ + protected Expression elseExpression; + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + protected IfStatementImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return RBACorePackage.Literals.IF_STATEMENT; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + public Expression getCondition() { + return condition; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + public NotificationChain basicSetCondition(Expression newCondition, NotificationChain msgs) { + Expression oldCondition = condition; + condition = newCondition; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, + RBACorePackage.IF_STATEMENT__CONDITION, oldCondition, newCondition); + if (msgs == null) + msgs = notification; + else + msgs.add(notification); + } + return msgs; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + public void setCondition(Expression newCondition) { + if (newCondition != condition) { + NotificationChain msgs = null; + if (condition != null) + msgs = ((InternalEObject) condition).eInverseRemove(this, + EOPPOSITE_FEATURE_BASE - RBACorePackage.IF_STATEMENT__CONDITION, null, msgs); + if (newCondition != null) + msgs = ((InternalEObject) newCondition).eInverseAdd(this, + EOPPOSITE_FEATURE_BASE - RBACorePackage.IF_STATEMENT__CONDITION, null, msgs); + msgs = basicSetCondition(newCondition, msgs); + if (msgs != null) + msgs.dispatch(); + } else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, RBACorePackage.IF_STATEMENT__CONDITION, newCondition, + newCondition)); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + public Expression getThenExpression() { + return thenExpression; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + public NotificationChain basicSetThenExpression(Expression newThenExpression, NotificationChain msgs) { + Expression oldThenExpression = thenExpression; + thenExpression = newThenExpression; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, + RBACorePackage.IF_STATEMENT__THEN_EXPRESSION, oldThenExpression, newThenExpression); + if (msgs == null) + msgs = notification; + else + msgs.add(notification); + } + return msgs; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + public void setThenExpression(Expression newThenExpression) { + if (newThenExpression != thenExpression) { + NotificationChain msgs = null; + if (thenExpression != null) + msgs = ((InternalEObject) thenExpression).eInverseRemove(this, + EOPPOSITE_FEATURE_BASE - RBACorePackage.IF_STATEMENT__THEN_EXPRESSION, null, msgs); + if (newThenExpression != null) + msgs = ((InternalEObject) newThenExpression).eInverseAdd(this, + EOPPOSITE_FEATURE_BASE - RBACorePackage.IF_STATEMENT__THEN_EXPRESSION, null, msgs); + msgs = basicSetThenExpression(newThenExpression, msgs); + if (msgs != null) + msgs.dispatch(); + } else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, RBACorePackage.IF_STATEMENT__THEN_EXPRESSION, + newThenExpression, newThenExpression)); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + public Expression getElseExpression() { + return elseExpression; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + public NotificationChain basicSetElseExpression(Expression newElseExpression, NotificationChain msgs) { + Expression oldElseExpression = elseExpression; + elseExpression = newElseExpression; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, + RBACorePackage.IF_STATEMENT__ELSE_EXPRESSION, oldElseExpression, newElseExpression); + if (msgs == null) + msgs = notification; + else + msgs.add(notification); + } + return msgs; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + public void setElseExpression(Expression newElseExpression) { + if (newElseExpression != elseExpression) { + NotificationChain msgs = null; + if (elseExpression != null) + msgs = ((InternalEObject) elseExpression).eInverseRemove(this, + EOPPOSITE_FEATURE_BASE - RBACorePackage.IF_STATEMENT__ELSE_EXPRESSION, null, msgs); + if (newElseExpression != null) + msgs = ((InternalEObject) newElseExpression).eInverseAdd(this, + EOPPOSITE_FEATURE_BASE - RBACorePackage.IF_STATEMENT__ELSE_EXPRESSION, null, msgs); + msgs = basicSetElseExpression(newElseExpression, msgs); + if (msgs != null) + msgs.dispatch(); + } else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, RBACorePackage.IF_STATEMENT__ELSE_EXPRESSION, + newElseExpression, newElseExpression)); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + public ExpressionType getUnderlyingType() { + if (thenExpression != null) { + return thenExpression.getUnderlyingType(); + } + return ExpressionType.VALUE; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + public String getExpressionText() { + StringBuffer expressionText = new StringBuffer(); + expressionText.append("IF("); + expressionText.append(condition != null ? condition.getExpressionText() : "[Invalid_Expression]"); + expressionText.append(") THEN "); + expressionText.append(thenExpression != null ? thenExpression.getExpressionText() : "[Invalid_Expression]"); + expressionText.append(" ELSE "); + expressionText.append(elseExpression != null ? elseExpression.getExpressionText() : "[Invalid_Expression]"); + return expressionText.toString(); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case RBACorePackage.IF_STATEMENT__CONDITION: + return basicSetCondition(null, msgs); + case RBACorePackage.IF_STATEMENT__THEN_EXPRESSION: + return basicSetThenExpression(null, msgs); + case RBACorePackage.IF_STATEMENT__ELSE_EXPRESSION: + return basicSetElseExpression(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 RBACorePackage.IF_STATEMENT__CONDITION: + return getCondition(); + case RBACorePackage.IF_STATEMENT__THEN_EXPRESSION: + return getThenExpression(); + case RBACorePackage.IF_STATEMENT__ELSE_EXPRESSION: + return getElseExpression(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case RBACorePackage.IF_STATEMENT__CONDITION: + setCondition((Expression) newValue); + return; + case RBACorePackage.IF_STATEMENT__THEN_EXPRESSION: + setThenExpression((Expression) newValue); + return; + case RBACorePackage.IF_STATEMENT__ELSE_EXPRESSION: + setElseExpression((Expression) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case RBACorePackage.IF_STATEMENT__CONDITION: + setCondition((Expression) null); + return; + case RBACorePackage.IF_STATEMENT__THEN_EXPRESSION: + setThenExpression((Expression) null); + return; + case RBACorePackage.IF_STATEMENT__ELSE_EXPRESSION: + setElseExpression((Expression) null); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case RBACorePackage.IF_STATEMENT__CONDITION: + return condition != null; + case RBACorePackage.IF_STATEMENT__THEN_EXPRESSION: + return thenExpression != null; + case RBACorePackage.IF_STATEMENT__ELSE_EXPRESSION: + return elseExpression != null; + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + @Override + public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException { + switch (operationID) { + case RBACorePackage.IF_STATEMENT___GET_UNDERLYING_TYPE: + return getUnderlyingType(); + case RBACorePackage.IF_STATEMENT___GET_EXPRESSION_TEXT: + return getExpressionText(); + } + return super.eInvoke(operationID, arguments); + } + +} // IfStatementImpl |