blob: cc4b8d123f94ae6b36e08ea8f37a083ad8516119 [file] [log] [blame]
/**
* 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.statemachine.impl;
import java.util.Collection;
import org.eclipse.efm.ecore.formalml.common.impl.NamedElementImpl;
import org.eclipse.efm.ecore.formalml.infrastructure.ModelOfExecution;
import org.eclipse.efm.ecore.formalml.statemachine.StatemachinePackage;
import org.eclipse.efm.ecore.formalml.statemachine.Transition;
import org.eclipse.efm.ecore.formalml.statemachine.Vertex;
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.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Vertex</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.efm.ecore.formalml.statemachine.impl.VertexImpl#getTransition <em>Transition</em>}</li>
* <li>{@link org.eclipse.efm.ecore.formalml.statemachine.impl.VertexImpl#getMoe <em>Moe</em>}</li>
* </ul>
*
* @generated
*/
public class VertexImpl extends NamedElementImpl implements Vertex {
/**
* The cached value of the '{@link #getTransition() <em>Transition</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTransition()
* @generated
* @ordered
*/
protected EList<Transition> transition;
/**
* The cached value of the '{@link #getMoe() <em>Moe</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMoe()
* @generated
* @ordered
*/
protected ModelOfExecution moe;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected VertexImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return StatemachinePackage.Literals.VERTEX;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<Transition> getTransition() {
if (transition == null) {
transition = new EObjectContainmentEList<Transition>(Transition.class, this, StatemachinePackage.VERTEX__TRANSITION);
}
return transition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ModelOfExecution getMoe() {
return moe;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetMoe(ModelOfExecution newMoe, NotificationChain msgs) {
ModelOfExecution oldMoe = moe;
moe = newMoe;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StatemachinePackage.VERTEX__MOE, oldMoe, newMoe);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setMoe(ModelOfExecution newMoe) {
if (newMoe != moe) {
NotificationChain msgs = null;
if (moe != null)
msgs = ((InternalEObject)moe).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StatemachinePackage.VERTEX__MOE, null, msgs);
if (newMoe != null)
msgs = ((InternalEObject)newMoe).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StatemachinePackage.VERTEX__MOE, null, msgs);
msgs = basicSetMoe(newMoe, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StatemachinePackage.VERTEX__MOE, newMoe, newMoe));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case StatemachinePackage.VERTEX__TRANSITION:
return ((InternalEList<?>)getTransition()).basicRemove(otherEnd, msgs);
case StatemachinePackage.VERTEX__MOE:
return basicSetMoe(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 StatemachinePackage.VERTEX__TRANSITION:
return getTransition();
case StatemachinePackage.VERTEX__MOE:
return getMoe();
}
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 StatemachinePackage.VERTEX__TRANSITION:
getTransition().clear();
getTransition().addAll((Collection<? extends Transition>)newValue);
return;
case StatemachinePackage.VERTEX__MOE:
setMoe((ModelOfExecution)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case StatemachinePackage.VERTEX__TRANSITION:
getTransition().clear();
return;
case StatemachinePackage.VERTEX__MOE:
setMoe((ModelOfExecution)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case StatemachinePackage.VERTEX__TRANSITION:
return transition != null && !transition.isEmpty();
case StatemachinePackage.VERTEX__MOE:
return moe != null;
}
return super.eIsSet(featureID);
}
} //VertexImpl