/** */ package hu.bme.mit.inf.dslreasoner.alloyLanguage.impl; import hu.bme.mit.inf.dslreasoner.alloyLanguage.ALSDefinition; import hu.bme.mit.inf.dslreasoner.alloyLanguage.ALSTerm; import hu.bme.mit.inf.dslreasoner.alloyLanguage.ALSVariableDeclaration; import hu.bme.mit.inf.dslreasoner.alloyLanguage.AlloyLanguagePackage; 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; /** * * An implementation of the model object 'ALS Definition'. * *

* The following features are implemented: *

* * * @generated */ public class ALSDefinitionImpl extends MinimalEObjectImpl.Container implements ALSDefinition { /** * The default value of the '{@link #getName() Name}' attribute. * * * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() Name}' attribute. * * * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The cached value of the '{@link #getVariables() Variables}' containment reference list. * * * @see #getVariables() * @generated * @ordered */ protected EList variables; /** * The cached value of the '{@link #getValue() Value}' containment reference. * * * @see #getValue() * @generated * @ordered */ protected ALSTerm value; /** * * * @generated */ protected ALSDefinitionImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return AlloyLanguagePackage.Literals.ALS_DEFINITION; } /** * * * @generated */ public String getName() { return name; } /** * * * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AlloyLanguagePackage.ALS_DEFINITION__NAME, oldName, name)); } /** * * * @generated */ public EList getVariables() { if (variables == null) { variables = new EObjectContainmentEList(ALSVariableDeclaration.class, this, AlloyLanguagePackage.ALS_DEFINITION__VARIABLES); } return variables; } /** * * * @generated */ public ALSTerm getValue() { return value; } /** * * * @generated */ public NotificationChain basicSetValue(ALSTerm newValue, NotificationChain msgs) { ALSTerm oldValue = value; value = newValue; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AlloyLanguagePackage.ALS_DEFINITION__VALUE, oldValue, newValue); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ public void setValue(ALSTerm newValue) { if (newValue != value) { NotificationChain msgs = null; if (value != null) msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AlloyLanguagePackage.ALS_DEFINITION__VALUE, null, msgs); if (newValue != null) msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AlloyLanguagePackage.ALS_DEFINITION__VALUE, null, msgs); msgs = basicSetValue(newValue, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AlloyLanguagePackage.ALS_DEFINITION__VALUE, newValue, newValue)); } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case AlloyLanguagePackage.ALS_DEFINITION__VARIABLES: return ((InternalEList)getVariables()).basicRemove(otherEnd, msgs); case AlloyLanguagePackage.ALS_DEFINITION__VALUE: return basicSetValue(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case AlloyLanguagePackage.ALS_DEFINITION__NAME: return getName(); case AlloyLanguagePackage.ALS_DEFINITION__VARIABLES: return getVariables(); case AlloyLanguagePackage.ALS_DEFINITION__VALUE: return getValue(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case AlloyLanguagePackage.ALS_DEFINITION__NAME: setName((String)newValue); return; case AlloyLanguagePackage.ALS_DEFINITION__VARIABLES: getVariables().clear(); getVariables().addAll((Collection)newValue); return; case AlloyLanguagePackage.ALS_DEFINITION__VALUE: setValue((ALSTerm)newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case AlloyLanguagePackage.ALS_DEFINITION__NAME: setName(NAME_EDEFAULT); return; case AlloyLanguagePackage.ALS_DEFINITION__VARIABLES: getVariables().clear(); return; case AlloyLanguagePackage.ALS_DEFINITION__VALUE: setValue((ALSTerm)null); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case AlloyLanguagePackage.ALS_DEFINITION__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case AlloyLanguagePackage.ALS_DEFINITION__VARIABLES: return variables != null && !variables.isEmpty(); case AlloyLanguagePackage.ALS_DEFINITION__VALUE: return value != null; } return super.eIsSet(featureID); } /** * * * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (name: "); result.append(name); result.append(')'); return result.toString(); } } //ALSDefinitionImpl