org.eclipse.ocl.expressions.impl.IfExpImpl Maven / Gradle / Ivy
/**
*
*
* Copyright (c) 2006, 2009 IBM Corporation, Zeligsoft Inc., 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:
* IBM - Initial API and implementation
* Zeligsoft - Bug 207365
*
*
*
* $Id: IfExpImpl.java,v 1.8 2009/01/23 17:16:03 cdamus Exp $
*/
package org.eclipse.ocl.expressions.impl;
import java.util.Map;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.ocl.expressions.ExpressionsPackage;
import org.eclipse.ocl.expressions.IfExp;
import org.eclipse.ocl.expressions.OCLExpression;
import org.eclipse.ocl.expressions.operations.IfExpOperations;
import org.eclipse.ocl.utilities.Visitor;
/**
*
* An implementation of the model object 'If Exp'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.ocl.expressions.impl.IfExpImpl#getCondition Condition}
* - {@link org.eclipse.ocl.expressions.impl.IfExpImpl#getThenExpression Then Expression}
* - {@link org.eclipse.ocl.expressions.impl.IfExpImpl#getElseExpression Else Expression}
*
*
*
* @generated
*/
public class IfExpImpl
extends OCLExpressionImpl
implements IfExp {
/**
* The cached value of the '{@link #getCondition() Condition}' containment reference.
*
*
* @see #getCondition()
* @generated
* @ordered
*/
protected OCLExpression condition;
/**
* The cached value of the '{@link #getThenExpression() Then Expression}' containment reference.
*
*
* @see #getThenExpression()
* @generated
* @ordered
*/
protected OCLExpression thenExpression;
/**
* The cached value of the '{@link #getElseExpression() Else Expression}' containment reference.
*
*
* @see #getElseExpression()
* @generated
* @ordered
*/
protected OCLExpression elseExpression;
/**
*
*
* @generated
*/
protected IfExpImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return ExpressionsPackage.Literals.IF_EXP;
}
/**
*
*
* @generated
*/
public OCLExpression getCondition() {
return condition;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetCondition(OCLExpression newCondition,
NotificationChain msgs) {
OCLExpression oldCondition = condition;
condition = newCondition;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET, ExpressionsPackage.IF_EXP__CONDITION,
oldCondition, newCondition);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setCondition(OCLExpression newCondition) {
if (newCondition != condition) {
NotificationChain msgs = null;
if (condition != null)
msgs = ((InternalEObject) condition).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.IF_EXP__CONDITION, null, msgs);
if (newCondition != null)
msgs = ((InternalEObject) newCondition).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.IF_EXP__CONDITION, null, msgs);
msgs = basicSetCondition(newCondition, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.IF_EXP__CONDITION, newCondition,
newCondition));
}
/**
*
*
* @generated
*/
public OCLExpression getThenExpression() {
return thenExpression;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetThenExpression(
OCLExpression newThenExpression, NotificationChain msgs) {
OCLExpression oldThenExpression = thenExpression;
thenExpression = newThenExpression;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET, ExpressionsPackage.IF_EXP__THEN_EXPRESSION,
oldThenExpression, newThenExpression);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setThenExpression(OCLExpression newThenExpression) {
if (newThenExpression != thenExpression) {
NotificationChain msgs = null;
if (thenExpression != null)
msgs = ((InternalEObject) thenExpression).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.IF_EXP__THEN_EXPRESSION, null,
msgs);
if (newThenExpression != null)
msgs = ((InternalEObject) newThenExpression).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.IF_EXP__THEN_EXPRESSION, null,
msgs);
msgs = basicSetThenExpression(newThenExpression, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.IF_EXP__THEN_EXPRESSION, newThenExpression,
newThenExpression));
}
/**
*
*
* @generated
*/
public OCLExpression getElseExpression() {
return elseExpression;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetElseExpression(
OCLExpression newElseExpression, NotificationChain msgs) {
OCLExpression oldElseExpression = elseExpression;
elseExpression = newElseExpression;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET, ExpressionsPackage.IF_EXP__ELSE_EXPRESSION,
oldElseExpression, newElseExpression);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setElseExpression(OCLExpression newElseExpression) {
if (newElseExpression != elseExpression) {
NotificationChain msgs = null;
if (elseExpression != null)
msgs = ((InternalEObject) elseExpression).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.IF_EXP__ELSE_EXPRESSION, null,
msgs);
if (newElseExpression != null)
msgs = ((InternalEObject) newElseExpression).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.IF_EXP__ELSE_EXPRESSION, null,
msgs);
msgs = basicSetElseExpression(newElseExpression, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.IF_EXP__ELSE_EXPRESSION, newElseExpression,
newElseExpression));
}
/**
*
*
* @generated
*/
public boolean checkBooleanCondition(DiagnosticChain diagnostics,
Map