| /** |
| * ******************************************************************************* |
| * 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.IDiscreteValueDeviation; |
| import org.eclipse.app4mc.amalthea.model.ProcessingUnitDefinition; |
| import org.eclipse.app4mc.amalthea.model.Ticks; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| import org.eclipse.emf.common.util.EMap; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EStructuralFeature; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.emf.ecore.util.EcoreEMap; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Ticks</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.TicksImpl#getDefault <em>Default</em>}</li> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.TicksImpl#getExtended <em>Extended</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class TicksImpl extends ComputationItemImpl implements Ticks { |
| /** |
| * The cached value of the '{@link #getDefault() <em>Default</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDefault() |
| * @generated |
| * @ordered |
| */ |
| protected IDiscreteValueDeviation default_; |
| |
| /** |
| * The cached value of the '{@link #getExtended() <em>Extended</em>}' map. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getExtended() |
| * @generated |
| * @ordered |
| */ |
| protected EMap<ProcessingUnitDefinition, IDiscreteValueDeviation> extended; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected TicksImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AmaltheaPackage.eINSTANCE.getTicks(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public IDiscreteValueDeviation getDefault() { |
| return default_; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetDefault(IDiscreteValueDeviation newDefault, NotificationChain msgs) { |
| IDiscreteValueDeviation oldDefault = default_; |
| default_ = newDefault; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AmaltheaPackage.TICKS__DEFAULT, oldDefault, newDefault); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setDefault(IDiscreteValueDeviation newDefault) { |
| if (newDefault != default_) { |
| NotificationChain msgs = null; |
| if (default_ != null) |
| msgs = ((InternalEObject)default_).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.TICKS__DEFAULT, null, msgs); |
| if (newDefault != null) |
| msgs = ((InternalEObject)newDefault).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.TICKS__DEFAULT, null, msgs); |
| msgs = basicSetDefault(newDefault, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.TICKS__DEFAULT, newDefault, newDefault)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EMap<ProcessingUnitDefinition, IDiscreteValueDeviation> getExtended() { |
| if (extended == null) { |
| extended = new EcoreEMap<ProcessingUnitDefinition,IDiscreteValueDeviation>(AmaltheaPackage.eINSTANCE.getTicksEntry(), TicksEntryImpl.class, this, AmaltheaPackage.TICKS__EXTENDED); |
| } |
| return extended; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case AmaltheaPackage.TICKS__DEFAULT: |
| return basicSetDefault(null, msgs); |
| case AmaltheaPackage.TICKS__EXTENDED: |
| return ((InternalEList<?>)getExtended()).basicRemove(otherEnd, 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.TICKS__DEFAULT: |
| return getDefault(); |
| case AmaltheaPackage.TICKS__EXTENDED: |
| if (coreType) return getExtended(); |
| else return getExtended().map(); |
| } |
| 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.TICKS__DEFAULT: |
| setDefault((IDiscreteValueDeviation)newValue); |
| return; |
| case AmaltheaPackage.TICKS__EXTENDED: |
| ((EStructuralFeature.Setting)getExtended()).set(newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.TICKS__DEFAULT: |
| setDefault((IDiscreteValueDeviation)null); |
| return; |
| case AmaltheaPackage.TICKS__EXTENDED: |
| getExtended().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.TICKS__DEFAULT: |
| return default_ != null; |
| case AmaltheaPackage.TICKS__EXTENDED: |
| return extended != null && !extended.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //TicksImpl |