org.eclipse.ocl.expressions.impl.CallExpImpl 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: CallExpImpl.java,v 1.6 2009/01/23 17:16:03 cdamus Exp $
*/
package org.eclipse.ocl.expressions.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.expressions.CallExp;
import org.eclipse.ocl.expressions.ExpressionsPackage;
import org.eclipse.ocl.expressions.OCLExpression;
import org.eclipse.ocl.utilities.CallingASTNode;
import org.eclipse.ocl.utilities.UtilitiesPackage;
/**
*
* An implementation of the model object 'Call Exp'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.ocl.expressions.impl.CallExpImpl#getPropertyStartPosition Property Start Position}
* - {@link org.eclipse.ocl.expressions.impl.CallExpImpl#getPropertyEndPosition Property End Position}
* - {@link org.eclipse.ocl.expressions.impl.CallExpImpl#getSource Source}
*
*
*
* @generated
*/
public abstract class CallExpImpl
extends OCLExpressionImpl
implements CallExp {
/**
* The default value of the '{@link #getPropertyStartPosition() Property Start Position}' attribute.
*
*
* @see #getPropertyStartPosition()
* @generated
* @ordered
*/
protected static final int PROPERTY_START_POSITION_EDEFAULT = -1;
/**
* The cached value of the '{@link #getPropertyStartPosition() Property Start Position}' attribute.
*
*
* @see #getPropertyStartPosition()
* @generated
* @ordered
*/
protected int propertyStartPosition = PROPERTY_START_POSITION_EDEFAULT;
/**
* The default value of the '{@link #getPropertyEndPosition() Property End Position}' attribute.
*
*
* @see #getPropertyEndPosition()
* @generated
* @ordered
*/
protected static final int PROPERTY_END_POSITION_EDEFAULT = -1;
/**
* The cached value of the '{@link #getPropertyEndPosition() Property End Position}' attribute.
*
*
* @see #getPropertyEndPosition()
* @generated
* @ordered
*/
protected int propertyEndPosition = PROPERTY_END_POSITION_EDEFAULT;
/**
* The cached value of the '{@link #getSource() Source}' containment reference.
*
*
* @see #getSource()
* @generated
* @ordered
*/
protected OCLExpression source;
/**
*
*
* @generated
*/
protected CallExpImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return ExpressionsPackage.Literals.CALL_EXP;
}
/**
*
*
* @generated
*/
public int getPropertyStartPosition() {
return propertyStartPosition;
}
/**
*
*
* @generated
*/
public void setPropertyStartPosition(int newPropertyStartPosition) {
int oldPropertyStartPosition = propertyStartPosition;
propertyStartPosition = newPropertyStartPosition;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.CALL_EXP__PROPERTY_START_POSITION,
oldPropertyStartPosition, propertyStartPosition));
}
/**
*
*
* @generated
*/
public int getPropertyEndPosition() {
return propertyEndPosition;
}
/**
*
*
* @generated
*/
public void setPropertyEndPosition(int newPropertyEndPosition) {
int oldPropertyEndPosition = propertyEndPosition;
propertyEndPosition = newPropertyEndPosition;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.CALL_EXP__PROPERTY_END_POSITION,
oldPropertyEndPosition, propertyEndPosition));
}
/**
*
*
* @generated
*/
public OCLExpression getSource() {
return source;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetSource(OCLExpression newSource,
NotificationChain msgs) {
OCLExpression oldSource = source;
source = newSource;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET, ExpressionsPackage.CALL_EXP__SOURCE,
oldSource, newSource);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setSource(OCLExpression newSource) {
if (newSource != source) {
NotificationChain msgs = null;
if (source != null)
msgs = ((InternalEObject) source).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.CALL_EXP__SOURCE, null, msgs);
if (newSource != null)
msgs = ((InternalEObject) newSource).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.CALL_EXP__SOURCE, null, msgs);
msgs = basicSetSource(newSource, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.CALL_EXP__SOURCE, newSource, newSource));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd,
int featureID, NotificationChain msgs) {
switch (featureID) {
case ExpressionsPackage.CALL_EXP__SOURCE :
return basicSetSource(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ExpressionsPackage.CALL_EXP__PROPERTY_START_POSITION :
return getPropertyStartPosition();
case ExpressionsPackage.CALL_EXP__PROPERTY_END_POSITION :
return getPropertyEndPosition();
case ExpressionsPackage.CALL_EXP__SOURCE :
return getSource();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ExpressionsPackage.CALL_EXP__PROPERTY_START_POSITION :
setPropertyStartPosition((Integer) newValue);
return;
case ExpressionsPackage.CALL_EXP__PROPERTY_END_POSITION :
setPropertyEndPosition((Integer) newValue);
return;
case ExpressionsPackage.CALL_EXP__SOURCE :
setSource((OCLExpression) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ExpressionsPackage.CALL_EXP__PROPERTY_START_POSITION :
setPropertyStartPosition(PROPERTY_START_POSITION_EDEFAULT);
return;
case ExpressionsPackage.CALL_EXP__PROPERTY_END_POSITION :
setPropertyEndPosition(PROPERTY_END_POSITION_EDEFAULT);
return;
case ExpressionsPackage.CALL_EXP__SOURCE :
setSource((OCLExpression) null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ExpressionsPackage.CALL_EXP__PROPERTY_START_POSITION :
return propertyStartPosition != PROPERTY_START_POSITION_EDEFAULT;
case ExpressionsPackage.CALL_EXP__PROPERTY_END_POSITION :
return propertyEndPosition != PROPERTY_END_POSITION_EDEFAULT;
case ExpressionsPackage.CALL_EXP__SOURCE :
return source != null;
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public int eBaseStructuralFeatureID(int derivedFeatureID, Class> baseClass) {
if (baseClass == CallingASTNode.class) {
switch (derivedFeatureID) {
case ExpressionsPackage.CALL_EXP__PROPERTY_START_POSITION :
return UtilitiesPackage.CALLING_AST_NODE__PROPERTY_START_POSITION;
case ExpressionsPackage.CALL_EXP__PROPERTY_END_POSITION :
return UtilitiesPackage.CALLING_AST_NODE__PROPERTY_END_POSITION;
default :
return -1;
}
}
return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
}
/**
*
*
* @generated
*/
@Override
public int eDerivedStructuralFeatureID(int baseFeatureID, Class> baseClass) {
if (baseClass == CallingASTNode.class) {
switch (baseFeatureID) {
case UtilitiesPackage.CALLING_AST_NODE__PROPERTY_START_POSITION :
return ExpressionsPackage.CALL_EXP__PROPERTY_START_POSITION;
case UtilitiesPackage.CALLING_AST_NODE__PROPERTY_END_POSITION :
return ExpressionsPackage.CALL_EXP__PROPERTY_END_POSITION;
default :
return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
/**
*
*
* @generated NOT
*/
@Override
public String toString() {
return super.toString();
}
} //CallExpImpl