/** */ package org.eclipse.papyrus.infra.gmfdiag.css3.cSS.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 org.eclipse.papyrus.infra.gmfdiag.css3.cSS.CSSPackage; import org.eclipse.papyrus.infra.gmfdiag.css3.cSS.selector; import org.eclipse.papyrus.infra.gmfdiag.css3.cSS.simple_selector; /** * * An implementation of the model object 'selector'. * *

* The following features are implemented: *

* * * @generated */ public class selectorImpl extends MinimalEObjectImpl.Container implements selector { /** * The cached value of the '{@link #getSimpleselectors() Simpleselectors}' containment reference list. * * * @see #getSimpleselectors() * @generated * @ordered */ protected EList simpleselectors; /** * The default value of the '{@link #getCombinator() Combinator}' attribute. * * * @see #getCombinator() * @generated * @ordered */ protected static final String COMBINATOR_EDEFAULT = null; /** * The cached value of the '{@link #getCombinator() Combinator}' attribute. * * * @see #getCombinator() * @generated * @ordered */ protected String combinator = COMBINATOR_EDEFAULT; /** * The cached value of the '{@link #getSelector() Selector}' containment reference. * * * @see #getSelector() * @generated * @ordered */ protected selector selector; /** * * * @generated */ protected selectorImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return CSSPackage.Literals.SELECTOR; } /** * * * @generated */ public EList getSimpleselectors() { if (simpleselectors == null) { simpleselectors = new EObjectContainmentEList(simple_selector.class, this, CSSPackage.SELECTOR__SIMPLESELECTORS); } return simpleselectors; } /** * * * @generated */ public String getCombinator() { return combinator; } /** * * * @generated */ public void setCombinator(String newCombinator) { String oldCombinator = combinator; combinator = newCombinator; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, CSSPackage.SELECTOR__COMBINATOR, oldCombinator, combinator)); } /** * * * @generated */ public selector getSelector() { return selector; } /** * * * @generated */ public NotificationChain basicSetSelector(selector newSelector, NotificationChain msgs) { selector oldSelector = selector; selector = newSelector; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CSSPackage.SELECTOR__SELECTOR, oldSelector, newSelector); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ public void setSelector(selector newSelector) { if (newSelector != selector) { NotificationChain msgs = null; if (selector != null) msgs = ((InternalEObject)selector).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CSSPackage.SELECTOR__SELECTOR, null, msgs); if (newSelector != null) msgs = ((InternalEObject)newSelector).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CSSPackage.SELECTOR__SELECTOR, null, msgs); msgs = basicSetSelector(newSelector, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, CSSPackage.SELECTOR__SELECTOR, newSelector, newSelector)); } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case CSSPackage.SELECTOR__SIMPLESELECTORS: return ((InternalEList)getSimpleselectors()).basicRemove(otherEnd, msgs); case CSSPackage.SELECTOR__SELECTOR: return basicSetSelector(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case CSSPackage.SELECTOR__SIMPLESELECTORS: return getSimpleselectors(); case CSSPackage.SELECTOR__COMBINATOR: return getCombinator(); case CSSPackage.SELECTOR__SELECTOR: return getSelector(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case CSSPackage.SELECTOR__SIMPLESELECTORS: getSimpleselectors().clear(); getSimpleselectors().addAll((Collection)newValue); return; case CSSPackage.SELECTOR__COMBINATOR: setCombinator((String)newValue); return; case CSSPackage.SELECTOR__SELECTOR: setSelector((selector)newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case CSSPackage.SELECTOR__SIMPLESELECTORS: getSimpleselectors().clear(); return; case CSSPackage.SELECTOR__COMBINATOR: setCombinator(COMBINATOR_EDEFAULT); return; case CSSPackage.SELECTOR__SELECTOR: setSelector((selector)null); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case CSSPackage.SELECTOR__SIMPLESELECTORS: return simpleselectors != null && !simpleselectors.isEmpty(); case CSSPackage.SELECTOR__COMBINATOR: return COMBINATOR_EDEFAULT == null ? combinator != null : !COMBINATOR_EDEFAULT.equals(combinator); case CSSPackage.SELECTOR__SELECTOR: return selector != null; } return super.eIsSet(featureID); } /** * * * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (combinator: "); result.append(combinator); result.append(')'); return result.toString(); } } //selectorImpl