| /** |
| * ******************************************************************************* |
| * Copyright (c) 2015-2021 Robert Bosch GmbH and others. |
| * |
| * This program and the accompanying materials are made |
| * available under the terms of the Eclipse Public License 2.0 |
| * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Generated using Eclipse EMF |
| * |
| * ******************************************************************************* |
| */ |
| package org.eclipse.app4mc.amalthea.model.impl; |
| |
| import org.eclipse.app4mc.amalthea.model.AmaltheaIndex; |
| import org.eclipse.app4mc.amalthea.model.AmaltheaPackage; |
| import org.eclipse.app4mc.amalthea.model.Memory; |
| import org.eclipse.app4mc.amalthea.model.MemoryDefinition; |
| import org.eclipse.app4mc.amalthea.model.MemoryMapping; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| |
| import org.eclipse.emf.common.util.EList; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EReference; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Memory</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.MemoryImpl#getDefinition <em>Definition</em>}</li> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.MemoryImpl#getMappings <em>Mappings</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class MemoryImpl extends HwModuleImpl implements Memory { |
| /** |
| * The cached value of the '{@link #getDefinition() <em>Definition</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDefinition() |
| * @generated |
| * @ordered |
| */ |
| protected MemoryDefinition definition; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected MemoryImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AmaltheaPackage.eINSTANCE.getMemory(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public MemoryDefinition getDefinition() { |
| if (definition != null && definition.eIsProxy()) { |
| InternalEObject oldDefinition = (InternalEObject)definition; |
| definition = (MemoryDefinition)eResolveProxy(oldDefinition); |
| if (definition != oldDefinition) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, AmaltheaPackage.MEMORY__DEFINITION, oldDefinition, definition)); |
| } |
| } |
| return definition; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public MemoryDefinition basicGetDefinition() { |
| return definition; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setDefinition(MemoryDefinition newDefinition) { |
| MemoryDefinition oldDefinition = definition; |
| definition = newDefinition; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.MEMORY__DEFINITION, oldDefinition, definition)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EList<MemoryMapping> getMappings() { |
| EReference _memoryMapping_Memory = AmaltheaPackage.eINSTANCE.getMemoryMapping_Memory(); |
| return AmaltheaIndex.<MemoryMapping>getInverseReferences(this, AmaltheaPackage.eINSTANCE.getMemory_Mappings(), |
| java.util.Collections.<EReference>unmodifiableSet(org.eclipse.xtext.xbase.lib.CollectionLiterals.<EReference>newHashSet(_memoryMapping_Memory))); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case AmaltheaPackage.MEMORY__DEFINITION: |
| if (resolve) return getDefinition(); |
| return basicGetDefinition(); |
| case AmaltheaPackage.MEMORY__MAPPINGS: |
| return getMappings(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case AmaltheaPackage.MEMORY__DEFINITION: |
| setDefinition((MemoryDefinition)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.MEMORY__DEFINITION: |
| setDefinition((MemoryDefinition)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.MEMORY__DEFINITION: |
| return definition != null; |
| case AmaltheaPackage.MEMORY__MAPPINGS: |
| return !getMappings().isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //MemoryImpl |