| /** |
| * ******************************************************************************* |
| * 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 java.lang.reflect.InvocationTargetException; |
| import java.util.Map; |
| import org.eclipse.app4mc.amalthea.model.AmaltheaPackage; |
| import org.eclipse.app4mc.amalthea.model.AmaltheaValidations; |
| import org.eclipse.app4mc.amalthea.model.ILocalModeValueSource; |
| import org.eclipse.app4mc.amalthea.model.LocalModeLabel; |
| import org.eclipse.app4mc.amalthea.model.LocalModeValue; |
| |
| import org.eclipse.app4mc.amalthea.model.emf.AmaltheaEObjectImpl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| import org.eclipse.emf.common.util.DiagnosticChain; |
| import org.eclipse.emf.common.util.EList; |
| 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>Local Mode Value</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.LocalModeValueImpl#getLabel <em>Label</em>}</li> |
| * <li>{@link org.eclipse.app4mc.amalthea.model.impl.LocalModeValueImpl#getValueSource <em>Value Source</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public abstract class LocalModeValueImpl extends AmaltheaEObjectImpl implements LocalModeValue { |
| /** |
| * The cached value of the '{@link #getLabel() <em>Label</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getLabel() |
| * @generated |
| * @ordered |
| */ |
| protected LocalModeLabel label; |
| |
| /** |
| * The cached value of the '{@link #getValueSource() <em>Value Source</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getValueSource() |
| * @generated |
| * @ordered |
| */ |
| protected ILocalModeValueSource valueSource; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected LocalModeValueImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AmaltheaPackage.eINSTANCE.getLocalModeValue(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public LocalModeLabel getLabel() { |
| if (label != null && label.eIsProxy()) { |
| InternalEObject oldLabel = (InternalEObject)label; |
| label = (LocalModeLabel)eResolveProxy(oldLabel); |
| if (label != oldLabel) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, AmaltheaPackage.LOCAL_MODE_VALUE__LABEL, oldLabel, label)); |
| } |
| } |
| return label; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public LocalModeLabel basicGetLabel() { |
| return label; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setLabel(LocalModeLabel newLabel) { |
| LocalModeLabel oldLabel = label; |
| label = newLabel; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.LOCAL_MODE_VALUE__LABEL, oldLabel, label)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public ILocalModeValueSource getValueSource() { |
| return valueSource; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetValueSource(ILocalModeValueSource newValueSource, NotificationChain msgs) { |
| ILocalModeValueSource oldValueSource = valueSource; |
| valueSource = newValueSource; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AmaltheaPackage.LOCAL_MODE_VALUE__VALUE_SOURCE, oldValueSource, newValueSource); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setValueSource(ILocalModeValueSource newValueSource) { |
| if (newValueSource != valueSource) { |
| NotificationChain msgs = null; |
| if (valueSource != null) |
| msgs = ((InternalEObject)valueSource).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.LOCAL_MODE_VALUE__VALUE_SOURCE, null, msgs); |
| if (newValueSource != null) |
| msgs = ((InternalEObject)newValueSource).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.LOCAL_MODE_VALUE__VALUE_SOURCE, null, msgs); |
| msgs = basicSetValueSource(newValueSource, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.LOCAL_MODE_VALUE__VALUE_SOURCE, newValueSource, newValueSource)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean validateInvariants(final DiagnosticChain diagnostics, final Map<Object, Object> context) { |
| return AmaltheaValidations.validateInvariants(this, diagnostics); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case AmaltheaPackage.LOCAL_MODE_VALUE__VALUE_SOURCE: |
| return basicSetValueSource(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.LOCAL_MODE_VALUE__LABEL: |
| if (resolve) return getLabel(); |
| return basicGetLabel(); |
| case AmaltheaPackage.LOCAL_MODE_VALUE__VALUE_SOURCE: |
| return getValueSource(); |
| } |
| 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.LOCAL_MODE_VALUE__LABEL: |
| setLabel((LocalModeLabel)newValue); |
| return; |
| case AmaltheaPackage.LOCAL_MODE_VALUE__VALUE_SOURCE: |
| setValueSource((ILocalModeValueSource)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.LOCAL_MODE_VALUE__LABEL: |
| setLabel((LocalModeLabel)null); |
| return; |
| case AmaltheaPackage.LOCAL_MODE_VALUE__VALUE_SOURCE: |
| setValueSource((ILocalModeValueSource)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AmaltheaPackage.LOCAL_MODE_VALUE__LABEL: |
| return label != null; |
| case AmaltheaPackage.LOCAL_MODE_VALUE__VALUE_SOURCE: |
| return valueSource != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| @SuppressWarnings("unchecked") |
| public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException { |
| switch (operationID) { |
| case AmaltheaPackage.LOCAL_MODE_VALUE___VALIDATE_INVARIANTS__DIAGNOSTICCHAIN_MAP: |
| return validateInvariants((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1)); |
| } |
| return super.eInvoke(operationID, arguments); |
| } |
| |
| } //LocalModeValueImpl |