| /***************************************************************************** |
| * Copyright (c) 2020 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: |
| * Saadia Dhouib (CEA LIST) saadia.dhouib@cea.fr - Initial API and implementation |
| * |
| *****************************************************************************/ |
| package org.eclipse.papyrus.aas.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.aas.AASPackage; |
| import org.eclipse.papyrus.aas.Refereable; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Refereable</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.papyrus.aas.impl.RefereableImpl#getIdShort <em>Id Short</em>}</li> |
| * <li>{@link org.eclipse.papyrus.aas.impl.RefereableImpl#getCategory <em>Category</em>}</li> |
| * <li>{@link org.eclipse.papyrus.aas.impl.RefereableImpl#getDescription <em>Description</em>}</li> |
| * <li>{@link org.eclipse.papyrus.aas.impl.RefereableImpl#getBase_Class <em>Base Class</em>}</li> |
| * <li>{@link org.eclipse.papyrus.aas.impl.RefereableImpl#getParent <em>Parent</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public abstract class RefereableImpl extends MinimalEObjectImpl.Container implements Refereable { |
| /** |
| * The default value of the '{@link #getIdShort() <em>Id Short</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getIdShort() |
| * @generated |
| * @ordered |
| */ |
| protected static final String ID_SHORT_EDEFAULT = null; |
| |
| /** |
| * The default value of the '{@link #getCategory() <em>Category</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getCategory() |
| * @generated |
| * @ordered |
| */ |
| protected static final String CATEGORY_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getCategory() <em>Category</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getCategory() |
| * @generated |
| * @ordered |
| */ |
| protected String category = CATEGORY_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getDescription() <em>Description</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getDescription() |
| * @generated |
| * @ordered |
| */ |
| protected static final String DESCRIPTION_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getDescription() |
| * @generated |
| * @ordered |
| */ |
| protected String description = DESCRIPTION_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getBase_Class() <em>Base Class</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getBase_Class() |
| * @generated |
| * @ordered |
| */ |
| protected org.eclipse.uml2.uml.Class base_Class; |
| |
| /** |
| * The cached value of the '{@link #getParent() <em>Parent</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getParent() |
| * @generated |
| * @ordered |
| */ |
| protected Refereable parent; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| protected RefereableImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AASPackage.Literals.REFEREABLE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public String getIdShort() { |
| // get the name of the Referable Element |
| if (getBase_Class() != null) { |
| String name = getBase_Class().getName(); |
| // remove space |
| if (name != null) { |
| String idShort = name.toLowerCase().replace(" ", ""); |
| return idShort; |
| } |
| } |
| return null; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public String getCategory() { |
| return category; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setCategory(String newCategory) { |
| String oldCategory = category; |
| category = newCategory; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AASPackage.REFEREABLE__CATEGORY, oldCategory, category)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public String getDescription() { |
| return description; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setDescription(String newDescription) { |
| String oldDescription = description; |
| description = newDescription; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AASPackage.REFEREABLE__DESCRIPTION, oldDescription, description)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public org.eclipse.uml2.uml.Class getBase_Class() { |
| if (base_Class != null && base_Class.eIsProxy()) { |
| InternalEObject oldBase_Class = (InternalEObject) base_Class; |
| base_Class = (org.eclipse.uml2.uml.Class) eResolveProxy(oldBase_Class); |
| if (base_Class != oldBase_Class) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, AASPackage.REFEREABLE__BASE_CLASS, oldBase_Class, base_Class)); |
| } |
| } |
| return base_Class; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public org.eclipse.uml2.uml.Class basicGetBase_Class() { |
| return base_Class; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setBase_Class(org.eclipse.uml2.uml.Class newBase_Class) { |
| org.eclipse.uml2.uml.Class oldBase_Class = base_Class; |
| base_Class = newBase_Class; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AASPackage.REFEREABLE__BASE_CLASS, oldBase_Class, base_Class)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public Refereable getParent() { |
| if (parent != null && parent.eIsProxy()) { |
| InternalEObject oldParent = (InternalEObject) parent; |
| parent = (Refereable) eResolveProxy(oldParent); |
| if (parent != oldParent) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, AASPackage.REFEREABLE__PARENT, oldParent, parent)); |
| } |
| } |
| return parent; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public Refereable basicGetParent() { |
| return parent; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setParent(Refereable newParent) { |
| Refereable oldParent = parent; |
| parent = newParent; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AASPackage.REFEREABLE__PARENT, oldParent, parent)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case AASPackage.REFEREABLE__ID_SHORT: |
| return getIdShort(); |
| case AASPackage.REFEREABLE__CATEGORY: |
| return getCategory(); |
| case AASPackage.REFEREABLE__DESCRIPTION: |
| return getDescription(); |
| case AASPackage.REFEREABLE__BASE_CLASS: |
| if (resolve) |
| return getBase_Class(); |
| return basicGetBase_Class(); |
| case AASPackage.REFEREABLE__PARENT: |
| if (resolve) |
| return getParent(); |
| return basicGetParent(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case AASPackage.REFEREABLE__CATEGORY: |
| setCategory((String) newValue); |
| return; |
| case AASPackage.REFEREABLE__DESCRIPTION: |
| setDescription((String) newValue); |
| return; |
| case AASPackage.REFEREABLE__BASE_CLASS: |
| setBase_Class((org.eclipse.uml2.uml.Class) newValue); |
| return; |
| case AASPackage.REFEREABLE__PARENT: |
| setParent((Refereable) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AASPackage.REFEREABLE__CATEGORY: |
| setCategory(CATEGORY_EDEFAULT); |
| return; |
| case AASPackage.REFEREABLE__DESCRIPTION: |
| setDescription(DESCRIPTION_EDEFAULT); |
| return; |
| case AASPackage.REFEREABLE__BASE_CLASS: |
| setBase_Class((org.eclipse.uml2.uml.Class) null); |
| return; |
| case AASPackage.REFEREABLE__PARENT: |
| setParent((Refereable) null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AASPackage.REFEREABLE__ID_SHORT: |
| return ID_SHORT_EDEFAULT == null ? getIdShort() != null : !ID_SHORT_EDEFAULT.equals(getIdShort()); |
| case AASPackage.REFEREABLE__CATEGORY: |
| return CATEGORY_EDEFAULT == null ? category != null : !CATEGORY_EDEFAULT.equals(category); |
| case AASPackage.REFEREABLE__DESCRIPTION: |
| return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description); |
| case AASPackage.REFEREABLE__BASE_CLASS: |
| return base_Class != null; |
| case AASPackage.REFEREABLE__PARENT: |
| return parent != null; |
| } |
| 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(" (category: "); |
| result.append(category); |
| result.append(", description: "); |
| result.append(description); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } // RefereableImpl |