| /** |
| * ******************************************************************************* |
| * 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.AbstractMemoryElement; |
| import org.eclipse.app4mc.amalthea.model.AmaltheaPackage; |
| import org.eclipse.app4mc.amalthea.model.Memory; |
| import org.eclipse.app4mc.amalthea.model.MemoryMapping; |
| |
| 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; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Memory Mapping</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.MemoryMappingImpl#getAbstractElement <em>Abstract Element</em>}</li> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.MemoryMappingImpl#getMemory <em>Memory</em>}</li> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.MemoryMappingImpl#getMemoryPositionAddress <em>Memory Position Address</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class MemoryMappingImpl extends BaseObjectImpl implements MemoryMapping { |
| /** |
| * The cached value of the '{@link #getAbstractElement() <em>Abstract Element</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getAbstractElement() |
| * @generated |
| * @ordered |
| */ |
| protected AbstractMemoryElement abstractElement; |
| |
| /** |
| * The cached value of the '{@link #getMemory() <em>Memory</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMemory() |
| * @generated |
| * @ordered |
| */ |
| protected Memory memory; |
| |
| /** |
| * The default value of the '{@link #getMemoryPositionAddress() <em>Memory Position Address</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMemoryPositionAddress() |
| * @generated |
| * @ordered |
| */ |
| protected static final long MEMORY_POSITION_ADDRESS_EDEFAULT = 0L; |
| |
| /** |
| * The cached value of the '{@link #getMemoryPositionAddress() <em>Memory Position Address</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMemoryPositionAddress() |
| * @generated |
| * @ordered |
| */ |
| protected long memoryPositionAddress = MEMORY_POSITION_ADDRESS_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected MemoryMappingImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AmaltheaPackage.eINSTANCE.getMemoryMapping(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public AbstractMemoryElement getAbstractElement() { |
| if (abstractElement != null && abstractElement.eIsProxy()) { |
| InternalEObject oldAbstractElement = (InternalEObject)abstractElement; |
| abstractElement = (AbstractMemoryElement)eResolveProxy(oldAbstractElement); |
| if (abstractElement != oldAbstractElement) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, AmaltheaPackage.MEMORY_MAPPING__ABSTRACT_ELEMENT, oldAbstractElement, abstractElement)); |
| } |
| } |
| return abstractElement; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public AbstractMemoryElement basicGetAbstractElement() { |
| return abstractElement; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setAbstractElement(AbstractMemoryElement newAbstractElement) { |
| AbstractMemoryElement oldAbstractElement = abstractElement; |
| abstractElement = newAbstractElement; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.MEMORY_MAPPING__ABSTRACT_ELEMENT, oldAbstractElement, abstractElement)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Memory getMemory() { |
| if (memory != null && memory.eIsProxy()) { |
| InternalEObject oldMemory = (InternalEObject)memory; |
| memory = (Memory)eResolveProxy(oldMemory); |
| if (memory != oldMemory) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, AmaltheaPackage.MEMORY_MAPPING__MEMORY, oldMemory, memory)); |
| } |
| } |
| return memory; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Memory basicGetMemory() { |
| return memory; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setMemory(Memory newMemory) { |
| Memory oldMemory = memory; |
| memory = newMemory; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.MEMORY_MAPPING__MEMORY, oldMemory, memory)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public long getMemoryPositionAddress() { |
| return memoryPositionAddress; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setMemoryPositionAddress(long newMemoryPositionAddress) { |
| long oldMemoryPositionAddress = memoryPositionAddress; |
| memoryPositionAddress = newMemoryPositionAddress; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.MEMORY_MAPPING__MEMORY_POSITION_ADDRESS, oldMemoryPositionAddress, memoryPositionAddress)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case AmaltheaPackage.MEMORY_MAPPING__ABSTRACT_ELEMENT: |
| if (resolve) return getAbstractElement(); |
| return basicGetAbstractElement(); |
| case AmaltheaPackage.MEMORY_MAPPING__MEMORY: |
| if (resolve) return getMemory(); |
| return basicGetMemory(); |
| case AmaltheaPackage.MEMORY_MAPPING__MEMORY_POSITION_ADDRESS: |
| return getMemoryPositionAddress(); |
| } |
| 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_MAPPING__ABSTRACT_ELEMENT: |
| setAbstractElement((AbstractMemoryElement)newValue); |
| return; |
| case AmaltheaPackage.MEMORY_MAPPING__MEMORY: |
| setMemory((Memory)newValue); |
| return; |
| case AmaltheaPackage.MEMORY_MAPPING__MEMORY_POSITION_ADDRESS: |
| setMemoryPositionAddress((Long)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.MEMORY_MAPPING__ABSTRACT_ELEMENT: |
| setAbstractElement((AbstractMemoryElement)null); |
| return; |
| case AmaltheaPackage.MEMORY_MAPPING__MEMORY: |
| setMemory((Memory)null); |
| return; |
| case AmaltheaPackage.MEMORY_MAPPING__MEMORY_POSITION_ADDRESS: |
| setMemoryPositionAddress(MEMORY_POSITION_ADDRESS_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.MEMORY_MAPPING__ABSTRACT_ELEMENT: |
| return abstractElement != null; |
| case AmaltheaPackage.MEMORY_MAPPING__MEMORY: |
| return memory != null; |
| case AmaltheaPackage.MEMORY_MAPPING__MEMORY_POSITION_ADDRESS: |
| return memoryPositionAddress != MEMORY_POSITION_ADDRESS_EDEFAULT; |
| } |
| 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(" (memoryPositionAddress: "); |
| result.append(memoryPositionAddress); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //MemoryMappingImpl |