/***************************************************************************** * 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.DoRule; import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.EntryRule; import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.ExitRule; import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.StateRule; import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.SubmachineRule; import org.eclipse.papyrus.uml.textedit.state.xtext.umlState.UmlStatePackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>State Rule</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.papyrus.uml.textedit.state.xtext.umlState.impl.StateRuleImpl#getName <em>Name</em>}</li> * <li>{@link org.eclipse.papyrus.uml.textedit.state.xtext.umlState.impl.StateRuleImpl#getSubmachine <em>Submachine</em>}</li> * <li>{@link org.eclipse.papyrus.uml.textedit.state.xtext.umlState.impl.StateRuleImpl#getEntry <em>Entry</em>}</li> * <li>{@link org.eclipse.papyrus.uml.textedit.state.xtext.umlState.impl.StateRuleImpl#getDo <em>Do</em>}</li> * <li>{@link org.eclipse.papyrus.uml.textedit.state.xtext.umlState.impl.StateRuleImpl#getExit <em>Exit</em>}</li> * </ul> * </p> * * @generated */ public class StateRuleImpl extends MinimalEObjectImpl.Container implements StateRule { /** * 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 #getSubmachine() <em>Submachine</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSubmachine() * @generated * @ordered */ protected SubmachineRule submachine; /** * The cached value of the '{@link #getEntry() <em>Entry</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getEntry() * @generated * @ordered */ protected EntryRule entry; /** * The cached value of the '{@link #getDo() <em>Do</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getDo() * @generated * @ordered */ protected DoRule do_; /** * The cached value of the '{@link #getExit() <em>Exit</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getExit() * @generated * @ordered */ protected ExitRule exit; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected StateRuleImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return UmlStatePackage.Literals.STATE_RULE; } /** * <!-- 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, UmlStatePackage.STATE_RULE__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SubmachineRule getSubmachine() { return submachine; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetSubmachine(SubmachineRule newSubmachine, NotificationChain msgs) { SubmachineRule oldSubmachine = submachine; submachine = newSubmachine; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UmlStatePackage.STATE_RULE__SUBMACHINE, oldSubmachine, newSubmachine); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setSubmachine(SubmachineRule newSubmachine) { if (newSubmachine != submachine) { NotificationChain msgs = null; if (submachine != null) msgs = ((InternalEObject)submachine).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UmlStatePackage.STATE_RULE__SUBMACHINE, null, msgs); if (newSubmachine != null) msgs = ((InternalEObject)newSubmachine).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UmlStatePackage.STATE_RULE__SUBMACHINE, null, msgs); msgs = basicSetSubmachine(newSubmachine, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, UmlStatePackage.STATE_RULE__SUBMACHINE, newSubmachine, newSubmachine)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EntryRule getEntry() { return entry; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetEntry(EntryRule newEntry, NotificationChain msgs) { EntryRule oldEntry = entry; entry = newEntry; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UmlStatePackage.STATE_RULE__ENTRY, oldEntry, newEntry); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setEntry(EntryRule newEntry) { if (newEntry != entry) { NotificationChain msgs = null; if (entry != null) msgs = ((InternalEObject)entry).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UmlStatePackage.STATE_RULE__ENTRY, null, msgs); if (newEntry != null) msgs = ((InternalEObject)newEntry).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UmlStatePackage.STATE_RULE__ENTRY, null, msgs); msgs = basicSetEntry(newEntry, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, UmlStatePackage.STATE_RULE__ENTRY, newEntry, newEntry)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public DoRule getDo() { return do_; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetDo(DoRule newDo, NotificationChain msgs) { DoRule oldDo = do_; do_ = newDo; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UmlStatePackage.STATE_RULE__DO, oldDo, newDo); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setDo(DoRule newDo) { if (newDo != do_) { NotificationChain msgs = null; if (do_ != null) msgs = ((InternalEObject)do_).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UmlStatePackage.STATE_RULE__DO, null, msgs); if (newDo != null) msgs = ((InternalEObject)newDo).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UmlStatePackage.STATE_RULE__DO, null, msgs); msgs = basicSetDo(newDo, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, UmlStatePackage.STATE_RULE__DO, newDo, newDo)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ExitRule getExit() { return exit; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetExit(ExitRule newExit, NotificationChain msgs) { ExitRule oldExit = exit; exit = newExit; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UmlStatePackage.STATE_RULE__EXIT, oldExit, newExit); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setExit(ExitRule newExit) { if (newExit != exit) { NotificationChain msgs = null; if (exit != null) msgs = ((InternalEObject)exit).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UmlStatePackage.STATE_RULE__EXIT, null, msgs); if (newExit != null) msgs = ((InternalEObject)newExit).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UmlStatePackage.STATE_RULE__EXIT, null, msgs); msgs = basicSetExit(newExit, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, UmlStatePackage.STATE_RULE__EXIT, newExit, newExit)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case UmlStatePackage.STATE_RULE__SUBMACHINE: return basicSetSubmachine(null, msgs); case UmlStatePackage.STATE_RULE__ENTRY: return basicSetEntry(null, msgs); case UmlStatePackage.STATE_RULE__DO: return basicSetDo(null, msgs); case UmlStatePackage.STATE_RULE__EXIT: return basicSetExit(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.STATE_RULE__NAME: return getName(); case UmlStatePackage.STATE_RULE__SUBMACHINE: return getSubmachine(); case UmlStatePackage.STATE_RULE__ENTRY: return getEntry(); case UmlStatePackage.STATE_RULE__DO: return getDo(); case UmlStatePackage.STATE_RULE__EXIT: return getExit(); } 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.STATE_RULE__NAME: setName((String)newValue); return; case UmlStatePackage.STATE_RULE__SUBMACHINE: setSubmachine((SubmachineRule)newValue); return; case UmlStatePackage.STATE_RULE__ENTRY: setEntry((EntryRule)newValue); return; case UmlStatePackage.STATE_RULE__DO: setDo((DoRule)newValue); return; case UmlStatePackage.STATE_RULE__EXIT: setExit((ExitRule)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case UmlStatePackage.STATE_RULE__NAME: setName(NAME_EDEFAULT); return; case UmlStatePackage.STATE_RULE__SUBMACHINE: setSubmachine((SubmachineRule)null); return; case UmlStatePackage.STATE_RULE__ENTRY: setEntry((EntryRule)null); return; case UmlStatePackage.STATE_RULE__DO: setDo((DoRule)null); return; case UmlStatePackage.STATE_RULE__EXIT: setExit((ExitRule)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case UmlStatePackage.STATE_RULE__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case UmlStatePackage.STATE_RULE__SUBMACHINE: return submachine != null; case UmlStatePackage.STATE_RULE__ENTRY: return entry != null; case UmlStatePackage.STATE_RULE__DO: return do_ != null; case UmlStatePackage.STATE_RULE__EXIT: return exit != null; } return super.eIsSet(featureID); } /** * <!-- 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(')'); return result.toString(); } } //StateRuleImpl