/**
*/
package fr.obeo.intent.specification.impl;
import fr.obeo.intent.specification.Action;
import fr.obeo.intent.specification.AutomationLayer;
import fr.obeo.intent.specification.Behaviour;
import fr.obeo.intent.specification.Context;
import fr.obeo.intent.specification.SpecificationPackage;
import java.util.Collection;
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.EObjectImpl;
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>Automation Layer</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link fr.obeo.intent.specification.impl.AutomationLayerImpl#getContext <em>Context</em>}</li>
* <li>{@link fr.obeo.intent.specification.impl.AutomationLayerImpl#getActions <em>Actions</em>}</li>
* <li>{@link fr.obeo.intent.specification.impl.AutomationLayerImpl#getBehaviours <em>Behaviours</em>}</li>
* <li>{@link fr.obeo.intent.specification.impl.AutomationLayerImpl#getBasePackage <em>Base Package</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class AutomationLayerImpl extends EObjectImpl implements AutomationLayer {
/**
* The cached value of the '{@link #getContext() <em>Context</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getContext()
* @generated
* @ordered
*/
protected EList<Context> context;
/**
* The cached value of the '{@link #getActions() <em>Actions</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getActions()
* @generated
* @ordered
*/
protected EList<Action> actions;
/**
* The cached value of the '{@link #getBehaviours() <em>Behaviours</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBehaviours()
* @generated
* @ordered
*/
protected EList<Behaviour> behaviours;
/**
* The default value of the '{@link #getBasePackage() <em>Base Package</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBasePackage()
* @generated
* @ordered
*/
protected static final String BASE_PACKAGE_EDEFAULT = null;
/**
* The cached value of the '{@link #getBasePackage() <em>Base Package</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBasePackage()
* @generated
* @ordered
*/
protected String basePackage = BASE_PACKAGE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected AutomationLayerImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return SpecificationPackage.Literals.AUTOMATION_LAYER;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Context> getContext() {
if (context == null) {
context = new EObjectContainmentEList<Context>(Context.class, this, SpecificationPackage.AUTOMATION_LAYER__CONTEXT);
}
return context;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Action> getActions() {
if (actions == null) {
actions = new EObjectContainmentEList<Action>(Action.class, this, SpecificationPackage.AUTOMATION_LAYER__ACTIONS);
}
return actions;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Behaviour> getBehaviours() {
if (behaviours == null) {
behaviours = new EObjectContainmentEList<Behaviour>(Behaviour.class, this, SpecificationPackage.AUTOMATION_LAYER__BEHAVIOURS);
}
return behaviours;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getBasePackage() {
return basePackage;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBasePackage(String newBasePackage) {
String oldBasePackage = basePackage;
basePackage = newBasePackage;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SpecificationPackage.AUTOMATION_LAYER__BASE_PACKAGE, oldBasePackage, basePackage));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case SpecificationPackage.AUTOMATION_LAYER__CONTEXT:
return ((InternalEList<?>)getContext()).basicRemove(otherEnd, msgs);
case SpecificationPackage.AUTOMATION_LAYER__ACTIONS:
return ((InternalEList<?>)getActions()).basicRemove(otherEnd, msgs);
case SpecificationPackage.AUTOMATION_LAYER__BEHAVIOURS:
return ((InternalEList<?>)getBehaviours()).basicRemove(otherEnd, 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 SpecificationPackage.AUTOMATION_LAYER__CONTEXT:
return getContext();
case SpecificationPackage.AUTOMATION_LAYER__ACTIONS:
return getActions();
case SpecificationPackage.AUTOMATION_LAYER__BEHAVIOURS:
return getBehaviours();
case SpecificationPackage.AUTOMATION_LAYER__BASE_PACKAGE:
return getBasePackage();
}
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 SpecificationPackage.AUTOMATION_LAYER__CONTEXT:
getContext().clear();
getContext().addAll((Collection<? extends Context>)newValue);
return;
case SpecificationPackage.AUTOMATION_LAYER__ACTIONS:
getActions().clear();
getActions().addAll((Collection<? extends Action>)newValue);
return;
case SpecificationPackage.AUTOMATION_LAYER__BEHAVIOURS:
getBehaviours().clear();
getBehaviours().addAll((Collection<? extends Behaviour>)newValue);
return;
case SpecificationPackage.AUTOMATION_LAYER__BASE_PACKAGE:
setBasePackage((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case SpecificationPackage.AUTOMATION_LAYER__CONTEXT:
getContext().clear();
return;
case SpecificationPackage.AUTOMATION_LAYER__ACTIONS:
getActions().clear();
return;
case SpecificationPackage.AUTOMATION_LAYER__BEHAVIOURS:
getBehaviours().clear();
return;
case SpecificationPackage.AUTOMATION_LAYER__BASE_PACKAGE:
setBasePackage(BASE_PACKAGE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case SpecificationPackage.AUTOMATION_LAYER__CONTEXT:
return context != null && !context.isEmpty();
case SpecificationPackage.AUTOMATION_LAYER__ACTIONS:
return actions != null && !actions.isEmpty();
case SpecificationPackage.AUTOMATION_LAYER__BEHAVIOURS:
return behaviours != null && !behaviours.isEmpty();
case SpecificationPackage.AUTOMATION_LAYER__BASE_PACKAGE:
return BASE_PACKAGE_EDEFAULT == null ? basePackage != null : !BASE_PACKAGE_EDEFAULT.equals(basePackage);
}
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(" (basePackage: ");
result.append(basePackage);
result.append(')');
return result.toString();
}
} //AutomationLayerImpl