377 lines
8.9 KiB
Java
377 lines
8.9 KiB
Java
/**
|
|
* generated by Xtext 2.23.0
|
|
*/
|
|
package fr.n7.gAME.impl;
|
|
|
|
import fr.n7.gAME.Condition;
|
|
import fr.n7.gAME.Description;
|
|
import fr.n7.gAME.GAMEPackage;
|
|
import fr.n7.gAME.Objet;
|
|
|
|
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>Objet</b></em>'.
|
|
* <!-- end-user-doc -->
|
|
* <p>
|
|
* The following features are implemented:
|
|
* </p>
|
|
* <ul>
|
|
* <li>{@link fr.n7.gAME.impl.ObjetImpl#getNom <em>Nom</em>}</li>
|
|
* <li>{@link fr.n7.gAME.impl.ObjetImpl#getTaille <em>Taille</em>}</li>
|
|
* <li>{@link fr.n7.gAME.impl.ObjetImpl#getVisible <em>Visible</em>}</li>
|
|
* <li>{@link fr.n7.gAME.impl.ObjetImpl#getDescriptions <em>Descriptions</em>}</li>
|
|
* </ul>
|
|
*
|
|
* @generated
|
|
*/
|
|
public class ObjetImpl extends MinimalEObjectImpl.Container implements Objet
|
|
{
|
|
/**
|
|
* 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 default value of the '{@link #getTaille() <em>Taille</em>}' attribute.
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @see #getTaille()
|
|
* @generated
|
|
* @ordered
|
|
*/
|
|
protected static final int TAILLE_EDEFAULT = 0;
|
|
|
|
/**
|
|
* The cached value of the '{@link #getTaille() <em>Taille</em>}' attribute.
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @see #getTaille()
|
|
* @generated
|
|
* @ordered
|
|
*/
|
|
protected int taille = TAILLE_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 ObjetImpl()
|
|
{
|
|
super();
|
|
}
|
|
|
|
/**
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @generated
|
|
*/
|
|
@Override
|
|
protected EClass eStaticClass()
|
|
{
|
|
return GAMEPackage.Literals.OBJET;
|
|
}
|
|
|
|
/**
|
|
* <!-- 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())
|
|
eNotify(new ENotificationImpl(this, Notification.SET, GAMEPackage.OBJET__NOM, oldNom, nom));
|
|
}
|
|
|
|
/**
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @generated
|
|
*/
|
|
@Override
|
|
public int getTaille()
|
|
{
|
|
return taille;
|
|
}
|
|
|
|
/**
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @generated
|
|
*/
|
|
@Override
|
|
public void setTaille(int newTaille)
|
|
{
|
|
int oldTaille = taille;
|
|
taille = newTaille;
|
|
if (eNotificationRequired())
|
|
eNotify(new ENotificationImpl(this, Notification.SET, GAMEPackage.OBJET__TAILLE, oldTaille, taille));
|
|
}
|
|
|
|
/**
|
|
* <!-- 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())
|
|
{
|
|
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GAMEPackage.OBJET__VISIBLE, oldVisible, newVisible);
|
|
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)
|
|
msgs = ((InternalEObject)visible).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GAMEPackage.OBJET__VISIBLE, null, msgs);
|
|
if (newVisible != null)
|
|
msgs = ((InternalEObject)newVisible).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GAMEPackage.OBJET__VISIBLE, null, msgs);
|
|
msgs = basicSetVisible(newVisible, msgs);
|
|
if (msgs != null) msgs.dispatch();
|
|
}
|
|
else if (eNotificationRequired())
|
|
eNotify(new ENotificationImpl(this, Notification.SET, GAMEPackage.OBJET__VISIBLE, newVisible, newVisible));
|
|
}
|
|
|
|
/**
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @generated
|
|
*/
|
|
@Override
|
|
public EList<Description> getDescriptions()
|
|
{
|
|
if (descriptions == null)
|
|
{
|
|
descriptions = new EObjectContainmentEList<Description>(Description.class, this, GAMEPackage.OBJET__DESCRIPTIONS);
|
|
}
|
|
return descriptions;
|
|
}
|
|
|
|
/**
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @generated
|
|
*/
|
|
@Override
|
|
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
|
|
{
|
|
switch (featureID)
|
|
{
|
|
case GAMEPackage.OBJET__VISIBLE:
|
|
return basicSetVisible(null, msgs);
|
|
case GAMEPackage.OBJET__DESCRIPTIONS:
|
|
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)
|
|
{
|
|
case GAMEPackage.OBJET__NOM:
|
|
return getNom();
|
|
case GAMEPackage.OBJET__TAILLE:
|
|
return getTaille();
|
|
case GAMEPackage.OBJET__VISIBLE:
|
|
return getVisible();
|
|
case GAMEPackage.OBJET__DESCRIPTIONS:
|
|
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)
|
|
{
|
|
case GAMEPackage.OBJET__NOM:
|
|
setNom((String)newValue);
|
|
return;
|
|
case GAMEPackage.OBJET__TAILLE:
|
|
setTaille((Integer)newValue);
|
|
return;
|
|
case GAMEPackage.OBJET__VISIBLE:
|
|
setVisible((Condition)newValue);
|
|
return;
|
|
case GAMEPackage.OBJET__DESCRIPTIONS:
|
|
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)
|
|
{
|
|
case GAMEPackage.OBJET__NOM:
|
|
setNom(NOM_EDEFAULT);
|
|
return;
|
|
case GAMEPackage.OBJET__TAILLE:
|
|
setTaille(TAILLE_EDEFAULT);
|
|
return;
|
|
case GAMEPackage.OBJET__VISIBLE:
|
|
setVisible((Condition)null);
|
|
return;
|
|
case GAMEPackage.OBJET__DESCRIPTIONS:
|
|
getDescriptions().clear();
|
|
return;
|
|
}
|
|
super.eUnset(featureID);
|
|
}
|
|
|
|
/**
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @generated
|
|
*/
|
|
@Override
|
|
public boolean eIsSet(int featureID)
|
|
{
|
|
switch (featureID)
|
|
{
|
|
case GAMEPackage.OBJET__NOM:
|
|
return NOM_EDEFAULT == null ? nom != null : !NOM_EDEFAULT.equals(nom);
|
|
case GAMEPackage.OBJET__TAILLE:
|
|
return taille != TAILLE_EDEFAULT;
|
|
case GAMEPackage.OBJET__VISIBLE:
|
|
return visible != null;
|
|
case GAMEPackage.OBJET__DESCRIPTIONS:
|
|
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(", taille: ");
|
|
result.append(taille);
|
|
result.append(')');
|
|
return result.toString();
|
|
}
|
|
|
|
} //ObjetImpl
|