/** * <copyright> * </copyright> * * $Id$ */ package ssl.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.EObjectImpl; import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.ecore.util.InternalEList; import ssl.Action; import ssl.SslPackage; import ssl.Testcase; import ssl.When; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>When</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link ssl.impl.WhenImpl#getTestcase <em>Testcase</em>}</li> * <li>{@link ssl.impl.WhenImpl#getActions <em>Actions</em>}</li> * </ul> * </p> * * @generated */ public class WhenImpl extends EObjectImpl implements When { /** * The cached value of the '{@link #getActions() <em>Actions</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getActions() * @generated * @ordered */ protected EList<Action> actions; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected WhenImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return SslPackage.Literals.WHEN; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Testcase getTestcase() { if (eContainerFeatureID() != SslPackage.WHEN__TESTCASE) return null; return (Testcase)eContainer(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetTestcase(Testcase newTestcase, NotificationChain msgs) { msgs = eBasicSetContainer((InternalEObject)newTestcase, SslPackage.WHEN__TESTCASE, msgs); return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setTestcase(Testcase newTestcase) { if (newTestcase != eInternalContainer() || (eContainerFeatureID() != SslPackage.WHEN__TESTCASE && newTestcase != null)) { if (EcoreUtil.isAncestor(this, newTestcase)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newTestcase != null) msgs = ((InternalEObject)newTestcase).eInverseAdd(this, SslPackage.TESTCASE__WHEN, Testcase.class, msgs); msgs = basicSetTestcase(newTestcase, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SslPackage.WHEN__TESTCASE, newTestcase, newTestcase)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Action> getActions() { if (actions == null) { actions = new EObjectContainmentWithInverseEList<Action>(Action.class, this, SslPackage.WHEN__ACTIONS, SslPackage.ACTION__WHEN); } return actions; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SslPackage.WHEN__TESTCASE: if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); return basicSetTestcase((Testcase)otherEnd, msgs); case SslPackage.WHEN__ACTIONS: return ((InternalEList<InternalEObject>)(InternalEList<?>)getActions()).basicAdd(otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SslPackage.WHEN__TESTCASE: return basicSetTestcase(null, msgs); case SslPackage.WHEN__ACTIONS: return ((InternalEList<?>)getActions()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { switch (eContainerFeatureID()) { case SslPackage.WHEN__TESTCASE: return eInternalContainer().eInverseRemove(this, SslPackage.TESTCASE__WHEN, Testcase.class, msgs); } return super.eBasicRemoveFromContainerFeature(msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case SslPackage.WHEN__TESTCASE: return getTestcase(); case SslPackage.WHEN__ACTIONS: return getActions(); } 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 SslPackage.WHEN__TESTCASE: setTestcase((Testcase)newValue); return; case SslPackage.WHEN__ACTIONS: getActions().clear(); getActions().addAll((Collection<? extends Action>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case SslPackage.WHEN__TESTCASE: setTestcase((Testcase)null); return; case SslPackage.WHEN__ACTIONS: getActions().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case SslPackage.WHEN__TESTCASE: return getTestcase() != null; case SslPackage.WHEN__ACTIONS: return actions != null && !actions.isEmpty(); } return super.eIsSet(featureID); } } //WhenImpl