| /** |
| * Copyright (c) 2013 CEA LIST |
| * |
| * All rights reserved. This program and the accompanying materials are |
| * made available under the terms of the Eclipse Public License 2.0 which |
| * accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * CEA LIST - Initial API and implementation |
| * |
| */ |
| package org.eclipse.papyrus.designer.languages.cpp.profile.C_Cpp.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| 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.papyrus.designer.languages.cpp.profile.C_Cpp.C_CppPackage; |
| import org.eclipse.papyrus.designer.languages.cpp.profile.C_Cpp.Ptr; |
| import org.eclipse.uml2.uml.Parameter; |
| import org.eclipse.uml2.uml.Property; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Ptr</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.papyrus.designer.languages.cpp.profile.C_Cpp.impl.PtrImpl#getBase_parameter <em>Base parameter</em>}</li> |
| * <li>{@link org.eclipse.papyrus.designer.languages.cpp.profile.C_Cpp.impl.PtrImpl#getBase_property <em>Base property</em>}</li> |
| * <li>{@link org.eclipse.papyrus.designer.languages.cpp.profile.C_Cpp.impl.PtrImpl#getDeclaration <em>Declaration</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class PtrImpl extends MinimalEObjectImpl.Container implements Ptr { |
| /** |
| * The cached value of the '{@link #getBase_parameter() <em>Base parameter</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getBase_parameter() |
| * @generated |
| * @ordered |
| */ |
| protected Parameter base_parameter; |
| |
| /** |
| * The cached value of the '{@link #getBase_property() <em>Base property</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getBase_property() |
| * @generated |
| * @ordered |
| */ |
| protected Property base_property; |
| |
| /** |
| * The default value of the '{@link #getDeclaration() <em>Declaration</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDeclaration() |
| * @generated |
| * @ordered |
| */ |
| protected static final String DECLARATION_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getDeclaration() <em>Declaration</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDeclaration() |
| * @generated |
| * @ordered |
| */ |
| protected String declaration = DECLARATION_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected PtrImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return C_CppPackage.Literals.PTR; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Parameter getBase_parameter() { |
| if (base_parameter != null && base_parameter.eIsProxy()) { |
| InternalEObject oldBase_parameter = (InternalEObject)base_parameter; |
| base_parameter = (Parameter)eResolveProxy(oldBase_parameter); |
| if (base_parameter != oldBase_parameter) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, C_CppPackage.PTR__BASE_PARAMETER, oldBase_parameter, base_parameter)); |
| } |
| } |
| return base_parameter; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Parameter basicGetBase_parameter() { |
| return base_parameter; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setBase_parameter(Parameter newBase_parameter) { |
| Parameter oldBase_parameter = base_parameter; |
| base_parameter = newBase_parameter; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, C_CppPackage.PTR__BASE_PARAMETER, oldBase_parameter, base_parameter)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Property getBase_property() { |
| if (base_property != null && base_property.eIsProxy()) { |
| InternalEObject oldBase_property = (InternalEObject)base_property; |
| base_property = (Property)eResolveProxy(oldBase_property); |
| if (base_property != oldBase_property) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, C_CppPackage.PTR__BASE_PROPERTY, oldBase_property, base_property)); |
| } |
| } |
| return base_property; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Property basicGetBase_property() { |
| return base_property; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setBase_property(Property newBase_property) { |
| Property oldBase_property = base_property; |
| base_property = newBase_property; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, C_CppPackage.PTR__BASE_PROPERTY, oldBase_property, base_property)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String getDeclaration() { |
| return declaration; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setDeclaration(String newDeclaration) { |
| String oldDeclaration = declaration; |
| declaration = newDeclaration; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, C_CppPackage.PTR__DECLARATION, oldDeclaration, declaration)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case C_CppPackage.PTR__BASE_PARAMETER: |
| if (resolve) return getBase_parameter(); |
| return basicGetBase_parameter(); |
| case C_CppPackage.PTR__BASE_PROPERTY: |
| if (resolve) return getBase_property(); |
| return basicGetBase_property(); |
| case C_CppPackage.PTR__DECLARATION: |
| return getDeclaration(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case C_CppPackage.PTR__BASE_PARAMETER: |
| setBase_parameter((Parameter)newValue); |
| return; |
| case C_CppPackage.PTR__BASE_PROPERTY: |
| setBase_property((Property)newValue); |
| return; |
| case C_CppPackage.PTR__DECLARATION: |
| setDeclaration((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case C_CppPackage.PTR__BASE_PARAMETER: |
| setBase_parameter((Parameter)null); |
| return; |
| case C_CppPackage.PTR__BASE_PROPERTY: |
| setBase_property((Property)null); |
| return; |
| case C_CppPackage.PTR__DECLARATION: |
| setDeclaration(DECLARATION_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case C_CppPackage.PTR__BASE_PARAMETER: |
| return base_parameter != null; |
| case C_CppPackage.PTR__BASE_PROPERTY: |
| return base_property != null; |
| case C_CppPackage.PTR__DECLARATION: |
| return DECLARATION_EDEFAULT == null ? declaration != null : !DECLARATION_EDEFAULT.equals(declaration); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuilder result = new StringBuilder(super.toString()); |
| result.append(" (declaration: "); //$NON-NLS-1$ |
| result.append(declaration); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } // PtrImpl |