/** */ package org.eclipse.gmf.tooling.examples.svg.impl; import java.util.Collection; 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.MinimalEObjectImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.gmf.tooling.examples.svg.Goal; import org.eclipse.gmf.tooling.examples.svg.Player; import org.eclipse.gmf.tooling.examples.svg.Playground; import org.eclipse.gmf.tooling.examples.svg.SvgPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Playground</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.gmf.tooling.examples.svg.impl.PlaygroundImpl#getPlayers <em>Players</em>}</li> * <li>{@link org.eclipse.gmf.tooling.examples.svg.impl.PlaygroundImpl#getGoals <em>Goals</em>}</li> * </ul> * </p> * * @generated */ public class PlaygroundImpl extends MinimalEObjectImpl.Container implements Playground { /** * The cached value of the '{@link #getPlayers() <em>Players</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getPlayers() * @generated * @ordered */ protected EList<Player> players; /** * The cached value of the '{@link #getGoals() <em>Goals</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getGoals() * @generated * @ordered */ protected EList<Goal> goals; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected PlaygroundImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return SvgPackage.Literals.PLAYGROUND; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Player> getPlayers() { if (players == null) { players = new EObjectContainmentEList<Player>(Player.class, this, SvgPackage.PLAYGROUND__PLAYERS); } return players; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Goal> getGoals() { if (goals == null) { goals = new EObjectContainmentEList<Goal>(Goal.class, this, SvgPackage.PLAYGROUND__GOALS); } return goals; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SvgPackage.PLAYGROUND__PLAYERS: return ((InternalEList<?>)getPlayers()).basicRemove(otherEnd, msgs); case SvgPackage.PLAYGROUND__GOALS: return ((InternalEList<?>)getGoals()).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 SvgPackage.PLAYGROUND__PLAYERS: return getPlayers(); case SvgPackage.PLAYGROUND__GOALS: return getGoals(); } 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 SvgPackage.PLAYGROUND__PLAYERS: getPlayers().clear(); getPlayers().addAll((Collection<? extends Player>)newValue); return; case SvgPackage.PLAYGROUND__GOALS: getGoals().clear(); getGoals().addAll((Collection<? extends Goal>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case SvgPackage.PLAYGROUND__PLAYERS: getPlayers().clear(); return; case SvgPackage.PLAYGROUND__GOALS: getGoals().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case SvgPackage.PLAYGROUND__PLAYERS: return players != null && !players.isEmpty(); case SvgPackage.PLAYGROUND__GOALS: return goals != null && !goals.isEmpty(); } return super.eIsSet(featureID); } } //PlaygroundImpl