/** * generated by Xtext 2.23.0 */ package fr.n7.game.impl; import fr.n7.game.Chemin; import fr.n7.game.Condition; import fr.n7.game.Description; import fr.n7.game.GamePackage; 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 'Chemin'. * *

* The following features are implemented: *

* * * @generated */ public class CheminImpl extends MinimalEObjectImpl.Container implements Chemin { /** * The default value of the '{@link #getLieuIn() Lieu In}' attribute. * * * @see #getLieuIn() * @generated * @ordered */ protected static final String LIEU_IN_EDEFAULT = null; /** * The cached value of the '{@link #getLieuIn() Lieu In}' attribute. * * * @see #getLieuIn() * @generated * @ordered */ protected String lieuIn = LIEU_IN_EDEFAULT; /** * The default value of the '{@link #getLieuOut() Lieu Out}' attribute. * * * @see #getLieuOut() * @generated * @ordered */ protected static final String LIEU_OUT_EDEFAULT = null; /** * The cached value of the '{@link #getLieuOut() Lieu Out}' attribute. * * * @see #getLieuOut() * @generated * @ordered */ protected String lieuOut = LIEU_OUT_EDEFAULT; /** * The cached value of the '{@link #getOuvert() Ouvert}' containment reference. * * * @see #getOuvert() * @generated * @ordered */ protected Condition ouvert; /** * The cached value of the '{@link #getVisible() Visible}' containment reference. * * * @see #getVisible() * @generated * @ordered */ protected Condition visible; /** * The cached value of the '{@link #getObligatoire() Obligatoire}' containment reference. * * * @see #getObligatoire() * @generated * @ordered */ protected Condition obligatoire; /** * 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 #getDescriptions() Descriptions}' containment reference list. * * * @see #getDescriptions() * @generated * @ordered */ protected EList descriptions; /** * * * @generated */ protected CheminImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return GamePackage.Literals.CHEMIN; } /** * * * @generated */ @Override public String getLieuIn() { return lieuIn; } /** * * * @generated */ @Override public void setLieuIn(String newLieuIn) { String oldLieuIn = lieuIn; lieuIn = newLieuIn; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, GamePackage.CHEMIN__LIEU_IN, oldLieuIn, lieuIn)); } /** * * * @generated */ @Override public String getLieuOut() { return lieuOut; } /** * * * @generated */ @Override public void setLieuOut(String newLieuOut) { String oldLieuOut = lieuOut; lieuOut = newLieuOut; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, GamePackage.CHEMIN__LIEU_OUT, oldLieuOut, lieuOut)); } /** * * * @generated */ @Override public Condition getOuvert() { return ouvert; } /** * * * @generated */ public NotificationChain basicSetOuvert(Condition newOuvert, NotificationChain msgs) { Condition oldOuvert = ouvert; ouvert = newOuvert; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GamePackage.CHEMIN__OUVERT, oldOuvert, newOuvert); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ @Override public void setOuvert(Condition newOuvert) { if (newOuvert != ouvert) { NotificationChain msgs = null; if (ouvert != null) msgs = ((InternalEObject)ouvert).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GamePackage.CHEMIN__OUVERT, null, msgs); if (newOuvert != null) msgs = ((InternalEObject)newOuvert).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GamePackage.CHEMIN__OUVERT, null, msgs); msgs = basicSetOuvert(newOuvert, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, GamePackage.CHEMIN__OUVERT, newOuvert, newOuvert)); } /** * * * @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.CHEMIN__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.CHEMIN__VISIBLE, null, msgs); if (newVisible != null) msgs = ((InternalEObject)newVisible).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GamePackage.CHEMIN__VISIBLE, null, msgs); msgs = basicSetVisible(newVisible, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, GamePackage.CHEMIN__VISIBLE, newVisible, newVisible)); } /** * * * @generated */ @Override public Condition getObligatoire() { return obligatoire; } /** * * * @generated */ public NotificationChain basicSetObligatoire(Condition newObligatoire, NotificationChain msgs) { Condition oldObligatoire = obligatoire; obligatoire = newObligatoire; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GamePackage.CHEMIN__OBLIGATOIRE, oldObligatoire, newObligatoire); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ @Override public void setObligatoire(Condition newObligatoire) { if (newObligatoire != obligatoire) { NotificationChain msgs = null; if (obligatoire != null) msgs = ((InternalEObject)obligatoire).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GamePackage.CHEMIN__OBLIGATOIRE, null, msgs); if (newObligatoire != null) msgs = ((InternalEObject)newObligatoire).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GamePackage.CHEMIN__OBLIGATOIRE, null, msgs); msgs = basicSetObligatoire(newObligatoire, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, GamePackage.CHEMIN__OBLIGATOIRE, newObligatoire, newObligatoire)); } /** * * * @generated */ @Override public EList getConnaissances() { if (connaissances == null) { connaissances = new EDataTypeEList(String.class, this, GamePackage.CHEMIN__CONNAISSANCES); } return connaissances; } /** * * * @generated */ @Override public EList getObjetsRecus() { if (objetsRecus == null) { objetsRecus = new EDataTypeEList(String.class, this, GamePackage.CHEMIN__OBJETS_RECUS); } return objetsRecus; } /** * * * @generated */ @Override public EList getObjetsConso() { if (objetsConso == null) { objetsConso = new EDataTypeEList(String.class, this, GamePackage.CHEMIN__OBJETS_CONSO); } return objetsConso; } /** * * * @generated */ @Override public EList getDescriptions() { if (descriptions == null) { descriptions = new EObjectContainmentEList(Description.class, this, GamePackage.CHEMIN__DESCRIPTIONS); } return descriptions; } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case GamePackage.CHEMIN__OUVERT: return basicSetOuvert(null, msgs); case GamePackage.CHEMIN__VISIBLE: return basicSetVisible(null, msgs); case GamePackage.CHEMIN__OBLIGATOIRE: return basicSetObligatoire(null, msgs); case GamePackage.CHEMIN__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.CHEMIN__LIEU_IN: return getLieuIn(); case GamePackage.CHEMIN__LIEU_OUT: return getLieuOut(); case GamePackage.CHEMIN__OUVERT: return getOuvert(); case GamePackage.CHEMIN__VISIBLE: return getVisible(); case GamePackage.CHEMIN__OBLIGATOIRE: return getObligatoire(); case GamePackage.CHEMIN__CONNAISSANCES: return getConnaissances(); case GamePackage.CHEMIN__OBJETS_RECUS: return getObjetsRecus(); case GamePackage.CHEMIN__OBJETS_CONSO: return getObjetsConso(); case GamePackage.CHEMIN__DESCRIPTIONS: return getDescriptions(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case GamePackage.CHEMIN__LIEU_IN: setLieuIn((String)newValue); return; case GamePackage.CHEMIN__LIEU_OUT: setLieuOut((String)newValue); return; case GamePackage.CHEMIN__OUVERT: setOuvert((Condition)newValue); return; case GamePackage.CHEMIN__VISIBLE: setVisible((Condition)newValue); return; case GamePackage.CHEMIN__OBLIGATOIRE: setObligatoire((Condition)newValue); return; case GamePackage.CHEMIN__CONNAISSANCES: getConnaissances().clear(); getConnaissances().addAll((Collection)newValue); return; case GamePackage.CHEMIN__OBJETS_RECUS: getObjetsRecus().clear(); getObjetsRecus().addAll((Collection)newValue); return; case GamePackage.CHEMIN__OBJETS_CONSO: getObjetsConso().clear(); getObjetsConso().addAll((Collection)newValue); return; case GamePackage.CHEMIN__DESCRIPTIONS: getDescriptions().clear(); getDescriptions().addAll((Collection)newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case GamePackage.CHEMIN__LIEU_IN: setLieuIn(LIEU_IN_EDEFAULT); return; case GamePackage.CHEMIN__LIEU_OUT: setLieuOut(LIEU_OUT_EDEFAULT); return; case GamePackage.CHEMIN__OUVERT: setOuvert((Condition)null); return; case GamePackage.CHEMIN__VISIBLE: setVisible((Condition)null); return; case GamePackage.CHEMIN__OBLIGATOIRE: setObligatoire((Condition)null); return; case GamePackage.CHEMIN__CONNAISSANCES: getConnaissances().clear(); return; case GamePackage.CHEMIN__OBJETS_RECUS: getObjetsRecus().clear(); return; case GamePackage.CHEMIN__OBJETS_CONSO: getObjetsConso().clear(); return; case GamePackage.CHEMIN__DESCRIPTIONS: getDescriptions().clear(); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case GamePackage.CHEMIN__LIEU_IN: return LIEU_IN_EDEFAULT == null ? lieuIn != null : !LIEU_IN_EDEFAULT.equals(lieuIn); case GamePackage.CHEMIN__LIEU_OUT: return LIEU_OUT_EDEFAULT == null ? lieuOut != null : !LIEU_OUT_EDEFAULT.equals(lieuOut); case GamePackage.CHEMIN__OUVERT: return ouvert != null; case GamePackage.CHEMIN__VISIBLE: return visible != null; case GamePackage.CHEMIN__OBLIGATOIRE: return obligatoire != null; case GamePackage.CHEMIN__CONNAISSANCES: return connaissances != null && !connaissances.isEmpty(); case GamePackage.CHEMIN__OBJETS_RECUS: return objetsRecus != null && !objetsRecus.isEmpty(); case GamePackage.CHEMIN__OBJETS_CONSO: return objetsConso != null && !objetsConso.isEmpty(); case GamePackage.CHEMIN__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(" (lieuIn: "); result.append(lieuIn); result.append(", lieuOut: "); result.append(lieuOut); result.append(", connaissances: "); result.append(connaissances); result.append(", objetsRecus: "); result.append(objetsRecus); result.append(", objetsConso: "); result.append(objetsConso); result.append(')'); return result.toString(); } } //CheminImpl