| /** |
| * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * 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 |
| * |
| * Based on ideas from Xtext, Xtend, Xcore |
| * |
| * Contributors: |
| * Christophe Loetz - Initial implementation |
| * |
| */ |
| package org.eclipse.osbp.xtext.functionlibrarydsl.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.MinimalEObjectImpl; |
| |
| import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryDSLPackage; |
| import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryParameter; |
| |
| import org.eclipse.xtext.common.types.JvmTypeReference; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Function Library Parameter</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.osbp.xtext.functionlibrarydsl.impl.FunctionLibraryParameterImpl#getName <em>Name</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.functionlibrarydsl.impl.FunctionLibraryParameterImpl#getParameterType <em>Parameter Type</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class FunctionLibraryParameterImpl extends MinimalEObjectImpl.Container implements FunctionLibraryParameter { |
| /** |
| * 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 #getParameterType() <em>Parameter Type</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getParameterType() |
| * @generated |
| * @ordered |
| */ |
| protected JvmTypeReference parameterType; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected FunctionLibraryParameterImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FunctionLibraryDSLPackage.Literals.FUNCTION_LIBRARY_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, FunctionLibraryDSLPackage.FUNCTION_LIBRARY_PARAMETER__NAME, oldName, name)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public JvmTypeReference getParameterType() { |
| return parameterType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetParameterType(JvmTypeReference newParameterType, NotificationChain msgs) { |
| JvmTypeReference oldParameterType = parameterType; |
| parameterType = newParameterType; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FunctionLibraryDSLPackage.FUNCTION_LIBRARY_PARAMETER__PARAMETER_TYPE, oldParameterType, newParameterType); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setParameterType(JvmTypeReference newParameterType) { |
| if (newParameterType != parameterType) { |
| NotificationChain msgs = null; |
| if (parameterType != null) |
| msgs = ((InternalEObject)parameterType).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FunctionLibraryDSLPackage.FUNCTION_LIBRARY_PARAMETER__PARAMETER_TYPE, null, msgs); |
| if (newParameterType != null) |
| msgs = ((InternalEObject)newParameterType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FunctionLibraryDSLPackage.FUNCTION_LIBRARY_PARAMETER__PARAMETER_TYPE, null, msgs); |
| msgs = basicSetParameterType(newParameterType, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FunctionLibraryDSLPackage.FUNCTION_LIBRARY_PARAMETER__PARAMETER_TYPE, newParameterType, newParameterType)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FunctionLibraryDSLPackage.FUNCTION_LIBRARY_PARAMETER__PARAMETER_TYPE: |
| return basicSetParameterType(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 FunctionLibraryDSLPackage.FUNCTION_LIBRARY_PARAMETER__NAME: |
| return getName(); |
| case FunctionLibraryDSLPackage.FUNCTION_LIBRARY_PARAMETER__PARAMETER_TYPE: |
| return getParameterType(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case FunctionLibraryDSLPackage.FUNCTION_LIBRARY_PARAMETER__NAME: |
| setName((String)newValue); |
| return; |
| case FunctionLibraryDSLPackage.FUNCTION_LIBRARY_PARAMETER__PARAMETER_TYPE: |
| setParameterType((JvmTypeReference)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FunctionLibraryDSLPackage.FUNCTION_LIBRARY_PARAMETER__NAME: |
| setName(NAME_EDEFAULT); |
| return; |
| case FunctionLibraryDSLPackage.FUNCTION_LIBRARY_PARAMETER__PARAMETER_TYPE: |
| setParameterType((JvmTypeReference)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FunctionLibraryDSLPackage.FUNCTION_LIBRARY_PARAMETER__NAME: |
| return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
| case FunctionLibraryDSLPackage.FUNCTION_LIBRARY_PARAMETER__PARAMETER_TYPE: |
| return parameterType != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- 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: "); |
| result.append(name); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //FunctionLibraryParameterImpl |