/**
*/
package hu.bme.mit.inf.dslreasoner.alloyLanguage.impl;
import hu.bme.mit.inf.dslreasoner.alloyLanguage.ALSFieldDeclaration;
import hu.bme.mit.inf.dslreasoner.alloyLanguage.ALSMultiplicity;
import hu.bme.mit.inf.dslreasoner.alloyLanguage.ALSTerm;
import hu.bme.mit.inf.dslreasoner.alloyLanguage.AlloyLanguagePackage;
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;
/**
*
* An implementation of the model object 'ALS Field Declaration'.
*
*
* The following features are implemented:
*
*
* - {@link hu.bme.mit.inf.dslreasoner.alloyLanguage.impl.ALSFieldDeclarationImpl#getMultiplicity Multiplicity}
* - {@link hu.bme.mit.inf.dslreasoner.alloyLanguage.impl.ALSFieldDeclarationImpl#getType Type}
*
*
* @generated
*/
public class ALSFieldDeclarationImpl extends ALSRelationDeclarationImpl implements ALSFieldDeclaration
{
/**
* The default value of the '{@link #getMultiplicity() Multiplicity}' attribute.
*
*
* @see #getMultiplicity()
* @generated
* @ordered
*/
protected static final ALSMultiplicity MULTIPLICITY_EDEFAULT = ALSMultiplicity.ALL;
/**
* The cached value of the '{@link #getMultiplicity() Multiplicity}' attribute.
*
*
* @see #getMultiplicity()
* @generated
* @ordered
*/
protected ALSMultiplicity multiplicity = MULTIPLICITY_EDEFAULT;
/**
* The cached value of the '{@link #getType() Type}' containment reference.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected ALSTerm type;
/**
*
*
* @generated
*/
protected ALSFieldDeclarationImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return AlloyLanguagePackage.Literals.ALS_FIELD_DECLARATION;
}
/**
*
*
* @generated
*/
public ALSMultiplicity getMultiplicity()
{
return multiplicity;
}
/**
*
*
* @generated
*/
public void setMultiplicity(ALSMultiplicity newMultiplicity)
{
ALSMultiplicity oldMultiplicity = multiplicity;
multiplicity = newMultiplicity == null ? MULTIPLICITY_EDEFAULT : newMultiplicity;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AlloyLanguagePackage.ALS_FIELD_DECLARATION__MULTIPLICITY, oldMultiplicity, multiplicity));
}
/**
*
*
* @generated
*/
public ALSTerm getType()
{
return type;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetType(ALSTerm newType, NotificationChain msgs)
{
ALSTerm oldType = type;
type = newType;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AlloyLanguagePackage.ALS_FIELD_DECLARATION__TYPE, oldType, newType);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setType(ALSTerm newType)
{
if (newType != type)
{
NotificationChain msgs = null;
if (type != null)
msgs = ((InternalEObject)type).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AlloyLanguagePackage.ALS_FIELD_DECLARATION__TYPE, null, msgs);
if (newType != null)
msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AlloyLanguagePackage.ALS_FIELD_DECLARATION__TYPE, null, msgs);
msgs = basicSetType(newType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AlloyLanguagePackage.ALS_FIELD_DECLARATION__TYPE, newType, newType));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case AlloyLanguagePackage.ALS_FIELD_DECLARATION__TYPE:
return basicSetType(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case AlloyLanguagePackage.ALS_FIELD_DECLARATION__MULTIPLICITY:
return getMultiplicity();
case AlloyLanguagePackage.ALS_FIELD_DECLARATION__TYPE:
return getType();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case AlloyLanguagePackage.ALS_FIELD_DECLARATION__MULTIPLICITY:
setMultiplicity((ALSMultiplicity)newValue);
return;
case AlloyLanguagePackage.ALS_FIELD_DECLARATION__TYPE:
setType((ALSTerm)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case AlloyLanguagePackage.ALS_FIELD_DECLARATION__MULTIPLICITY:
setMultiplicity(MULTIPLICITY_EDEFAULT);
return;
case AlloyLanguagePackage.ALS_FIELD_DECLARATION__TYPE:
setType((ALSTerm)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case AlloyLanguagePackage.ALS_FIELD_DECLARATION__MULTIPLICITY:
return multiplicity != MULTIPLICITY_EDEFAULT;
case AlloyLanguagePackage.ALS_FIELD_DECLARATION__TYPE:
return type != null;
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (multiplicity: ");
result.append(multiplicity);
result.append(')');
return result.toString();
}
} //ALSFieldDeclarationImpl