/** * Copyright (c) 2015 committers of YAKINDU and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * Contributors: * committers of YAKINDU - initial API and implementation * */ package org.yakindu.sct.model.sexec.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.yakindu.base.base.BasePackage; import org.yakindu.base.base.NamedElement; import org.yakindu.sct.model.sexec.Check; import org.yakindu.sct.model.sexec.Reaction; import org.yakindu.sct.model.sexec.SexecPackage; import org.yakindu.sct.model.sexec.Step; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Reaction</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link org.yakindu.sct.model.sexec.impl.ReactionImpl#getName <em>Name</em>}</li> * <li>{@link org.yakindu.sct.model.sexec.impl.ReactionImpl#getCheck <em>Check</em>}</li> * <li>{@link org.yakindu.sct.model.sexec.impl.ReactionImpl#getEffect <em>Effect</em>}</li> * <li>{@link org.yakindu.sct.model.sexec.impl.ReactionImpl#isTransition <em>Transition</em>}</li> * </ul> * * @generated */ public class ReactionImpl extends MappedElementImpl implements Reaction { /** * The default value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The cached value of the '{@link #getCheck() <em>Check</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCheck() * @generated * @ordered */ protected Check check; /** * The cached value of the '{@link #getEffect() <em>Effect</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getEffect() * @generated * @ordered */ protected Step effect; /** * The default value of the '{@link #isTransition() <em>Transition</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isTransition() * @generated * @ordered */ protected static final boolean TRANSITION_EDEFAULT = false; /** * The cached value of the '{@link #isTransition() <em>Transition</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isTransition() * @generated * @ordered */ protected boolean transition = TRANSITION_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ReactionImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return SexecPackage.Literals.REACTION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SexecPackage.REACTION__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Check getCheck() { return check; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetCheck(Check newCheck, NotificationChain msgs) { Check oldCheck = check; check = newCheck; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SexecPackage.REACTION__CHECK, oldCheck, newCheck); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setCheck(Check newCheck) { if (newCheck != check) { NotificationChain msgs = null; if (check != null) msgs = ((InternalEObject)check).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SexecPackage.REACTION__CHECK, null, msgs); if (newCheck != null) msgs = ((InternalEObject)newCheck).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SexecPackage.REACTION__CHECK, null, msgs); msgs = basicSetCheck(newCheck, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SexecPackage.REACTION__CHECK, newCheck, newCheck)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Step getEffect() { return effect; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetEffect(Step newEffect, NotificationChain msgs) { Step oldEffect = effect; effect = newEffect; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SexecPackage.REACTION__EFFECT, oldEffect, newEffect); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setEffect(Step newEffect) { if (newEffect != effect) { NotificationChain msgs = null; if (effect != null) msgs = ((InternalEObject)effect).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SexecPackage.REACTION__EFFECT, null, msgs); if (newEffect != null) msgs = ((InternalEObject)newEffect).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SexecPackage.REACTION__EFFECT, null, msgs); msgs = basicSetEffect(newEffect, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SexecPackage.REACTION__EFFECT, newEffect, newEffect)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isTransition() { return transition; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setTransition(boolean newTransition) { boolean oldTransition = transition; transition = newTransition; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SexecPackage.REACTION__TRANSITION, oldTransition, transition)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SexecPackage.REACTION__CHECK: return basicSetCheck(null, msgs); case SexecPackage.REACTION__EFFECT: return basicSetEffect(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 SexecPackage.REACTION__NAME: return getName(); case SexecPackage.REACTION__CHECK: return getCheck(); case SexecPackage.REACTION__EFFECT: return getEffect(); case SexecPackage.REACTION__TRANSITION: return isTransition(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case SexecPackage.REACTION__NAME: setName((String)newValue); return; case SexecPackage.REACTION__CHECK: setCheck((Check)newValue); return; case SexecPackage.REACTION__EFFECT: setEffect((Step)newValue); return; case SexecPackage.REACTION__TRANSITION: setTransition((Boolean)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case SexecPackage.REACTION__NAME: setName(NAME_EDEFAULT); return; case SexecPackage.REACTION__CHECK: setCheck((Check)null); return; case SexecPackage.REACTION__EFFECT: setEffect((Step)null); return; case SexecPackage.REACTION__TRANSITION: setTransition(TRANSITION_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case SexecPackage.REACTION__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case SexecPackage.REACTION__CHECK: return check != null; case SexecPackage.REACTION__EFFECT: return effect != null; case SexecPackage.REACTION__TRANSITION: return transition != TRANSITION_EDEFAULT; } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { if (baseClass == NamedElement.class) { switch (derivedFeatureID) { case SexecPackage.REACTION__NAME: return BasePackage.NAMED_ELEMENT__NAME; default: return -1; } } return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { if (baseClass == NamedElement.class) { switch (baseFeatureID) { case BasePackage.NAMED_ELEMENT__NAME: return SexecPackage.REACTION__NAME; default: return -1; } } return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (name: "); result.append(name); result.append(", transition: "); result.append(transition); result.append(')'); return result.toString(); } } //ReactionImpl