/**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.dresdenocl.examples.pml.impl;
import java.util.Collection;
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 org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.dresdenocl.examples.pml.JavaType;
import org.dresdenocl.examples.pml.Operation;
import org.dresdenocl.examples.pml.Parameter;
import org.dresdenocl.examples.pml.PmlPackage;
/**
* <!-- begin-user-doc --> An implementation of the model object '
* <em><b>Operation</b></em>'. <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.dresdenocl.examples.pml.impl.OperationImpl#getName <em>Name</em>}</li>
* <li>{@link org.dresdenocl.examples.pml.impl.OperationImpl#getReturnType <em>Return Type</em>}</li>
* <li>{@link org.dresdenocl.examples.pml.impl.OperationImpl#getParameters <em>Parameters</em>}</li>
* <li>{@link org.dresdenocl.examples.pml.impl.OperationImpl#getMyType <em>My Type</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class OperationImpl extends EObjectImpl implements Operation {
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The cached value of the '{@link #getReturnType() <em>Return Type</em>}' reference.
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @see #getReturnType()
* @generated
* @ordered
*/
protected JavaType returnType;
/**
* The cached value of the '{@link #getParameters() <em>Parameters</em>}' containment reference list.
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @see #getParameters()
* @generated
* @ordered
*/
protected EList<Parameter> parameters;
/**
* The cached value of the '{@link #getMyType() <em>My Type</em>}' reference.
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @see #getMyType()
* @generated
* @ordered
*/
protected JavaType myType;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
protected OperationImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return PmlPackage.Literals.OPERATION;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PmlPackage.OPERATION__NAME, oldName, name));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public JavaType getReturnType() {
if (returnType != null && returnType.eIsProxy()) {
InternalEObject oldReturnType = (InternalEObject)returnType;
returnType = (JavaType)eResolveProxy(oldReturnType);
if (returnType != oldReturnType) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, PmlPackage.OPERATION__RETURN_TYPE, oldReturnType, returnType));
}
}
return returnType;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public JavaType basicGetReturnType() {
return returnType;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void setReturnType(JavaType newReturnType) {
JavaType oldReturnType = returnType;
returnType = newReturnType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PmlPackage.OPERATION__RETURN_TYPE, oldReturnType, returnType));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public EList<Parameter> getParameters() {
if (parameters == null) {
parameters = new EObjectContainmentWithInverseEList<Parameter>(Parameter.class, this, PmlPackage.OPERATION__PARAMETERS, PmlPackage.PARAMETER__OPERATION);
}
return parameters;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public JavaType getMyType() {
if (myType != null && myType.eIsProxy()) {
InternalEObject oldMyType = (InternalEObject)myType;
myType = (JavaType)eResolveProxy(oldMyType);
if (myType != oldMyType) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, PmlPackage.OPERATION__MY_TYPE, oldMyType, myType));
}
}
return myType;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public JavaType basicGetMyType() {
return myType;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void setMyType(JavaType newMyType) {
JavaType oldMyType = myType;
myType = newMyType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PmlPackage.OPERATION__MY_TYPE, oldMyType, myType));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID,
NotificationChain msgs) {
switch (featureID) {
case PmlPackage.OPERATION__PARAMETERS:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getParameters()).basicAdd(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 PmlPackage.OPERATION__PARAMETERS:
return ((InternalEList<?>)getParameters()).basicRemove(otherEnd, 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 PmlPackage.OPERATION__NAME:
return getName();
case PmlPackage.OPERATION__RETURN_TYPE:
if (resolve) return getReturnType();
return basicGetReturnType();
case PmlPackage.OPERATION__PARAMETERS:
return getParameters();
case PmlPackage.OPERATION__MY_TYPE:
if (resolve) return getMyType();
return basicGetMyType();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case PmlPackage.OPERATION__NAME:
setName((String)newValue);
return;
case PmlPackage.OPERATION__RETURN_TYPE:
setReturnType((JavaType)newValue);
return;
case PmlPackage.OPERATION__PARAMETERS:
getParameters().clear();
getParameters().addAll((Collection<? extends Parameter>)newValue);
return;
case PmlPackage.OPERATION__MY_TYPE:
setMyType((JavaType)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case PmlPackage.OPERATION__NAME:
setName(NAME_EDEFAULT);
return;
case PmlPackage.OPERATION__RETURN_TYPE:
setReturnType((JavaType)null);
return;
case PmlPackage.OPERATION__PARAMETERS:
getParameters().clear();
return;
case PmlPackage.OPERATION__MY_TYPE:
setMyType((JavaType)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case PmlPackage.OPERATION__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case PmlPackage.OPERATION__RETURN_TYPE:
return returnType != null;
case PmlPackage.OPERATION__PARAMETERS:
return parameters != null && !parameters.isEmpty();
case PmlPackage.OPERATION__MY_TYPE:
return myType != null;
}
return super.eIsSet(featureID);
}
/**
* (non-Javadoc)
*
* @see org.eclipse.emf.ecore.impl.BasicEObjectImpl#toString()
* @generated NOT
*/
public String toString() {
String result;
result = this.getClass().getSimpleName();
result += "[";
result += "name = " + name;
result += ", returnType = " + returnType;
result += ", parameters = " + parameters;
result += "]";
return result;
}
} // OperationImpl