| /***************************************************************************** |
| * 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.papyrus.aas.AASPackage; |
| import org.eclipse.papyrus.aas.Asset; |
| import org.eclipse.papyrus.aas.Entity; |
| import org.eclipse.papyrus.aas.EntityType; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Entity</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.papyrus.aas.impl.EntityImpl#getEntityType <em>Entity Type</em>}</li> |
| * <li>{@link org.eclipse.papyrus.aas.impl.EntityImpl#getAsset <em>Asset</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class EntityImpl extends SubmodelElementImpl implements Entity { |
| /** |
| * The default value of the '{@link #getEntityType() <em>Entity Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getEntityType() |
| * @generated |
| * @ordered |
| */ |
| protected static final EntityType ENTITY_TYPE_EDEFAULT = EntityType.CO_MANAGED_ENTITY; |
| |
| /** |
| * The cached value of the '{@link #getEntityType() <em>Entity Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getEntityType() |
| * @generated |
| * @ordered |
| */ |
| protected EntityType entityType = ENTITY_TYPE_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getAsset() <em>Asset</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getAsset() |
| * @generated |
| * @ordered |
| */ |
| protected Asset asset; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| protected EntityImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AASPackage.Literals.ENTITY; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public EntityType getEntityType() { |
| return entityType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setEntityType(EntityType newEntityType) { |
| EntityType oldEntityType = entityType; |
| entityType = newEntityType == null ? ENTITY_TYPE_EDEFAULT : newEntityType; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AASPackage.ENTITY__ENTITY_TYPE, oldEntityType, entityType)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public Asset getAsset() { |
| if (asset != null && asset.eIsProxy()) { |
| InternalEObject oldAsset = (InternalEObject) asset; |
| asset = (Asset) eResolveProxy(oldAsset); |
| if (asset != oldAsset) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, AASPackage.ENTITY__ASSET, oldAsset, asset)); |
| } |
| } |
| return asset; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public Asset basicGetAsset() { |
| return asset; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setAsset(Asset newAsset) { |
| Asset oldAsset = asset; |
| asset = newAsset; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AASPackage.ENTITY__ASSET, oldAsset, asset)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case AASPackage.ENTITY__ENTITY_TYPE: |
| return getEntityType(); |
| case AASPackage.ENTITY__ASSET: |
| if (resolve) |
| return getAsset(); |
| return basicGetAsset(); |
| } |
| 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.ENTITY__ENTITY_TYPE: |
| setEntityType((EntityType) newValue); |
| return; |
| case AASPackage.ENTITY__ASSET: |
| setAsset((Asset) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AASPackage.ENTITY__ENTITY_TYPE: |
| setEntityType(ENTITY_TYPE_EDEFAULT); |
| return; |
| case AASPackage.ENTITY__ASSET: |
| setAsset((Asset) null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AASPackage.ENTITY__ENTITY_TYPE: |
| return entityType != ENTITY_TYPE_EDEFAULT; |
| case AASPackage.ENTITY__ASSET: |
| return asset != 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(" (entityType: "); |
| result.append(entityType); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } // EntityImpl |