blob: cea4c6b6c2240d7cd8c20d3e1f690e929e411ab5 [file] [log] [blame]
/**
* *******************************************************************************
* 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 org.eclipse.app4mc.amalthea.model.AmaltheaPackage;
import org.eclipse.app4mc.amalthea.model.IExecutable;
import org.eclipse.app4mc.amalthea.model.INamed;
import org.eclipse.app4mc.amalthea.model.IReferable;
import org.eclipse.app4mc.amalthea.model.LocalModeLabel;
import org.eclipse.app4mc.amalthea.model.Mode;
import org.eclipse.app4mc.amalthea.model.ReferableBaseObject;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
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;
import org.eclipse.emf.ecore.xcore.lib.XcoreCollectionLiterals;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Local Mode Label</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.LocalModeLabelImpl#getContainingExecutable <em>Containing Executable</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.LocalModeLabelImpl#getMode <em>Mode</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.LocalModeLabelImpl#getDefaultValue <em>Default Value</em>}</li>
* </ul>
*
* @generated
*/
public class LocalModeLabelImpl extends ReferableBaseObjectImpl implements LocalModeLabel {
/**
* The cached value of the '{@link #getMode() <em>Mode</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMode()
* @generated
* @ordered
*/
protected Mode mode;
/**
* The default value of the '{@link #getDefaultValue() <em>Default Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDefaultValue()
* @generated
* @ordered
*/
protected static final String DEFAULT_VALUE_EDEFAULT = null;
/**
* The cached value of the '{@link #getDefaultValue() <em>Default Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDefaultValue()
* @generated
* @ordered
*/
protected String defaultValue = DEFAULT_VALUE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected LocalModeLabelImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return AmaltheaPackage.eINSTANCE.getLocalModeLabel();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public IExecutable getContainingExecutable() {
if (eContainerFeatureID() != AmaltheaPackage.LOCAL_MODE_LABEL__CONTAINING_EXECUTABLE) return null;
return (IExecutable)eContainer();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IExecutable basicGetContainingExecutable() {
if (eContainerFeatureID() != AmaltheaPackage.LOCAL_MODE_LABEL__CONTAINING_EXECUTABLE) return null;
return (IExecutable)eInternalContainer();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Mode getMode() {
if (mode != null && mode.eIsProxy()) {
InternalEObject oldMode = (InternalEObject)mode;
mode = (Mode)eResolveProxy(oldMode);
if (mode != oldMode) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, AmaltheaPackage.LOCAL_MODE_LABEL__MODE, oldMode, mode));
}
}
return mode;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Mode basicGetMode() {
return mode;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setMode(Mode newMode) {
Mode oldMode = mode;
mode = newMode;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.LOCAL_MODE_LABEL__MODE, oldMode, mode));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getDefaultValue() {
return defaultValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setDefaultValue(String newDefaultValue) {
String oldDefaultValue = defaultValue;
defaultValue = newDefaultValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.LOCAL_MODE_LABEL__DEFAULT_VALUE, oldDefaultValue, defaultValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<String> getNamePrefixSegments() {
EList<String> _xblockexpression = null; {
final IExecutable exe = this.getContainingExecutable();
EList<String> _xifexpression = null;
if ((exe instanceof INamed)) {
_xifexpression = ((INamed)exe).getQualifiedNameSegments();
}
else {
_xifexpression = XcoreCollectionLiterals.<String>newBasicEList();
}
_xblockexpression = _xifexpression;
}
return _xblockexpression;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AmaltheaPackage.LOCAL_MODE_LABEL__CONTAINING_EXECUTABLE:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return eBasicSetContainer(otherEnd, AmaltheaPackage.LOCAL_MODE_LABEL__CONTAINING_EXECUTABLE, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AmaltheaPackage.LOCAL_MODE_LABEL__CONTAINING_EXECUTABLE:
return eBasicSetContainer(null, AmaltheaPackage.LOCAL_MODE_LABEL__CONTAINING_EXECUTABLE, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
switch (eContainerFeatureID()) {
case AmaltheaPackage.LOCAL_MODE_LABEL__CONTAINING_EXECUTABLE:
return eInternalContainer().eInverseRemove(this, AmaltheaPackage.IEXECUTABLE__LOCAL_LABELS, IExecutable.class, msgs);
}
return super.eBasicRemoveFromContainerFeature(msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case AmaltheaPackage.LOCAL_MODE_LABEL__CONTAINING_EXECUTABLE:
if (resolve) return getContainingExecutable();
return basicGetContainingExecutable();
case AmaltheaPackage.LOCAL_MODE_LABEL__MODE:
if (resolve) return getMode();
return basicGetMode();
case AmaltheaPackage.LOCAL_MODE_LABEL__DEFAULT_VALUE:
return getDefaultValue();
}
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_LABEL__MODE:
setMode((Mode)newValue);
return;
case AmaltheaPackage.LOCAL_MODE_LABEL__DEFAULT_VALUE:
setDefaultValue((String)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_LABEL__MODE:
setMode((Mode)null);
return;
case AmaltheaPackage.LOCAL_MODE_LABEL__DEFAULT_VALUE:
setDefaultValue(DEFAULT_VALUE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AmaltheaPackage.LOCAL_MODE_LABEL__CONTAINING_EXECUTABLE:
return basicGetContainingExecutable() != null;
case AmaltheaPackage.LOCAL_MODE_LABEL__MODE:
return mode != null;
case AmaltheaPackage.LOCAL_MODE_LABEL__DEFAULT_VALUE:
return DEFAULT_VALUE_EDEFAULT == null ? defaultValue != null : !DEFAULT_VALUE_EDEFAULT.equals(defaultValue);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eDerivedOperationID(int baseOperationID, Class<?> baseClass) {
if (baseClass == INamed.class) {
switch (baseOperationID) {
case AmaltheaPackage.INAMED___GET_NAME_PREFIX_SEGMENTS: return AmaltheaPackage.LOCAL_MODE_LABEL___GET_NAME_PREFIX_SEGMENTS;
default: return super.eDerivedOperationID(baseOperationID, baseClass);
}
}
if (baseClass == IReferable.class) {
switch (baseOperationID) {
case AmaltheaPackage.IREFERABLE___GET_NAME_PREFIX_SEGMENTS: return AmaltheaPackage.LOCAL_MODE_LABEL___GET_NAME_PREFIX_SEGMENTS;
default: return super.eDerivedOperationID(baseOperationID, baseClass);
}
}
if (baseClass == ReferableBaseObject.class) {
switch (baseOperationID) {
case AmaltheaPackage.REFERABLE_BASE_OBJECT___GET_NAME_PREFIX_SEGMENTS: return AmaltheaPackage.LOCAL_MODE_LABEL___GET_NAME_PREFIX_SEGMENTS;
default: return super.eDerivedOperationID(baseOperationID, baseClass);
}
}
return super.eDerivedOperationID(baseOperationID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
switch (operationID) {
case AmaltheaPackage.LOCAL_MODE_LABEL___GET_NAME_PREFIX_SEGMENTS:
return getNamePrefixSegments();
}
return super.eInvoke(operationID, arguments);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (defaultValue: ");
result.append(defaultValue);
result.append(')');
return result.toString();
}
} //LocalModeLabelImpl