/** * generated by Xtext 2.21.0 */ package org.eclipse.viatra.solver.language.solverLanguage.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.viatra.solver.language.solverLanguage.Expression; import org.eclipse.viatra.solver.language.solverLanguage.PredicateDefinition; import org.eclipse.viatra.solver.language.solverLanguage.SolverLanguagePackage; /** * * An implementation of the model object 'Predicate Definition'. * *

* The following features are implemented: *

* * * @generated */ public class PredicateDefinitionImpl extends StatementImpl implements PredicateDefinition { /** * The cached value of the '{@link #getHead() Head}' containment reference. * * * @see #getHead() * @generated * @ordered */ protected Expression head; /** * The cached value of the '{@link #getBody() Body}' containment reference. * * * @see #getBody() * @generated * @ordered */ protected Expression body; /** * The default value of the '{@link #isFunctional() Functional}' attribute. * * * @see #isFunctional() * @generated * @ordered */ protected static final boolean FUNCTIONAL_EDEFAULT = false; /** * The cached value of the '{@link #isFunctional() Functional}' attribute. * * * @see #isFunctional() * @generated * @ordered */ protected boolean functional = FUNCTIONAL_EDEFAULT; /** * The default value of the '{@link #isError() Error}' attribute. * * * @see #isError() * @generated * @ordered */ protected static final boolean ERROR_EDEFAULT = false; /** * The cached value of the '{@link #isError() Error}' attribute. * * * @see #isError() * @generated * @ordered */ protected boolean error = ERROR_EDEFAULT; /** * * * @generated */ protected PredicateDefinitionImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return SolverLanguagePackage.Literals.PREDICATE_DEFINITION; } /** * * * @generated */ @Override public Expression getHead() { return head; } /** * * * @generated */ public NotificationChain basicSetHead(Expression newHead, NotificationChain msgs) { Expression oldHead = head; head = newHead; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.PREDICATE_DEFINITION__HEAD, oldHead, newHead); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ @Override public void setHead(Expression newHead) { if (newHead != head) { NotificationChain msgs = null; if (head != null) msgs = ((InternalEObject)head).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.PREDICATE_DEFINITION__HEAD, null, msgs); if (newHead != null) msgs = ((InternalEObject)newHead).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.PREDICATE_DEFINITION__HEAD, null, msgs); msgs = basicSetHead(newHead, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.PREDICATE_DEFINITION__HEAD, newHead, newHead)); } /** * * * @generated */ @Override public Expression getBody() { return body; } /** * * * @generated */ public NotificationChain basicSetBody(Expression newBody, NotificationChain msgs) { Expression oldBody = body; body = newBody; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.PREDICATE_DEFINITION__BODY, oldBody, newBody); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ @Override public void setBody(Expression newBody) { if (newBody != body) { NotificationChain msgs = null; if (body != null) msgs = ((InternalEObject)body).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.PREDICATE_DEFINITION__BODY, null, msgs); if (newBody != null) msgs = ((InternalEObject)newBody).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.PREDICATE_DEFINITION__BODY, null, msgs); msgs = basicSetBody(newBody, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.PREDICATE_DEFINITION__BODY, newBody, newBody)); } /** * * * @generated */ @Override public boolean isFunctional() { return functional; } /** * * * @generated */ @Override public void setFunctional(boolean newFunctional) { boolean oldFunctional = functional; functional = newFunctional; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.PREDICATE_DEFINITION__FUNCTIONAL, oldFunctional, functional)); } /** * * * @generated */ @Override public boolean isError() { return error; } /** * * * @generated */ @Override public void setError(boolean newError) { boolean oldError = error; error = newError; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.PREDICATE_DEFINITION__ERROR, oldError, error)); } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SolverLanguagePackage.PREDICATE_DEFINITION__HEAD: return basicSetHead(null, msgs); case SolverLanguagePackage.PREDICATE_DEFINITION__BODY: return basicSetBody(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case SolverLanguagePackage.PREDICATE_DEFINITION__HEAD: return getHead(); case SolverLanguagePackage.PREDICATE_DEFINITION__BODY: return getBody(); case SolverLanguagePackage.PREDICATE_DEFINITION__FUNCTIONAL: return isFunctional(); case SolverLanguagePackage.PREDICATE_DEFINITION__ERROR: return isError(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case SolverLanguagePackage.PREDICATE_DEFINITION__HEAD: setHead((Expression)newValue); return; case SolverLanguagePackage.PREDICATE_DEFINITION__BODY: setBody((Expression)newValue); return; case SolverLanguagePackage.PREDICATE_DEFINITION__FUNCTIONAL: setFunctional((Boolean)newValue); return; case SolverLanguagePackage.PREDICATE_DEFINITION__ERROR: setError((Boolean)newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case SolverLanguagePackage.PREDICATE_DEFINITION__HEAD: setHead((Expression)null); return; case SolverLanguagePackage.PREDICATE_DEFINITION__BODY: setBody((Expression)null); return; case SolverLanguagePackage.PREDICATE_DEFINITION__FUNCTIONAL: setFunctional(FUNCTIONAL_EDEFAULT); return; case SolverLanguagePackage.PREDICATE_DEFINITION__ERROR: setError(ERROR_EDEFAULT); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case SolverLanguagePackage.PREDICATE_DEFINITION__HEAD: return head != null; case SolverLanguagePackage.PREDICATE_DEFINITION__BODY: return body != null; case SolverLanguagePackage.PREDICATE_DEFINITION__FUNCTIONAL: return functional != FUNCTIONAL_EDEFAULT; case SolverLanguagePackage.PREDICATE_DEFINITION__ERROR: return error != ERROR_EDEFAULT; } return super.eIsSet(featureID); } /** * * * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuilder result = new StringBuilder(super.toString()); result.append(" (functional: "); result.append(functional); result.append(", error: "); result.append(error); result.append(')'); return result.toString(); } } //PredicateDefinitionImpl