/** * generated by Xtext 2.23.0 */ package xtext.game.impl; 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; import xtext.game.Condition; import xtext.game.Connaissance; import xtext.game.Description; import xtext.game.GamePackage; /** * * An implementation of the model object 'Connaissance'. * *

* The following features are implemented: *

* * * @generated */ public class ConnaissanceImpl extends MinimalEObjectImpl.Container implements Connaissance { /** * The default value of the '{@link #getNom() Nom}' attribute. * * * @see #getNom() * @generated * @ordered */ protected static final String NOM_EDEFAULT = null; /** * The cached value of the '{@link #getNom() Nom}' attribute. * * * @see #getNom() * @generated * @ordered */ protected String nom = NOM_EDEFAULT; /** * The cached value of the '{@link #getVisible() Visible}' containment reference. * * * @see #getVisible() * @generated * @ordered */ protected Condition visible; /** * The cached value of the '{@link #getDescriptions() Descriptions}' containment reference list. * * * @see #getDescriptions() * @generated * @ordered */ protected EList descriptions; /** * * * @generated */ protected ConnaissanceImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return GamePackage.Literals.CONNAISSANCE; } /** * * * @generated */ @Override public String getNom() { return nom; } /** * * * @generated */ @Override public void setNom(String newNom) { String oldNom = nom; nom = newNom; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, GamePackage.CONNAISSANCE__NOM, oldNom, nom)); } /** * * * @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.CONNAISSANCE__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.CONNAISSANCE__VISIBLE, null, msgs); if (newVisible != null) msgs = ((InternalEObject)newVisible).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GamePackage.CONNAISSANCE__VISIBLE, null, msgs); msgs = basicSetVisible(newVisible, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, GamePackage.CONNAISSANCE__VISIBLE, newVisible, newVisible)); } /** * * * @generated */ @Override public EList getDescriptions() { if (descriptions == null) { descriptions = new EObjectContainmentEList(Description.class, this, GamePackage.CONNAISSANCE__DESCRIPTIONS); } return descriptions; } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case GamePackage.CONNAISSANCE__VISIBLE: return basicSetVisible(null, msgs); case GamePackage.CONNAISSANCE__DESCRIPTIONS: return ((InternalEList)getDescriptions()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case GamePackage.CONNAISSANCE__NOM: return getNom(); case GamePackage.CONNAISSANCE__VISIBLE: return getVisible(); case GamePackage.CONNAISSANCE__DESCRIPTIONS: return getDescriptions(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case GamePackage.CONNAISSANCE__NOM: setNom((String)newValue); return; case GamePackage.CONNAISSANCE__VISIBLE: setVisible((Condition)newValue); return; case GamePackage.CONNAISSANCE__DESCRIPTIONS: getDescriptions().clear(); getDescriptions().addAll((Collection)newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case GamePackage.CONNAISSANCE__NOM: setNom(NOM_EDEFAULT); return; case GamePackage.CONNAISSANCE__VISIBLE: setVisible((Condition)null); return; case GamePackage.CONNAISSANCE__DESCRIPTIONS: getDescriptions().clear(); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case GamePackage.CONNAISSANCE__NOM: return NOM_EDEFAULT == null ? nom != null : !NOM_EDEFAULT.equals(nom); case GamePackage.CONNAISSANCE__VISIBLE: return visible != null; case GamePackage.CONNAISSANCE__DESCRIPTIONS: return descriptions != null && !descriptions.isEmpty(); } return super.eIsSet(featureID); } /** * * * @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