org.eclipse.ocl.cst.impl.IfExpCSImpl Maven / Gradle / Ivy
/**
*
*
* Copyright (c) 2005, 2008 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 243976
*
*
*
* $Id: IfExpCSImpl.java,v 1.3 2008/11/30 22:11:37 cdamus Exp $
*/
package org.eclipse.ocl.cst.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.ocl.cst.CSTPackage;
import org.eclipse.ocl.cst.IfExpCS;
import org.eclipse.ocl.cst.OCLExpressionCS;
/**
*
* An implementation of the model object 'If Exp CS'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.ocl.cst.impl.IfExpCSImpl#getThenExpression Then Expression}
* - {@link org.eclipse.ocl.cst.impl.IfExpCSImpl#getElseExpression Else Expression}
* - {@link org.eclipse.ocl.cst.impl.IfExpCSImpl#getCondition Condition}
*
*
*
* @generated
*/
public class IfExpCSImpl
extends OCLExpressionCSImpl
implements IfExpCS {
/**
* The cached value of the '{@link #getThenExpression() Then Expression}' containment reference.
*
*
* @see #getThenExpression()
* @generated
* @ordered
*/
protected OCLExpressionCS thenExpression;
/**
* The cached value of the '{@link #getElseExpression() Else Expression}' containment reference.
*
*
* @see #getElseExpression()
* @generated
* @ordered
*/
protected OCLExpressionCS elseExpression;
/**
* The cached value of the '{@link #getCondition() Condition}' containment reference.
*
*
* @see #getCondition()
* @generated
* @ordered
*/
protected OCLExpressionCS condition;
/**
*
*
* @generated
*/
protected IfExpCSImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return CSTPackage.Literals.IF_EXP_CS;
}
/**
*
*
* @generated
*/
public OCLExpressionCS getThenExpression() {
return thenExpression;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetThenExpression(
OCLExpressionCS newThenExpression, NotificationChain msgs) {
OCLExpressionCS oldThenExpression = thenExpression;
thenExpression = newThenExpression;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET, CSTPackage.IF_EXP_CS__THEN_EXPRESSION,
oldThenExpression, newThenExpression);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setThenExpression(OCLExpressionCS newThenExpression) {
if (newThenExpression != thenExpression) {
NotificationChain msgs = null;
if (thenExpression != null)
msgs = ((InternalEObject) thenExpression).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE
- CSTPackage.IF_EXP_CS__THEN_EXPRESSION, null, msgs);
if (newThenExpression != null)
msgs = ((InternalEObject) newThenExpression).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE
- CSTPackage.IF_EXP_CS__THEN_EXPRESSION, null, msgs);
msgs = basicSetThenExpression(newThenExpression, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
CSTPackage.IF_EXP_CS__THEN_EXPRESSION, newThenExpression,
newThenExpression));
}
/**
*
*
* @generated
*/
public OCLExpressionCS getElseExpression() {
return elseExpression;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetElseExpression(
OCLExpressionCS newElseExpression, NotificationChain msgs) {
OCLExpressionCS oldElseExpression = elseExpression;
elseExpression = newElseExpression;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET, CSTPackage.IF_EXP_CS__ELSE_EXPRESSION,
oldElseExpression, newElseExpression);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setElseExpression(OCLExpressionCS newElseExpression) {
if (newElseExpression != elseExpression) {
NotificationChain msgs = null;
if (elseExpression != null)
msgs = ((InternalEObject) elseExpression).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE
- CSTPackage.IF_EXP_CS__ELSE_EXPRESSION, null, msgs);
if (newElseExpression != null)
msgs = ((InternalEObject) newElseExpression).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE
- CSTPackage.IF_EXP_CS__ELSE_EXPRESSION, null, msgs);
msgs = basicSetElseExpression(newElseExpression, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
CSTPackage.IF_EXP_CS__ELSE_EXPRESSION, newElseExpression,
newElseExpression));
}
/**
*
*
* @generated
*/
public OCLExpressionCS getCondition() {
return condition;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetCondition(OCLExpressionCS newCondition,
NotificationChain msgs) {
OCLExpressionCS oldCondition = condition;
condition = newCondition;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET, CSTPackage.IF_EXP_CS__CONDITION,
oldCondition, newCondition);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setCondition(OCLExpressionCS newCondition) {
if (newCondition != condition) {
NotificationChain msgs = null;
if (condition != null)
msgs = ((InternalEObject) condition).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE - CSTPackage.IF_EXP_CS__CONDITION,
null, msgs);
if (newCondition != null)
msgs = ((InternalEObject) newCondition).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE - CSTPackage.IF_EXP_CS__CONDITION,
null, msgs);
msgs = basicSetCondition(newCondition, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
CSTPackage.IF_EXP_CS__CONDITION, newCondition, newCondition));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd,
int featureID, NotificationChain msgs) {
switch (featureID) {
case CSTPackage.IF_EXP_CS__THEN_EXPRESSION :
return basicSetThenExpression(null, msgs);
case CSTPackage.IF_EXP_CS__ELSE_EXPRESSION :
return basicSetElseExpression(null, msgs);
case CSTPackage.IF_EXP_CS__CONDITION :
return basicSetCondition(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case CSTPackage.IF_EXP_CS__THEN_EXPRESSION :
return getThenExpression();
case CSTPackage.IF_EXP_CS__ELSE_EXPRESSION :
return getElseExpression();
case CSTPackage.IF_EXP_CS__CONDITION :
return getCondition();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case CSTPackage.IF_EXP_CS__THEN_EXPRESSION :
setThenExpression((OCLExpressionCS) newValue);
return;
case CSTPackage.IF_EXP_CS__ELSE_EXPRESSION :
setElseExpression((OCLExpressionCS) newValue);
return;
case CSTPackage.IF_EXP_CS__CONDITION :
setCondition((OCLExpressionCS) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case CSTPackage.IF_EXP_CS__THEN_EXPRESSION :
setThenExpression((OCLExpressionCS) null);
return;
case CSTPackage.IF_EXP_CS__ELSE_EXPRESSION :
setElseExpression((OCLExpressionCS) null);
return;
case CSTPackage.IF_EXP_CS__CONDITION :
setCondition((OCLExpressionCS) null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case CSTPackage.IF_EXP_CS__THEN_EXPRESSION :
return thenExpression != null;
case CSTPackage.IF_EXP_CS__ELSE_EXPRESSION :
return elseExpression != null;
case CSTPackage.IF_EXP_CS__CONDITION :
return condition != null;
}
return super.eIsSet(featureID);
}
} //IfExpCSImpl