2021-11-30 17:25:45 +00:00
|
|
|
/**
|
|
|
|
* generated by Xtext 2.23.0
|
|
|
|
*/
|
2021-12-03 07:37:31 +00:00
|
|
|
package fr.n7.game.impl;
|
|
|
|
|
|
|
|
import fr.n7.game.Connaissance;
|
|
|
|
import fr.n7.game.Explorateur;
|
|
|
|
import fr.n7.game.GamePackage;
|
|
|
|
import fr.n7.game.Jeu;
|
|
|
|
import fr.n7.game.Objet;
|
|
|
|
import fr.n7.game.Personne;
|
|
|
|
import fr.n7.game.Territoire;
|
|
|
|
import fr.n7.game.Transformation;
|
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>Jeu</b></em>'.
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* <p>
|
|
|
|
* The following features are implemented:
|
|
|
|
* </p>
|
|
|
|
* <ul>
|
2021-12-03 07:37:31 +00:00
|
|
|
* <li>{@link fr.n7.game.impl.JeuImpl#getExplorateur <em>Explorateur</em>}</li>
|
|
|
|
* <li>{@link fr.n7.game.impl.JeuImpl#getTerritoire <em>Territoire</em>}</li>
|
|
|
|
* <li>{@link fr.n7.game.impl.JeuImpl#getObjets <em>Objets</em>}</li>
|
|
|
|
* <li>{@link fr.n7.game.impl.JeuImpl#getConnaissances <em>Connaissances</em>}</li>
|
|
|
|
* <li>{@link fr.n7.game.impl.JeuImpl#getPersonnes <em>Personnes</em>}</li>
|
|
|
|
* <li>{@link fr.n7.game.impl.JeuImpl#getTransformations <em>Transformations</em>}</li>
|
2021-11-30 17:25:45 +00:00
|
|
|
* </ul>
|
|
|
|
*
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
public class JeuImpl extends MinimalEObjectImpl.Container implements Jeu
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The cached value of the '{@link #getExplorateur() <em>Explorateur</em>}' containment reference.
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @see #getExplorateur()
|
|
|
|
* @generated
|
|
|
|
* @ordered
|
|
|
|
*/
|
|
|
|
protected Explorateur explorateur;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The cached value of the '{@link #getTerritoire() <em>Territoire</em>}' containment reference.
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @see #getTerritoire()
|
|
|
|
* @generated
|
|
|
|
* @ordered
|
|
|
|
*/
|
|
|
|
protected Territoire territoire;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The cached value of the '{@link #getObjets() <em>Objets</em>}' containment reference list.
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @see #getObjets()
|
|
|
|
* @generated
|
|
|
|
* @ordered
|
|
|
|
*/
|
|
|
|
protected EList<Objet> objets;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The cached value of the '{@link #getConnaissances() <em>Connaissances</em>}' containment reference list.
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @see #getConnaissances()
|
|
|
|
* @generated
|
|
|
|
* @ordered
|
|
|
|
*/
|
|
|
|
protected EList<Connaissance> connaissances;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The cached value of the '{@link #getPersonnes() <em>Personnes</em>}' containment reference list.
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @see #getPersonnes()
|
|
|
|
* @generated
|
|
|
|
* @ordered
|
|
|
|
*/
|
|
|
|
protected EList<Personne> personnes;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The cached value of the '{@link #getTransformations() <em>Transformations</em>}' containment reference list.
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @see #getTransformations()
|
|
|
|
* @generated
|
|
|
|
* @ordered
|
|
|
|
*/
|
|
|
|
protected EList<Transformation> transformations;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
protected JeuImpl()
|
|
|
|
{
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
protected EClass eStaticClass()
|
|
|
|
{
|
|
|
|
return GamePackage.Literals.JEU;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public Explorateur getExplorateur()
|
|
|
|
{
|
|
|
|
return explorateur;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
public NotificationChain basicSetExplorateur(Explorateur newExplorateur, NotificationChain msgs)
|
|
|
|
{
|
|
|
|
Explorateur oldExplorateur = explorateur;
|
|
|
|
explorateur = newExplorateur;
|
|
|
|
if (eNotificationRequired())
|
|
|
|
{
|
|
|
|
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GamePackage.JEU__EXPLORATEUR, oldExplorateur, newExplorateur);
|
|
|
|
if (msgs == null) msgs = notification; else msgs.add(notification);
|
|
|
|
}
|
|
|
|
return msgs;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public void setExplorateur(Explorateur newExplorateur)
|
|
|
|
{
|
|
|
|
if (newExplorateur != explorateur)
|
|
|
|
{
|
|
|
|
NotificationChain msgs = null;
|
|
|
|
if (explorateur != null)
|
|
|
|
msgs = ((InternalEObject)explorateur).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GamePackage.JEU__EXPLORATEUR, null, msgs);
|
|
|
|
if (newExplorateur != null)
|
|
|
|
msgs = ((InternalEObject)newExplorateur).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GamePackage.JEU__EXPLORATEUR, null, msgs);
|
|
|
|
msgs = basicSetExplorateur(newExplorateur, msgs);
|
|
|
|
if (msgs != null) msgs.dispatch();
|
|
|
|
}
|
|
|
|
else if (eNotificationRequired())
|
|
|
|
eNotify(new ENotificationImpl(this, Notification.SET, GamePackage.JEU__EXPLORATEUR, newExplorateur, newExplorateur));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public Territoire getTerritoire()
|
|
|
|
{
|
|
|
|
return territoire;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
public NotificationChain basicSetTerritoire(Territoire newTerritoire, NotificationChain msgs)
|
|
|
|
{
|
|
|
|
Territoire oldTerritoire = territoire;
|
|
|
|
territoire = newTerritoire;
|
|
|
|
if (eNotificationRequired())
|
|
|
|
{
|
|
|
|
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GamePackage.JEU__TERRITOIRE, oldTerritoire, newTerritoire);
|
|
|
|
if (msgs == null) msgs = notification; else msgs.add(notification);
|
|
|
|
}
|
|
|
|
return msgs;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public void setTerritoire(Territoire newTerritoire)
|
|
|
|
{
|
|
|
|
if (newTerritoire != territoire)
|
|
|
|
{
|
|
|
|
NotificationChain msgs = null;
|
|
|
|
if (territoire != null)
|
|
|
|
msgs = ((InternalEObject)territoire).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GamePackage.JEU__TERRITOIRE, null, msgs);
|
|
|
|
if (newTerritoire != null)
|
|
|
|
msgs = ((InternalEObject)newTerritoire).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GamePackage.JEU__TERRITOIRE, null, msgs);
|
|
|
|
msgs = basicSetTerritoire(newTerritoire, msgs);
|
|
|
|
if (msgs != null) msgs.dispatch();
|
|
|
|
}
|
|
|
|
else if (eNotificationRequired())
|
|
|
|
eNotify(new ENotificationImpl(this, Notification.SET, GamePackage.JEU__TERRITOIRE, newTerritoire, newTerritoire));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public EList<Objet> getObjets()
|
|
|
|
{
|
|
|
|
if (objets == null)
|
|
|
|
{
|
|
|
|
objets = new EObjectContainmentEList<Objet>(Objet.class, this, GamePackage.JEU__OBJETS);
|
|
|
|
}
|
|
|
|
return objets;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public EList<Connaissance> getConnaissances()
|
|
|
|
{
|
|
|
|
if (connaissances == null)
|
|
|
|
{
|
|
|
|
connaissances = new EObjectContainmentEList<Connaissance>(Connaissance.class, this, GamePackage.JEU__CONNAISSANCES);
|
|
|
|
}
|
|
|
|
return connaissances;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public EList<Personne> getPersonnes()
|
|
|
|
{
|
|
|
|
if (personnes == null)
|
|
|
|
{
|
|
|
|
personnes = new EObjectContainmentEList<Personne>(Personne.class, this, GamePackage.JEU__PERSONNES);
|
|
|
|
}
|
|
|
|
return personnes;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public EList<Transformation> getTransformations()
|
|
|
|
{
|
|
|
|
if (transformations == null)
|
|
|
|
{
|
|
|
|
transformations = new EObjectContainmentEList<Transformation>(Transformation.class, this, GamePackage.JEU__TRANSFORMATIONS);
|
|
|
|
}
|
|
|
|
return transformations;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
|
|
|
|
{
|
|
|
|
switch (featureID)
|
|
|
|
{
|
|
|
|
case GamePackage.JEU__EXPLORATEUR:
|
|
|
|
return basicSetExplorateur(null, msgs);
|
|
|
|
case GamePackage.JEU__TERRITOIRE:
|
|
|
|
return basicSetTerritoire(null, msgs);
|
|
|
|
case GamePackage.JEU__OBJETS:
|
|
|
|
return ((InternalEList<?>)getObjets()).basicRemove(otherEnd, msgs);
|
|
|
|
case GamePackage.JEU__CONNAISSANCES:
|
|
|
|
return ((InternalEList<?>)getConnaissances()).basicRemove(otherEnd, msgs);
|
|
|
|
case GamePackage.JEU__PERSONNES:
|
|
|
|
return ((InternalEList<?>)getPersonnes()).basicRemove(otherEnd, msgs);
|
|
|
|
case GamePackage.JEU__TRANSFORMATIONS:
|
|
|
|
return ((InternalEList<?>)getTransformations()).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 GamePackage.JEU__EXPLORATEUR:
|
|
|
|
return getExplorateur();
|
|
|
|
case GamePackage.JEU__TERRITOIRE:
|
|
|
|
return getTerritoire();
|
|
|
|
case GamePackage.JEU__OBJETS:
|
|
|
|
return getObjets();
|
|
|
|
case GamePackage.JEU__CONNAISSANCES:
|
|
|
|
return getConnaissances();
|
|
|
|
case GamePackage.JEU__PERSONNES:
|
|
|
|
return getPersonnes();
|
|
|
|
case GamePackage.JEU__TRANSFORMATIONS:
|
|
|
|
return getTransformations();
|
|
|
|
}
|
|
|
|
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 GamePackage.JEU__EXPLORATEUR:
|
|
|
|
setExplorateur((Explorateur)newValue);
|
|
|
|
return;
|
|
|
|
case GamePackage.JEU__TERRITOIRE:
|
|
|
|
setTerritoire((Territoire)newValue);
|
|
|
|
return;
|
|
|
|
case GamePackage.JEU__OBJETS:
|
|
|
|
getObjets().clear();
|
|
|
|
getObjets().addAll((Collection<? extends Objet>)newValue);
|
|
|
|
return;
|
|
|
|
case GamePackage.JEU__CONNAISSANCES:
|
|
|
|
getConnaissances().clear();
|
|
|
|
getConnaissances().addAll((Collection<? extends Connaissance>)newValue);
|
|
|
|
return;
|
|
|
|
case GamePackage.JEU__PERSONNES:
|
|
|
|
getPersonnes().clear();
|
|
|
|
getPersonnes().addAll((Collection<? extends Personne>)newValue);
|
|
|
|
return;
|
|
|
|
case GamePackage.JEU__TRANSFORMATIONS:
|
|
|
|
getTransformations().clear();
|
|
|
|
getTransformations().addAll((Collection<? extends Transformation>)newValue);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
super.eSet(featureID, newValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public void eUnset(int featureID)
|
|
|
|
{
|
|
|
|
switch (featureID)
|
|
|
|
{
|
|
|
|
case GamePackage.JEU__EXPLORATEUR:
|
|
|
|
setExplorateur((Explorateur)null);
|
|
|
|
return;
|
|
|
|
case GamePackage.JEU__TERRITOIRE:
|
|
|
|
setTerritoire((Territoire)null);
|
|
|
|
return;
|
|
|
|
case GamePackage.JEU__OBJETS:
|
|
|
|
getObjets().clear();
|
|
|
|
return;
|
|
|
|
case GamePackage.JEU__CONNAISSANCES:
|
|
|
|
getConnaissances().clear();
|
|
|
|
return;
|
|
|
|
case GamePackage.JEU__PERSONNES:
|
|
|
|
getPersonnes().clear();
|
|
|
|
return;
|
|
|
|
case GamePackage.JEU__TRANSFORMATIONS:
|
|
|
|
getTransformations().clear();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
super.eUnset(featureID);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <!-- begin-user-doc -->
|
|
|
|
* <!-- end-user-doc -->
|
|
|
|
* @generated
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public boolean eIsSet(int featureID)
|
|
|
|
{
|
|
|
|
switch (featureID)
|
|
|
|
{
|
|
|
|
case GamePackage.JEU__EXPLORATEUR:
|
|
|
|
return explorateur != null;
|
|
|
|
case GamePackage.JEU__TERRITOIRE:
|
|
|
|
return territoire != null;
|
|
|
|
case GamePackage.JEU__OBJETS:
|
|
|
|
return objets != null && !objets.isEmpty();
|
|
|
|
case GamePackage.JEU__CONNAISSANCES:
|
|
|
|
return connaissances != null && !connaissances.isEmpty();
|
|
|
|
case GamePackage.JEU__PERSONNES:
|
|
|
|
return personnes != null && !personnes.isEmpty();
|
|
|
|
case GamePackage.JEU__TRANSFORMATIONS:
|
|
|
|
return transformations != null && !transformations.isEmpty();
|
|
|
|
}
|
|
|
|
return super.eIsSet(featureID);
|
|
|
|
}
|
|
|
|
|
|
|
|
} //JeuImpl
|