/** | |
* Copyright (c) 2020 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\n\nContributors: | |
* Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr | |
* - Initial API and Implementation | |
*/ | |
package org.eclipse.efm.ecore.formalml.infrastructure.impl; | |
import java.util.Collection; | |
import org.eclipse.efm.ecore.formalml.infrastructure.Behavior; | |
import org.eclipse.efm.ecore.formalml.infrastructure.BehaviorPart; | |
import org.eclipse.efm.ecore.formalml.infrastructure.InfrastructurePackage; | |
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.impl.MinimalEObjectImpl; | |
import org.eclipse.emf.ecore.util.EObjectContainmentEList; | |
import org.eclipse.emf.ecore.util.InternalEList; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Behavior Part</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* </p> | |
* <ul> | |
* <li>{@link org.eclipse.efm.ecore.formalml.infrastructure.impl.BehaviorPartImpl#getBehavior <em>Behavior</em>}</li> | |
* <li>{@link org.eclipse.efm.ecore.formalml.infrastructure.impl.BehaviorPartImpl#getMain <em>Main</em>}</li> | |
* </ul> | |
* | |
* @generated | |
*/ | |
public class BehaviorPartImpl extends MinimalEObjectImpl.Container implements BehaviorPart { | |
/** | |
* The cached value of the '{@link #getBehavior() <em>Behavior</em>}' containment reference list. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getBehavior() | |
* @generated | |
* @ordered | |
*/ | |
protected EList<Behavior> behavior; | |
/** | |
* The cached value of the '{@link #getMain() <em>Main</em>}' containment reference. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getMain() | |
* @generated | |
* @ordered | |
*/ | |
protected Behavior main; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected BehaviorPartImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return InfrastructurePackage.Literals.BEHAVIOR_PART; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public EList<Behavior> getBehavior() { | |
if (behavior == null) { | |
behavior = new EObjectContainmentEList<Behavior>(Behavior.class, this, InfrastructurePackage.BEHAVIOR_PART__BEHAVIOR); | |
} | |
return behavior; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public Behavior getMain() { | |
return main; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public NotificationChain basicSetMain(Behavior newMain, NotificationChain msgs) { | |
Behavior oldMain = main; | |
main = newMain; | |
if (eNotificationRequired()) { | |
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, InfrastructurePackage.BEHAVIOR_PART__MAIN, oldMain, newMain); | |
if (msgs == null) msgs = notification; else msgs.add(notification); | |
} | |
return msgs; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void setMain(Behavior newMain) { | |
if (newMain != main) { | |
NotificationChain msgs = null; | |
if (main != null) | |
msgs = ((InternalEObject)main).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - InfrastructurePackage.BEHAVIOR_PART__MAIN, null, msgs); | |
if (newMain != null) | |
msgs = ((InternalEObject)newMain).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - InfrastructurePackage.BEHAVIOR_PART__MAIN, null, msgs); | |
msgs = basicSetMain(newMain, msgs); | |
if (msgs != null) msgs.dispatch(); | |
} | |
else if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, InfrastructurePackage.BEHAVIOR_PART__MAIN, newMain, newMain)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case InfrastructurePackage.BEHAVIOR_PART__BEHAVIOR: | |
return ((InternalEList<?>)getBehavior()).basicRemove(otherEnd, msgs); | |
case InfrastructurePackage.BEHAVIOR_PART__MAIN: | |
return basicSetMain(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 InfrastructurePackage.BEHAVIOR_PART__BEHAVIOR: | |
return getBehavior(); | |
case InfrastructurePackage.BEHAVIOR_PART__MAIN: | |
return getMain(); | |
} | |
return super.eGet(featureID, resolve, coreType); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@SuppressWarnings("unchecked") | |
@Override | |
public void eSet(int featureID, Object newValue) { | |
switch (featureID) { | |
case InfrastructurePackage.BEHAVIOR_PART__BEHAVIOR: | |
getBehavior().clear(); | |
getBehavior().addAll((Collection<? extends Behavior>)newValue); | |
return; | |
case InfrastructurePackage.BEHAVIOR_PART__MAIN: | |
setMain((Behavior)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case InfrastructurePackage.BEHAVIOR_PART__BEHAVIOR: | |
getBehavior().clear(); | |
return; | |
case InfrastructurePackage.BEHAVIOR_PART__MAIN: | |
setMain((Behavior)null); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case InfrastructurePackage.BEHAVIOR_PART__BEHAVIOR: | |
return behavior != null && !behavior.isEmpty(); | |
case InfrastructurePackage.BEHAVIOR_PART__MAIN: | |
return main != null; | |
} | |
return super.eIsSet(featureID); | |
} | |
} //BehaviorPartImpl |