/** * 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.ObjectiveDefinition; import org.eclipse.viatra.solver.language.solverLanguage.ObjectiveKind; import org.eclipse.viatra.solver.language.solverLanguage.SolverLanguagePackage; /** * * An implementation of the model object 'Objective Definition'. * *

* The following features are implemented: *

* * * @generated */ public class ObjectiveDefinitionImpl extends StatementImpl implements ObjectiveDefinition { /** * The default value of the '{@link #getKind() Kind}' attribute. * * * @see #getKind() * @generated * @ordered */ protected static final ObjectiveKind KIND_EDEFAULT = ObjectiveKind.MINIMIZE; /** * The cached value of the '{@link #getKind() Kind}' attribute. * * * @see #getKind() * @generated * @ordered */ protected ObjectiveKind kind = KIND_EDEFAULT; /** * The cached value of the '{@link #getObjective() Objective}' containment reference. * * * @see #getObjective() * @generated * @ordered */ protected Expression objective; /** * * * @generated */ protected ObjectiveDefinitionImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return SolverLanguagePackage.Literals.OBJECTIVE_DEFINITION; } /** * * * @generated */ @Override public ObjectiveKind getKind() { return kind; } /** * * * @generated */ @Override public void setKind(ObjectiveKind newKind) { ObjectiveKind oldKind = kind; kind = newKind == null ? KIND_EDEFAULT : newKind; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.OBJECTIVE_DEFINITION__KIND, oldKind, kind)); } /** * * * @generated */ @Override public Expression getObjective() { return objective; } /** * * * @generated */ public NotificationChain basicSetObjective(Expression newObjective, NotificationChain msgs) { Expression oldObjective = objective; objective = newObjective; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.OBJECTIVE_DEFINITION__OBJECTIVE, oldObjective, newObjective); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ @Override public void setObjective(Expression newObjective) { if (newObjective != objective) { NotificationChain msgs = null; if (objective != null) msgs = ((InternalEObject)objective).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.OBJECTIVE_DEFINITION__OBJECTIVE, null, msgs); if (newObjective != null) msgs = ((InternalEObject)newObjective).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.OBJECTIVE_DEFINITION__OBJECTIVE, null, msgs); msgs = basicSetObjective(newObjective, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.OBJECTIVE_DEFINITION__OBJECTIVE, newObjective, newObjective)); } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SolverLanguagePackage.OBJECTIVE_DEFINITION__OBJECTIVE: return basicSetObjective(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case SolverLanguagePackage.OBJECTIVE_DEFINITION__KIND: return getKind(); case SolverLanguagePackage.OBJECTIVE_DEFINITION__OBJECTIVE: return getObjective(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case SolverLanguagePackage.OBJECTIVE_DEFINITION__KIND: setKind((ObjectiveKind)newValue); return; case SolverLanguagePackage.OBJECTIVE_DEFINITION__OBJECTIVE: setObjective((Expression)newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case SolverLanguagePackage.OBJECTIVE_DEFINITION__KIND: setKind(KIND_EDEFAULT); return; case SolverLanguagePackage.OBJECTIVE_DEFINITION__OBJECTIVE: setObjective((Expression)null); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case SolverLanguagePackage.OBJECTIVE_DEFINITION__KIND: return kind != KIND_EDEFAULT; case SolverLanguagePackage.OBJECTIVE_DEFINITION__OBJECTIVE: return objective != null; } return super.eIsSet(featureID); } /** * * * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuilder result = new StringBuilder(super.toString()); result.append(" (kind: "); result.append(kind); result.append(')'); return result.toString(); } } //ObjectiveDefinitionImpl