/***************************************************************************** * Copyright (c) 2010 CEA LIST. * * * 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: * CEA LIST - Initial API and implementation * *****************************************************************************/ package org.eclipse.papyrus.uml.textedit.state.xtext.umlState.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.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.QualifiedName; import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.SubmachineRule; import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.UmlStatePackage; import org.eclipse.uml2.uml.StateMachine; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Submachine Rule</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.papyrus.uml.textedit.state.xtext.umlState.impl.SubmachineRuleImpl#getPath <em>Path</em>}</li> * <li>{@link org.eclipse.papyrus.uml.textedit.state.xtext.umlState.impl.SubmachineRuleImpl#getSubmachine <em>Submachine</em>}</li> * </ul> * </p> * * @generated */ public class SubmachineRuleImpl extends MinimalEObjectImpl.Container implements SubmachineRule { /** * The cached value of the '{@link #getPath() <em>Path</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getPath() * @generated * @ordered */ protected QualifiedName path; /** * The cached value of the '{@link #getSubmachine() <em>Submachine</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSubmachine() * @generated * @ordered */ protected StateMachine submachine; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected SubmachineRuleImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return UmlStatePackage.Literals.SUBMACHINE_RULE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public QualifiedName getPath() { return path; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetPath(QualifiedName newPath, NotificationChain msgs) { QualifiedName oldPath = path; path = newPath; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UmlStatePackage.SUBMACHINE_RULE__PATH, oldPath, newPath); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setPath(QualifiedName newPath) { if (newPath != path) { NotificationChain msgs = null; if (path != null) msgs = ((InternalEObject)path).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UmlStatePackage.SUBMACHINE_RULE__PATH, null, msgs); if (newPath != null) msgs = ((InternalEObject)newPath).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UmlStatePackage.SUBMACHINE_RULE__PATH, null, msgs); msgs = basicSetPath(newPath, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, UmlStatePackage.SUBMACHINE_RULE__PATH, newPath, newPath)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public StateMachine getSubmachine() { if (submachine != null && submachine.eIsProxy()) { InternalEObject oldSubmachine = (InternalEObject)submachine; submachine = (StateMachine)eResolveProxy(oldSubmachine); if (submachine != oldSubmachine) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, UmlStatePackage.SUBMACHINE_RULE__SUBMACHINE, oldSubmachine, submachine)); } } return submachine; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public StateMachine basicGetSubmachine() { return submachine; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setSubmachine(StateMachine newSubmachine) { StateMachine oldSubmachine = submachine; submachine = newSubmachine; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, UmlStatePackage.SUBMACHINE_RULE__SUBMACHINE, oldSubmachine, submachine)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case UmlStatePackage.SUBMACHINE_RULE__PATH: return basicSetPath(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 UmlStatePackage.SUBMACHINE_RULE__PATH: return getPath(); case UmlStatePackage.SUBMACHINE_RULE__SUBMACHINE: if (resolve) return getSubmachine(); return basicGetSubmachine(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case UmlStatePackage.SUBMACHINE_RULE__PATH: setPath((QualifiedName)newValue); return; case UmlStatePackage.SUBMACHINE_RULE__SUBMACHINE: setSubmachine((StateMachine)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case UmlStatePackage.SUBMACHINE_RULE__PATH: setPath((QualifiedName)null); return; case UmlStatePackage.SUBMACHINE_RULE__SUBMACHINE: setSubmachine((StateMachine)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case UmlStatePackage.SUBMACHINE_RULE__PATH: return path != null; case UmlStatePackage.SUBMACHINE_RULE__SUBMACHINE: return submachine != null; } return super.eIsSet(featureID); } } //SubmachineRuleImpl