/* * JBoss, Home of Professional Open Source. * * See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing. * * See the AUTHORS.txt file distributed with this work for a full listing of individual contributors. */ package org.teiid.designer.metamodels.function.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.EStructuralFeature; 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.teiid.designer.metamodels.function.FunctionPackage; import org.teiid.designer.metamodels.function.FunctionParameter; import org.teiid.designer.metamodels.function.ScalarFunction; /** * <!-- 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.teiid.designer.metamodels.function.impl.FunctionParameterImpl#getFunction <em>Function</em>}</li> * <li>{@link org.teiid.designer.metamodels.function.impl.FunctionParameterImpl#getName <em>Name</em>}</li> * <li>{@link org.teiid.designer.metamodels.function.impl.FunctionParameterImpl#getType <em>Type</em>}</li> * </ul> * </p> * * @generated * * @since 8.0 */ public class FunctionParameterImpl extends EObjectImpl implements FunctionParameter { /** * 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 default value of the '{@link #getType() <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getType() * @generated * @ordered */ protected static final String TYPE_EDEFAULT = null; /** * The cached value of the '{@link #getType() <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getType() * @generated * @ordered */ protected String type = TYPE_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected FunctionParameterImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return FunctionPackage.eINSTANCE.getFunctionParameter(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, FunctionPackage.FUNCTION_PARAMETER__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getType() { return type; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setType(String newType) { String oldType = type; type = newType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, FunctionPackage.FUNCTION_PARAMETER__TYPE, oldType, type)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public ScalarFunction getFunction() { if (eContainerFeatureID != FunctionPackage.FUNCTION_PARAMETER__FUNCTION) return null; return (ScalarFunction)eContainer; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setFunction(ScalarFunction newFunction) { if (newFunction != eContainer || (eContainerFeatureID != FunctionPackage.FUNCTION_PARAMETER__FUNCTION && newFunction != null)) { if (EcoreUtil.isAncestor(this, newFunction)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); //$NON-NLS-1$ NotificationChain msgs = null; if (eContainer != null) msgs = eBasicRemoveFromContainer(msgs); if (newFunction != null) msgs = ((InternalEObject)newFunction).eInverseAdd(this, FunctionPackage.SCALAR_FUNCTION__INPUT_PARAMETERS, ScalarFunction.class, msgs); msgs = eBasicSetContainer((InternalEObject)newFunction, FunctionPackage.FUNCTION_PARAMETER__FUNCTION, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, FunctionPackage.FUNCTION_PARAMETER__FUNCTION, newFunction, newFunction)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { if (featureID >= 0) { switch (eDerivedStructuralFeatureID(featureID, baseClass)) { case FunctionPackage.FUNCTION_PARAMETER__FUNCTION: if (eContainer != null) msgs = eBasicRemoveFromContainer(msgs); return eBasicSetContainer(otherEnd, FunctionPackage.FUNCTION_PARAMETER__FUNCTION, msgs); default: return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); } } if (eContainer != null) msgs = eBasicRemoveFromContainer(msgs); return eBasicSetContainer(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { if (featureID >= 0) { switch (eDerivedStructuralFeatureID(featureID, baseClass)) { case FunctionPackage.FUNCTION_PARAMETER__FUNCTION: return eBasicSetContainer(null, FunctionPackage.FUNCTION_PARAMETER__FUNCTION, msgs); default: return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); } } return eBasicSetContainer(null, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) { if (eContainerFeatureID >= 0) { switch (eContainerFeatureID) { case FunctionPackage.FUNCTION_PARAMETER__FUNCTION: return eContainer.eInverseRemove(this, FunctionPackage.SCALAR_FUNCTION__INPUT_PARAMETERS, ScalarFunction.class, msgs); default: return eDynamicBasicRemoveFromContainer(msgs); } } return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(EStructuralFeature eFeature, boolean resolve) { switch (eDerivedStructuralFeatureID(eFeature)) { case FunctionPackage.FUNCTION_PARAMETER__FUNCTION: return getFunction(); case FunctionPackage.FUNCTION_PARAMETER__NAME: return getName(); case FunctionPackage.FUNCTION_PARAMETER__TYPE: return getType(); } return eDynamicGet(eFeature, resolve); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(EStructuralFeature eFeature, Object newValue) { switch (eDerivedStructuralFeatureID(eFeature)) { case FunctionPackage.FUNCTION_PARAMETER__FUNCTION: setFunction((ScalarFunction)newValue); return; case FunctionPackage.FUNCTION_PARAMETER__NAME: setName((String)newValue); return; case FunctionPackage.FUNCTION_PARAMETER__TYPE: setType((String)newValue); return; } eDynamicSet(eFeature, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(EStructuralFeature eFeature) { switch (eDerivedStructuralFeatureID(eFeature)) { case FunctionPackage.FUNCTION_PARAMETER__FUNCTION: setFunction((ScalarFunction)null); return; case FunctionPackage.FUNCTION_PARAMETER__NAME: setName(NAME_EDEFAULT); return; case FunctionPackage.FUNCTION_PARAMETER__TYPE: setType(TYPE_EDEFAULT); return; } eDynamicUnset(eFeature); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(EStructuralFeature eFeature) { switch (eDerivedStructuralFeatureID(eFeature)) { case FunctionPackage.FUNCTION_PARAMETER__FUNCTION: return getFunction() != null; case FunctionPackage.FUNCTION_PARAMETER__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case FunctionPackage.FUNCTION_PARAMETER__TYPE: return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type); } return eDynamicIsSet(eFeature); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (name: "); //$NON-NLS-1$ result.append(name); result.append(", type: "); //$NON-NLS-1$ result.append(type); result.append(')'); return result.toString(); } } //FunctionParameterImpl