/** */ package org.eclipse.viatra.solver.language.model.problem.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.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.viatra.solver.language.model.problem.ClassDeclaration; import org.eclipse.viatra.solver.language.model.problem.Multiplicity; import org.eclipse.viatra.solver.language.model.problem.ProblemPackage; import org.eclipse.viatra.solver.language.model.problem.TypeScope; /** * * An implementation of the model object 'Type Scope'. * *

* The following features are implemented: *

* * * @generated */ public class TypeScopeImpl extends MinimalEObjectImpl.Container implements TypeScope { /** * The cached value of the '{@link #getTargetType() Target Type}' reference. * * * @see #getTargetType() * @generated * @ordered */ protected ClassDeclaration targetType; /** * The default value of the '{@link #isIncrement() Increment}' attribute. * * * @see #isIncrement() * @generated * @ordered */ protected static final boolean INCREMENT_EDEFAULT = false; /** * The cached value of the '{@link #isIncrement() Increment}' attribute. * * * @see #isIncrement() * @generated * @ordered */ protected boolean increment = INCREMENT_EDEFAULT; /** * The cached value of the '{@link #getMultiplicity() Multiplicity}' containment reference. * * * @see #getMultiplicity() * @generated * @ordered */ protected Multiplicity multiplicity; /** * * * @generated */ protected TypeScopeImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return ProblemPackage.Literals.TYPE_SCOPE; } /** * * * @generated */ public ClassDeclaration getTargetType() { if (targetType != null && targetType.eIsProxy()) { InternalEObject oldTargetType = (InternalEObject) targetType; targetType = (ClassDeclaration) eResolveProxy(oldTargetType); if (targetType != oldTargetType) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProblemPackage.TYPE_SCOPE__TARGET_TYPE, oldTargetType, targetType)); } } return targetType; } /** * * * @generated */ public ClassDeclaration basicGetTargetType() { return targetType; } /** * * * @generated */ public void setTargetType(ClassDeclaration newTargetType) { ClassDeclaration oldTargetType = targetType; targetType = newTargetType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ProblemPackage.TYPE_SCOPE__TARGET_TYPE, oldTargetType, targetType)); } /** * * * @generated */ public boolean isIncrement() { return increment; } /** * * * @generated */ public void setIncrement(boolean newIncrement) { boolean oldIncrement = increment; increment = newIncrement; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ProblemPackage.TYPE_SCOPE__INCREMENT, oldIncrement, increment)); } /** * * * @generated */ public Multiplicity getMultiplicity() { return multiplicity; } /** * * * @generated */ public NotificationChain basicSetMultiplicity(Multiplicity newMultiplicity, NotificationChain msgs) { Multiplicity oldMultiplicity = multiplicity; multiplicity = newMultiplicity; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ProblemPackage.TYPE_SCOPE__MULTIPLICITY, oldMultiplicity, newMultiplicity); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ public void setMultiplicity(Multiplicity newMultiplicity) { if (newMultiplicity != multiplicity) { NotificationChain msgs = null; if (multiplicity != null) msgs = ((InternalEObject) multiplicity).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ProblemPackage.TYPE_SCOPE__MULTIPLICITY, null, msgs); if (newMultiplicity != null) msgs = ((InternalEObject) newMultiplicity).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ProblemPackage.TYPE_SCOPE__MULTIPLICITY, null, msgs); msgs = basicSetMultiplicity(newMultiplicity, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ProblemPackage.TYPE_SCOPE__MULTIPLICITY, newMultiplicity, newMultiplicity)); } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case ProblemPackage.TYPE_SCOPE__MULTIPLICITY: return basicSetMultiplicity(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case ProblemPackage.TYPE_SCOPE__TARGET_TYPE: if (resolve) return getTargetType(); return basicGetTargetType(); case ProblemPackage.TYPE_SCOPE__INCREMENT: return isIncrement(); case ProblemPackage.TYPE_SCOPE__MULTIPLICITY: return getMultiplicity(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case ProblemPackage.TYPE_SCOPE__TARGET_TYPE: setTargetType((ClassDeclaration) newValue); return; case ProblemPackage.TYPE_SCOPE__INCREMENT: setIncrement((Boolean) newValue); return; case ProblemPackage.TYPE_SCOPE__MULTIPLICITY: setMultiplicity((Multiplicity) newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ProblemPackage.TYPE_SCOPE__TARGET_TYPE: setTargetType((ClassDeclaration) null); return; case ProblemPackage.TYPE_SCOPE__INCREMENT: setIncrement(INCREMENT_EDEFAULT); return; case ProblemPackage.TYPE_SCOPE__MULTIPLICITY: setMultiplicity((Multiplicity) null); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ProblemPackage.TYPE_SCOPE__TARGET_TYPE: return targetType != null; case ProblemPackage.TYPE_SCOPE__INCREMENT: return increment != INCREMENT_EDEFAULT; case ProblemPackage.TYPE_SCOPE__MULTIPLICITY: return multiplicity != null; } return super.eIsSet(featureID); } /** * * * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuilder result = new StringBuilder(super.toString()); result.append(" (increment: "); result.append(increment); result.append(')'); return result.toString(); } } //TypeScopeImpl