2021-11-30 17:25:45 +00:00
|
|
|
/**
|
|
|
|
* generated by Xtext 2.23.0
|
|
|
|
*/
|
2021-12-03 08:38:29 +00:00
|
|
|
package fr.n7.gAME.impl;
|
2021-12-03 07:37:31 +00:00
|
|
|
|
2021-12-03 08:38:29 +00:00
|
|
|
import fr.n7.gAME.Condition;
|
|
|
|
import fr.n7.gAME.Connaissance;
|
|
|
|
import fr.n7.gAME.Description;
|
|
|
|
import fr.n7.gAME.GAMEPackage;
|
2021-11-30 17:25:45 +00:00
|
|
|
|
|
|
|
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.EObjectContainmentEList;
|
|
|
|
import org.eclipse.emf.ecore.util.InternalEList;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* An implementation of the model object '<em><b>Connaissance</b></em>'.
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* <p>
|
|
|
|
* The following features are implemented:
|
|
|
|
* </p>
|
|
|
|
* <ul>
|
2021-12-03 08:38:29 +00:00
|
|
|
* <li>{@link fr.n7.gAME.impl.ConnaissanceImpl#getNom <em>Nom</em>}</li>
|
|
|
|
* <li>{@link fr.n7.gAME.impl.ConnaissanceImpl#getVisible <em>Visible</em>}</li>
|
|
|
|
* <li>{@link fr.n7.gAME.impl.ConnaissanceImpl#getDescriptions <em>Descriptions</em>}</li>
|
2021-11-30 17:25:45 +00:00
|
|
|
* </ul>
|
|
|
|
*
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
public class ConnaissanceImpl extends MinimalEObjectImpl.Container implements Connaissance
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The default value of the '{@link #getNom() <em>Nom</em>}' attribute.
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @see #getNom()
|
|
|
|
* @generated
|
|
|
|
* @ordered
|
|
|
|
*/
|
|
|
|
protected static final String NOM_EDEFAULT = null;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The cached value of the '{@link #getNom() <em>Nom</em>}' attribute.
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @see #getNom()
|
|
|
|
* @generated
|
|
|
|
* @ordered
|
|
|
|
*/
|
|
|
|
protected String nom = NOM_EDEFAULT;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The cached value of the '{@link #getVisible() <em>Visible</em>}' containment reference.
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @see #getVisible()
|
|
|
|
* @generated
|
|
|
|
* @ordered
|
|
|
|
*/
|
|
|
|
protected Condition visible;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The cached value of the '{@link #getDescriptions() <em>Descriptions</em>}' containment reference list.
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @see #getDescriptions()
|
|
|
|
* @generated
|
|
|
|
* @ordered
|
|
|
|
*/
|
|
|
|
protected EList<Description> descriptions;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
protected ConnaissanceImpl()
|
|
|
|
{
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
protected EClass eStaticClass()
|
|
|
|
{
|
2021-12-03 08:38:29 +00:00
|
|
|
return GAMEPackage.Literals.CONNAISSANCE;
|
2021-11-30 17:25:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public String getNom()
|
|
|
|
{
|
|
|
|
return nom;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public void setNom(String newNom)
|
|
|
|
{
|
|
|
|
String oldNom = nom;
|
|
|
|
nom = newNom;
|
|
|
|
if (eNotificationRequired())
|
2021-12-03 08:38:29 +00:00
|
|
|
eNotify(new ENotificationImpl(this, Notification.SET, GAMEPackage.CONNAISSANCE__NOM, oldNom, nom));
|
2021-11-30 17:25:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public Condition getVisible()
|
|
|
|
{
|
|
|
|
return visible;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
public NotificationChain basicSetVisible(Condition newVisible, NotificationChain msgs)
|
|
|
|
{
|
|
|
|
Condition oldVisible = visible;
|
|
|
|
visible = newVisible;
|
|
|
|
if (eNotificationRequired())
|
|
|
|
{
|
2021-12-03 08:38:29 +00:00
|
|
|
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GAMEPackage.CONNAISSANCE__VISIBLE, oldVisible, newVisible);
|
2021-11-30 17:25:45 +00:00
|
|
|
if (msgs == null) msgs = notification; else msgs.add(notification);
|
|
|
|
}
|
|
|
|
return msgs;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public void setVisible(Condition newVisible)
|
|
|
|
{
|
|
|
|
if (newVisible != visible)
|
|
|
|
{
|
|
|
|
NotificationChain msgs = null;
|
|
|
|
if (visible != null)
|
2021-12-03 08:38:29 +00:00
|
|
|
msgs = ((InternalEObject)visible).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GAMEPackage.CONNAISSANCE__VISIBLE, null, msgs);
|
2021-11-30 17:25:45 +00:00
|
|
|
if (newVisible != null)
|
2021-12-03 08:38:29 +00:00
|
|
|
msgs = ((InternalEObject)newVisible).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GAMEPackage.CONNAISSANCE__VISIBLE, null, msgs);
|
2021-11-30 17:25:45 +00:00
|
|
|
msgs = basicSetVisible(newVisible, msgs);
|
|
|
|
if (msgs != null) msgs.dispatch();
|
|
|
|
}
|
|
|
|
else if (eNotificationRequired())
|
2021-12-03 08:38:29 +00:00
|
|
|
eNotify(new ENotificationImpl(this, Notification.SET, GAMEPackage.CONNAISSANCE__VISIBLE, newVisible, newVisible));
|
2021-11-30 17:25:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public EList<Description> getDescriptions()
|
|
|
|
{
|
|
|
|
if (descriptions == null)
|
|
|
|
{
|
2021-12-03 08:38:29 +00:00
|
|
|
descriptions = new EObjectContainmentEList<Description>(Description.class, this, GAMEPackage.CONNAISSANCE__DESCRIPTIONS);
|
2021-11-30 17:25:45 +00:00
|
|
|
}
|
|
|
|
return descriptions;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
|
|
|
|
{
|
|
|
|
switch (featureID)
|
|
|
|
{
|
2021-12-03 08:38:29 +00:00
|
|
|
case GAMEPackage.CONNAISSANCE__VISIBLE:
|
2021-11-30 17:25:45 +00:00
|
|
|
return basicSetVisible(null, msgs);
|
2021-12-03 08:38:29 +00:00
|
|
|
case GAMEPackage.CONNAISSANCE__DESCRIPTIONS:
|
2021-11-30 17:25:45 +00:00
|
|
|
return ((InternalEList<?>)getDescriptions()).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)
|
|
|
|
{
|
2021-12-03 08:38:29 +00:00
|
|
|
case GAMEPackage.CONNAISSANCE__NOM:
|
2021-11-30 17:25:45 +00:00
|
|
|
return getNom();
|
2021-12-03 08:38:29 +00:00
|
|
|
case GAMEPackage.CONNAISSANCE__VISIBLE:
|
2021-11-30 17:25:45 +00:00
|
|
|
return getVisible();
|
2021-12-03 08:38:29 +00:00
|
|
|
case GAMEPackage.CONNAISSANCE__DESCRIPTIONS:
|
2021-11-30 17:25:45 +00:00
|
|
|
return getDescriptions();
|
|
|
|
}
|
|
|
|
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)
|
|
|
|
{
|
2021-12-03 08:38:29 +00:00
|
|
|
case GAMEPackage.CONNAISSANCE__NOM:
|
2021-11-30 17:25:45 +00:00
|
|
|
setNom((String)newValue);
|
|
|
|
return;
|
2021-12-03 08:38:29 +00:00
|
|
|
case GAMEPackage.CONNAISSANCE__VISIBLE:
|
2021-11-30 17:25:45 +00:00
|
|
|
setVisible((Condition)newValue);
|
|
|
|
return;
|
2021-12-03 08:38:29 +00:00
|
|
|
case GAMEPackage.CONNAISSANCE__DESCRIPTIONS:
|
2021-11-30 17:25:45 +00:00
|
|
|
getDescriptions().clear();
|
|
|
|
getDescriptions().addAll((Collection<? extends Description>)newValue);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
super.eSet(featureID, newValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public void eUnset(int featureID)
|
|
|
|
{
|
|
|
|
switch (featureID)
|
|
|
|
{
|
2021-12-03 08:38:29 +00:00
|
|
|
case GAMEPackage.CONNAISSANCE__NOM:
|
2021-11-30 17:25:45 +00:00
|
|
|
setNom(NOM_EDEFAULT);
|
|
|
|
return;
|
2021-12-03 08:38:29 +00:00
|
|
|
case GAMEPackage.CONNAISSANCE__VISIBLE:
|
2021-11-30 17:25:45 +00:00
|
|
|
setVisible((Condition)null);
|
|
|
|
return;
|
2021-12-03 08:38:29 +00:00
|
|
|
case GAMEPackage.CONNAISSANCE__DESCRIPTIONS:
|
2021-11-30 17:25:45 +00:00
|
|
|
getDescriptions().clear();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
super.eUnset(featureID);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public boolean eIsSet(int featureID)
|
|
|
|
{
|
|
|
|
switch (featureID)
|
|
|
|
{
|
2021-12-03 08:38:29 +00:00
|
|
|
case GAMEPackage.CONNAISSANCE__NOM:
|
2021-11-30 17:25:45 +00:00
|
|
|
return NOM_EDEFAULT == null ? nom != null : !NOM_EDEFAULT.equals(nom);
|
2021-12-03 08:38:29 +00:00
|
|
|
case GAMEPackage.CONNAISSANCE__VISIBLE:
|
2021-11-30 17:25:45 +00:00
|
|
|
return visible != null;
|
2021-12-03 08:38:29 +00:00
|
|
|
case GAMEPackage.CONNAISSANCE__DESCRIPTIONS:
|
2021-11-30 17:25:45 +00:00
|
|
|
return descriptions != null && !descriptions.isEmpty();
|
|
|
|
}
|
|
|
|
return super.eIsSet(featureID);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public String toString()
|
|
|
|
{
|
|
|
|
if (eIsProxy()) return super.toString();
|
|
|
|
|
|
|
|
StringBuilder result = new StringBuilder(super.toString());
|
|
|
|
result.append(" (nom: ");
|
|
|
|
result.append(nom);
|
|
|
|
result.append(')');
|
|
|
|
return result.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
} //ConnaissanceImpl
|