blob: 801fd15c0e22aea29b46e14b8455db3cb290e6bb [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009, 2011 SAP AG 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:
* SAP AG - initial API and implementation
******************************************************************************
* $Id: StatementWithArgumentImpl.java,v 1.2 2011/03/05 21:37:35 auhl Exp $
*/
package behavioral.actions.impl;
import behavioral.actions.ActionsPackage;
import behavioral.actions.StatementWithArgument;
import dataaccess.expressions.Expression;
import dataaccess.expressions.ExpressionsPackage;
import dataaccess.expressions.WithArgument;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Statement With Argument</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link behavioral.actions.impl.StatementWithArgumentImpl#getArgument <em>Argument</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public abstract class StatementWithArgumentImpl extends StatementImpl implements StatementWithArgument {
/**
* The cached value of the '{@link #getArgument() <em>Argument</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getArgument()
* @generated
* @ordered
*/
protected Expression argument;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected StatementWithArgumentImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ActionsPackage.Literals.STATEMENT_WITH_ARGUMENT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression getArgument() {
if (argument != null && argument.eIsProxy()) {
InternalEObject oldArgument = (InternalEObject)argument;
argument = (Expression)eResolveProxy(oldArgument);
if (argument != oldArgument) {
InternalEObject newArgument = (InternalEObject)argument;
NotificationChain msgs = oldArgument.eInverseRemove(this, ExpressionsPackage.EXPRESSION__ARGUMENT_OF, Expression.class, null);
if (newArgument.eInternalContainer() == null) {
msgs = newArgument.eInverseAdd(this, ExpressionsPackage.EXPRESSION__ARGUMENT_OF, Expression.class, msgs);
}
if (msgs != null) msgs.dispatch();
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ActionsPackage.STATEMENT_WITH_ARGUMENT__ARGUMENT, oldArgument, argument));
}
}
return argument;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression basicGetArgument() {
return argument;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetArgument(Expression newArgument, NotificationChain msgs) {
Expression oldArgument = argument;
argument = newArgument;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ActionsPackage.STATEMENT_WITH_ARGUMENT__ARGUMENT, oldArgument, newArgument);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setArgument(Expression newArgument) {
if (newArgument != argument) {
NotificationChain msgs = null;
if (argument != null)
msgs = ((InternalEObject)argument).eInverseRemove(this, ExpressionsPackage.EXPRESSION__ARGUMENT_OF, Expression.class, msgs);
if (newArgument != null)
msgs = ((InternalEObject)newArgument).eInverseAdd(this, ExpressionsPackage.EXPRESSION__ARGUMENT_OF, Expression.class, msgs);
msgs = basicSetArgument(newArgument, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ActionsPackage.STATEMENT_WITH_ARGUMENT__ARGUMENT, newArgument, newArgument));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ActionsPackage.STATEMENT_WITH_ARGUMENT__ARGUMENT:
if (argument != null)
msgs = ((InternalEObject)argument).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ActionsPackage.STATEMENT_WITH_ARGUMENT__ARGUMENT, null, msgs);
return basicSetArgument((Expression)otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ActionsPackage.STATEMENT_WITH_ARGUMENT__ARGUMENT:
return basicSetArgument(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 ActionsPackage.STATEMENT_WITH_ARGUMENT__ARGUMENT:
if (resolve) return getArgument();
return basicGetArgument();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ActionsPackage.STATEMENT_WITH_ARGUMENT__ARGUMENT:
setArgument((Expression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ActionsPackage.STATEMENT_WITH_ARGUMENT__ARGUMENT:
setArgument((Expression)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ActionsPackage.STATEMENT_WITH_ARGUMENT__ARGUMENT:
return argument != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
if (baseClass == WithArgument.class) {
switch (derivedFeatureID) {
case ActionsPackage.STATEMENT_WITH_ARGUMENT__ARGUMENT: return ExpressionsPackage.WITH_ARGUMENT__ARGUMENT;
default: return -1;
}
}
return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
if (baseClass == WithArgument.class) {
switch (baseFeatureID) {
case ExpressionsPackage.WITH_ARGUMENT__ARGUMENT: return ActionsPackage.STATEMENT_WITH_ARGUMENT__ARGUMENT;
default: return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
} //StatementWithArgumentImpl