/** * generated by Xtext 2.18.0.M3 */ package org.eclipse.viatra.solver.language.solverLanguage.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.viatra.solver.language.solverLanguage.ClosureType; import org.eclipse.viatra.solver.language.solverLanguage.Constraint; import org.eclipse.viatra.solver.language.solverLanguage.Literal; import org.eclipse.viatra.solver.language.solverLanguage.ModelSymbol; import org.eclipse.viatra.solver.language.solverLanguage.Polarity; import org.eclipse.viatra.solver.language.solverLanguage.SolverLanguagePackage; /** * * An implementation of the model object 'Constraint'. * *

* The following features are implemented: *

* * * @generated */ public class ConstraintImpl extends MinimalEObjectImpl.Container implements Constraint { /** * The cached value of the '{@link #getPolarity() Polarity}' containment reference. * * * @see #getPolarity() * @generated * @ordered */ protected Polarity polarity; /** * The cached value of the '{@link #getSymbol() Symbol}' containment reference. * * * @see #getSymbol() * @generated * @ordered */ protected ModelSymbol symbol; /** * The cached value of the '{@link #getParams() Params}' containment reference list. * * * @see #getParams() * @generated * @ordered */ protected EList params; /** * The cached value of the '{@link #getClosureType() Closure Type}' containment reference. * * * @see #getClosureType() * @generated * @ordered */ protected ClosureType closureType; /** * * * @generated */ protected ConstraintImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return SolverLanguagePackage.Literals.CONSTRAINT; } /** * * * @generated */ @Override public Polarity getPolarity() { return polarity; } /** * * * @generated */ public NotificationChain basicSetPolarity(Polarity newPolarity, NotificationChain msgs) { Polarity oldPolarity = polarity; polarity = newPolarity; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.CONSTRAINT__POLARITY, oldPolarity, newPolarity); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ @Override public void setPolarity(Polarity newPolarity) { if (newPolarity != polarity) { NotificationChain msgs = null; if (polarity != null) msgs = ((InternalEObject)polarity).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.CONSTRAINT__POLARITY, null, msgs); if (newPolarity != null) msgs = ((InternalEObject)newPolarity).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.CONSTRAINT__POLARITY, null, msgs); msgs = basicSetPolarity(newPolarity, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.CONSTRAINT__POLARITY, newPolarity, newPolarity)); } /** * * * @generated */ @Override public ModelSymbol getSymbol() { return symbol; } /** * * * @generated */ public NotificationChain basicSetSymbol(ModelSymbol newSymbol, NotificationChain msgs) { ModelSymbol oldSymbol = symbol; symbol = newSymbol; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.CONSTRAINT__SYMBOL, oldSymbol, newSymbol); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ @Override public void setSymbol(ModelSymbol newSymbol) { if (newSymbol != symbol) { NotificationChain msgs = null; if (symbol != null) msgs = ((InternalEObject)symbol).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.CONSTRAINT__SYMBOL, null, msgs); if (newSymbol != null) msgs = ((InternalEObject)newSymbol).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.CONSTRAINT__SYMBOL, null, msgs); msgs = basicSetSymbol(newSymbol, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.CONSTRAINT__SYMBOL, newSymbol, newSymbol)); } /** * * * @generated */ @Override public EList getParams() { if (params == null) { params = new EObjectContainmentEList(Literal.class, this, SolverLanguagePackage.CONSTRAINT__PARAMS); } return params; } /** * * * @generated */ @Override public ClosureType getClosureType() { return closureType; } /** * * * @generated */ public NotificationChain basicSetClosureType(ClosureType newClosureType, NotificationChain msgs) { ClosureType oldClosureType = closureType; closureType = newClosureType; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.CONSTRAINT__CLOSURE_TYPE, oldClosureType, newClosureType); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ @Override public void setClosureType(ClosureType newClosureType) { if (newClosureType != closureType) { NotificationChain msgs = null; if (closureType != null) msgs = ((InternalEObject)closureType).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.CONSTRAINT__CLOSURE_TYPE, null, msgs); if (newClosureType != null) msgs = ((InternalEObject)newClosureType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.CONSTRAINT__CLOSURE_TYPE, null, msgs); msgs = basicSetClosureType(newClosureType, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.CONSTRAINT__CLOSURE_TYPE, newClosureType, newClosureType)); } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SolverLanguagePackage.CONSTRAINT__POLARITY: return basicSetPolarity(null, msgs); case SolverLanguagePackage.CONSTRAINT__SYMBOL: return basicSetSymbol(null, msgs); case SolverLanguagePackage.CONSTRAINT__PARAMS: return ((InternalEList)getParams()).basicRemove(otherEnd, msgs); case SolverLanguagePackage.CONSTRAINT__CLOSURE_TYPE: return basicSetClosureType(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case SolverLanguagePackage.CONSTRAINT__POLARITY: return getPolarity(); case SolverLanguagePackage.CONSTRAINT__SYMBOL: return getSymbol(); case SolverLanguagePackage.CONSTRAINT__PARAMS: return getParams(); case SolverLanguagePackage.CONSTRAINT__CLOSURE_TYPE: return getClosureType(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case SolverLanguagePackage.CONSTRAINT__POLARITY: setPolarity((Polarity)newValue); return; case SolverLanguagePackage.CONSTRAINT__SYMBOL: setSymbol((ModelSymbol)newValue); return; case SolverLanguagePackage.CONSTRAINT__PARAMS: getParams().clear(); getParams().addAll((Collection)newValue); return; case SolverLanguagePackage.CONSTRAINT__CLOSURE_TYPE: setClosureType((ClosureType)newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case SolverLanguagePackage.CONSTRAINT__POLARITY: setPolarity((Polarity)null); return; case SolverLanguagePackage.CONSTRAINT__SYMBOL: setSymbol((ModelSymbol)null); return; case SolverLanguagePackage.CONSTRAINT__PARAMS: getParams().clear(); return; case SolverLanguagePackage.CONSTRAINT__CLOSURE_TYPE: setClosureType((ClosureType)null); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case SolverLanguagePackage.CONSTRAINT__POLARITY: return polarity != null; case SolverLanguagePackage.CONSTRAINT__SYMBOL: return symbol != null; case SolverLanguagePackage.CONSTRAINT__PARAMS: return params != null && !params.isEmpty(); case SolverLanguagePackage.CONSTRAINT__CLOSURE_TYPE: return closureType != null; } return super.eIsSet(featureID); } } //ConstraintImpl