blob: 8f835d66cd01d4255da035b4458a65ecd94701f3 [file] [log] [blame]
/**
* Copyright (c) 2011, 2017 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Based on ideas from Xtext, Xtend, Xcore
*
* Contributors:
* Joerg Riegel - Initial implementation
*
*/
package org.eclipse.osbp.xtext.statemachine.impl;
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;
import org.eclipse.osbp.xtext.statemachine.FSMControlFieldAttribute;
import org.eclipse.osbp.xtext.statemachine.FSMFieldType;
import org.eclipse.osbp.xtext.statemachine.StatemachineDSLPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>FSM Control Field Attribute</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.statemachine.impl.FSMControlFieldAttributeImpl#getAttributeType <em>Attribute Type</em>}</li>
* </ul>
*
* @generated
*/
public class FSMControlFieldAttributeImpl extends FSMBaseImpl implements FSMControlFieldAttribute {
/**
* The cached value of the '{@link #getAttributeType() <em>Attribute Type</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAttributeType()
* @generated
* @ordered
*/
protected FSMFieldType attributeType;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected FSMControlFieldAttributeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return StatemachineDSLPackage.Literals.FSM_CONTROL_FIELD_ATTRIBUTE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FSMFieldType getAttributeType() {
return attributeType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetAttributeType(FSMFieldType newAttributeType, NotificationChain msgs) {
FSMFieldType oldAttributeType = attributeType;
attributeType = newAttributeType;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StatemachineDSLPackage.FSM_CONTROL_FIELD_ATTRIBUTE__ATTRIBUTE_TYPE, oldAttributeType, newAttributeType);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAttributeType(FSMFieldType newAttributeType) {
if (newAttributeType != attributeType) {
NotificationChain msgs = null;
if (attributeType != null)
msgs = ((InternalEObject)attributeType).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StatemachineDSLPackage.FSM_CONTROL_FIELD_ATTRIBUTE__ATTRIBUTE_TYPE, null, msgs);
if (newAttributeType != null)
msgs = ((InternalEObject)newAttributeType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StatemachineDSLPackage.FSM_CONTROL_FIELD_ATTRIBUTE__ATTRIBUTE_TYPE, null, msgs);
msgs = basicSetAttributeType(newAttributeType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StatemachineDSLPackage.FSM_CONTROL_FIELD_ATTRIBUTE__ATTRIBUTE_TYPE, newAttributeType, newAttributeType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case StatemachineDSLPackage.FSM_CONTROL_FIELD_ATTRIBUTE__ATTRIBUTE_TYPE:
return basicSetAttributeType(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 StatemachineDSLPackage.FSM_CONTROL_FIELD_ATTRIBUTE__ATTRIBUTE_TYPE:
return getAttributeType();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case StatemachineDSLPackage.FSM_CONTROL_FIELD_ATTRIBUTE__ATTRIBUTE_TYPE:
setAttributeType((FSMFieldType)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case StatemachineDSLPackage.FSM_CONTROL_FIELD_ATTRIBUTE__ATTRIBUTE_TYPE:
setAttributeType((FSMFieldType)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case StatemachineDSLPackage.FSM_CONTROL_FIELD_ATTRIBUTE__ATTRIBUTE_TYPE:
return attributeType != null;
}
return super.eIsSet(featureID);
}
} //FSMControlFieldAttributeImpl