/** * <copyright> * </copyright> * * $Id$ */ package org.dresdenocl.examples.pml.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.emf.ecore.impl.EObjectImpl; import org.eclipse.emf.ecore.util.EcoreUtil; 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>Parameter</b></em>'. <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.dresdenocl.examples.pml.impl.ParameterImpl#getName <em>Name</em>}</li> * <li>{@link org.dresdenocl.examples.pml.impl.ParameterImpl#getType <em>Type</em>}</li> * <li>{@link org.dresdenocl.examples.pml.impl.ParameterImpl#getOperation <em>Operation</em>}</li> * </ul> * </p> * * @generated */ public class ParameterImpl extends EObjectImpl implements Parameter { /** * 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 #getType() <em>Type</em>}' reference. <!-- * begin-user-doc --> <!-- end-user-doc --> * * @see #getType() * @generated * @ordered */ protected JavaType type; /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ protected ParameterImpl() { super(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return PmlPackage.Literals.PARAMETER; } /** * <!-- 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.PARAMETER__NAME, oldName, name)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public JavaType getType() { if (type != null && type.eIsProxy()) { InternalEObject oldType = (InternalEObject)type; type = (JavaType)eResolveProxy(oldType); if (type != oldType) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, PmlPackage.PARAMETER__TYPE, oldType, type)); } } return type; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public JavaType basicGetType() { return type; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public void setType(JavaType newType) { JavaType oldType = type; type = newType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PmlPackage.PARAMETER__TYPE, oldType, type)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public Operation getOperation() { if (eContainerFeatureID() != PmlPackage.PARAMETER__OPERATION) return null; return (Operation)eContainer(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public NotificationChain basicSetOperation(Operation newOperation, NotificationChain msgs) { msgs = eBasicSetContainer((InternalEObject)newOperation, PmlPackage.PARAMETER__OPERATION, msgs); return msgs; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public void setOperation(Operation newOperation) { if (newOperation != eInternalContainer() || (eContainerFeatureID() != PmlPackage.PARAMETER__OPERATION && newOperation != null)) { if (EcoreUtil.isAncestor(this, newOperation)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newOperation != null) msgs = ((InternalEObject)newOperation).eInverseAdd(this, PmlPackage.OPERATION__PARAMETERS, Operation.class, msgs); msgs = basicSetOperation(newOperation, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PmlPackage.PARAMETER__OPERATION, newOperation, newOperation)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case PmlPackage.PARAMETER__OPERATION: if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); return basicSetOperation((Operation)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.PARAMETER__OPERATION: return basicSetOperation(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public NotificationChain eBasicRemoveFromContainerFeature( NotificationChain msgs) { switch (eContainerFeatureID()) { case PmlPackage.PARAMETER__OPERATION: return eInternalContainer().eInverseRemove(this, PmlPackage.OPERATION__PARAMETERS, Operation.class, msgs); } return super.eBasicRemoveFromContainerFeature(msgs); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case PmlPackage.PARAMETER__NAME: return getName(); case PmlPackage.PARAMETER__TYPE: if (resolve) return getType(); return basicGetType(); case PmlPackage.PARAMETER__OPERATION: return getOperation(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case PmlPackage.PARAMETER__NAME: setName((String)newValue); return; case PmlPackage.PARAMETER__TYPE: setType((JavaType)newValue); return; case PmlPackage.PARAMETER__OPERATION: setOperation((Operation)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case PmlPackage.PARAMETER__NAME: setName(NAME_EDEFAULT); return; case PmlPackage.PARAMETER__TYPE: setType((JavaType)null); return; case PmlPackage.PARAMETER__OPERATION: setOperation((Operation)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case PmlPackage.PARAMETER__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case PmlPackage.PARAMETER__TYPE: return type != null; case PmlPackage.PARAMETER__OPERATION: return getOperation() != 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 += ", type = " + type; result += "]"; return result; } } // ParameterImpl