/**
* generated by Xtext 2.23.0
*/
package fr.n7.gAME.impl;
import fr.n7.gAME.Action;
import fr.n7.gAME.Condition;
import fr.n7.gAME.GAMEPackage;
import fr.n7.gAME.Interaction;
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.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EDataTypeEList;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
*
* An implementation of the model object 'Interaction'.
*
*
* The following features are implemented:
*
*
* - {@link fr.n7.gAME.impl.InteractionImpl#getVisible Visible}
* - {@link fr.n7.gAME.impl.InteractionImpl#getConnaissances Connaissances}
* - {@link fr.n7.gAME.impl.InteractionImpl#getObjetsRecus Objets Recus}
* - {@link fr.n7.gAME.impl.InteractionImpl#getObjetsConso Objets Conso}
* - {@link fr.n7.gAME.impl.InteractionImpl#getActions Actions}
*
*
* @generated
*/
public class InteractionImpl extends MinimalEObjectImpl.Container implements Interaction
{
/**
* The cached value of the '{@link #getVisible() Visible}' containment reference.
*
*
* @see #getVisible()
* @generated
* @ordered
*/
protected Condition visible;
/**
* The cached value of the '{@link #getConnaissances() Connaissances}' attribute list.
*
*
* @see #getConnaissances()
* @generated
* @ordered
*/
protected EList connaissances;
/**
* The cached value of the '{@link #getObjetsRecus() Objets Recus}' attribute list.
*
*
* @see #getObjetsRecus()
* @generated
* @ordered
*/
protected EList objetsRecus;
/**
* The cached value of the '{@link #getObjetsConso() Objets Conso}' attribute list.
*
*
* @see #getObjetsConso()
* @generated
* @ordered
*/
protected EList objetsConso;
/**
* The cached value of the '{@link #getActions() Actions}' containment reference list.
*
*
* @see #getActions()
* @generated
* @ordered
*/
protected EList actions;
/**
*
*
* @generated
*/
protected InteractionImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return GAMEPackage.Literals.INTERACTION;
}
/**
*
*
* @generated
*/
@Override
public Condition getVisible()
{
return visible;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetVisible(Condition newVisible, NotificationChain msgs)
{
Condition oldVisible = visible;
visible = newVisible;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GAMEPackage.INTERACTION__VISIBLE, oldVisible, newVisible);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setVisible(Condition newVisible)
{
if (newVisible != visible)
{
NotificationChain msgs = null;
if (visible != null)
msgs = ((InternalEObject)visible).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GAMEPackage.INTERACTION__VISIBLE, null, msgs);
if (newVisible != null)
msgs = ((InternalEObject)newVisible).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GAMEPackage.INTERACTION__VISIBLE, null, msgs);
msgs = basicSetVisible(newVisible, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, GAMEPackage.INTERACTION__VISIBLE, newVisible, newVisible));
}
/**
*
*
* @generated
*/
@Override
public EList getConnaissances()
{
if (connaissances == null)
{
connaissances = new EDataTypeEList(String.class, this, GAMEPackage.INTERACTION__CONNAISSANCES);
}
return connaissances;
}
/**
*
*
* @generated
*/
@Override
public EList getObjetsRecus()
{
if (objetsRecus == null)
{
objetsRecus = new EDataTypeEList(String.class, this, GAMEPackage.INTERACTION__OBJETS_RECUS);
}
return objetsRecus;
}
/**
*
*
* @generated
*/
@Override
public EList getObjetsConso()
{
if (objetsConso == null)
{
objetsConso = new EDataTypeEList(String.class, this, GAMEPackage.INTERACTION__OBJETS_CONSO);
}
return objetsConso;
}
/**
*
*
* @generated
*/
@Override
public EList getActions()
{
if (actions == null)
{
actions = new EObjectContainmentEList(Action.class, this, GAMEPackage.INTERACTION__ACTIONS);
}
return actions;
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case GAMEPackage.INTERACTION__VISIBLE:
return basicSetVisible(null, msgs);
case GAMEPackage.INTERACTION__ACTIONS:
return ((InternalEList>)getActions()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case GAMEPackage.INTERACTION__VISIBLE:
return getVisible();
case GAMEPackage.INTERACTION__CONNAISSANCES:
return getConnaissances();
case GAMEPackage.INTERACTION__OBJETS_RECUS:
return getObjetsRecus();
case GAMEPackage.INTERACTION__OBJETS_CONSO:
return getObjetsConso();
case GAMEPackage.INTERACTION__ACTIONS:
return getActions();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case GAMEPackage.INTERACTION__VISIBLE:
setVisible((Condition)newValue);
return;
case GAMEPackage.INTERACTION__CONNAISSANCES:
getConnaissances().clear();
getConnaissances().addAll((Collection extends String>)newValue);
return;
case GAMEPackage.INTERACTION__OBJETS_RECUS:
getObjetsRecus().clear();
getObjetsRecus().addAll((Collection extends String>)newValue);
return;
case GAMEPackage.INTERACTION__OBJETS_CONSO:
getObjetsConso().clear();
getObjetsConso().addAll((Collection extends String>)newValue);
return;
case GAMEPackage.INTERACTION__ACTIONS:
getActions().clear();
getActions().addAll((Collection extends Action>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case GAMEPackage.INTERACTION__VISIBLE:
setVisible((Condition)null);
return;
case GAMEPackage.INTERACTION__CONNAISSANCES:
getConnaissances().clear();
return;
case GAMEPackage.INTERACTION__OBJETS_RECUS:
getObjetsRecus().clear();
return;
case GAMEPackage.INTERACTION__OBJETS_CONSO:
getObjetsConso().clear();
return;
case GAMEPackage.INTERACTION__ACTIONS:
getActions().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case GAMEPackage.INTERACTION__VISIBLE:
return visible != null;
case GAMEPackage.INTERACTION__CONNAISSANCES:
return connaissances != null && !connaissances.isEmpty();
case GAMEPackage.INTERACTION__OBJETS_RECUS:
return objetsRecus != null && !objetsRecus.isEmpty();
case GAMEPackage.INTERACTION__OBJETS_CONSO:
return objetsConso != null && !objetsConso.isEmpty();
case GAMEPackage.INTERACTION__ACTIONS:
return actions != null && !actions.isEmpty();
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (connaissances: ");
result.append(connaissances);
result.append(", objetsRecus: ");
result.append(objetsRecus);
result.append(", objetsConso: ");
result.append(objetsConso);
result.append(')');
return result.toString();
}
} //InteractionImpl