| /** |
| * ******************************************************************************* |
| * 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.AmaltheaPackage; |
| import org.eclipse.app4mc.amalthea.model.Array; |
| import org.eclipse.app4mc.amalthea.model.DataType; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| 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>Array</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.ArrayImpl#getNumberElements <em>Number Elements</em>}</li> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.ArrayImpl#getDataType <em>Data Type</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class ArrayImpl extends CompoundTypeImpl implements Array { |
| /** |
| * The default value of the '{@link #getNumberElements() <em>Number Elements</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getNumberElements() |
| * @generated |
| * @ordered |
| */ |
| protected static final int NUMBER_ELEMENTS_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getNumberElements() <em>Number Elements</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getNumberElements() |
| * @generated |
| * @ordered |
| */ |
| protected int numberElements = NUMBER_ELEMENTS_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getDataType() <em>Data Type</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDataType() |
| * @generated |
| * @ordered |
| */ |
| protected DataType dataType; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ArrayImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AmaltheaPackage.eINSTANCE.getArray(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public int getNumberElements() { |
| return numberElements; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setNumberElements(int newNumberElements) { |
| int oldNumberElements = numberElements; |
| numberElements = newNumberElements; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.ARRAY__NUMBER_ELEMENTS, oldNumberElements, numberElements)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public DataType getDataType() { |
| return dataType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetDataType(DataType newDataType, NotificationChain msgs) { |
| DataType oldDataType = dataType; |
| dataType = newDataType; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AmaltheaPackage.ARRAY__DATA_TYPE, oldDataType, newDataType); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setDataType(DataType newDataType) { |
| if (newDataType != dataType) { |
| NotificationChain msgs = null; |
| if (dataType != null) |
| msgs = ((InternalEObject)dataType).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.ARRAY__DATA_TYPE, null, msgs); |
| if (newDataType != null) |
| msgs = ((InternalEObject)newDataType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.ARRAY__DATA_TYPE, null, msgs); |
| msgs = basicSetDataType(newDataType, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.ARRAY__DATA_TYPE, newDataType, newDataType)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case AmaltheaPackage.ARRAY__DATA_TYPE: |
| return basicSetDataType(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case AmaltheaPackage.ARRAY__NUMBER_ELEMENTS: |
| return getNumberElements(); |
| case AmaltheaPackage.ARRAY__DATA_TYPE: |
| return getDataType(); |
| } |
| 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.ARRAY__NUMBER_ELEMENTS: |
| setNumberElements((Integer)newValue); |
| return; |
| case AmaltheaPackage.ARRAY__DATA_TYPE: |
| setDataType((DataType)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.ARRAY__NUMBER_ELEMENTS: |
| setNumberElements(NUMBER_ELEMENTS_EDEFAULT); |
| return; |
| case AmaltheaPackage.ARRAY__DATA_TYPE: |
| setDataType((DataType)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.ARRAY__NUMBER_ELEMENTS: |
| return numberElements != NUMBER_ELEMENTS_EDEFAULT; |
| case AmaltheaPackage.ARRAY__DATA_TYPE: |
| return dataType != 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(" (numberElements: "); |
| result.append(numberElements); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //ArrayImpl |