/**
*/
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.ALSSignatureBody;
import hu.bme.mit.inf.dslreasoner.alloyLanguage.ALSSignatureDeclaration;
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.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
*
* An implementation of the model object 'ALS Signature Body'.
*
*
* The following features are implemented:
*
*
* - {@link hu.bme.mit.inf.dslreasoner.alloyLanguage.impl.ALSSignatureBodyImpl#getMultiplicity Multiplicity}
* - {@link hu.bme.mit.inf.dslreasoner.alloyLanguage.impl.ALSSignatureBodyImpl#isAbstract Abstract}
* - {@link hu.bme.mit.inf.dslreasoner.alloyLanguage.impl.ALSSignatureBodyImpl#getDeclarations Declarations}
* - {@link hu.bme.mit.inf.dslreasoner.alloyLanguage.impl.ALSSignatureBodyImpl#getSupertype Supertype}
* - {@link hu.bme.mit.inf.dslreasoner.alloyLanguage.impl.ALSSignatureBodyImpl#getSuperset Superset}
* - {@link hu.bme.mit.inf.dslreasoner.alloyLanguage.impl.ALSSignatureBodyImpl#getFields Fields}
*
*
* @generated
*/
public class ALSSignatureBodyImpl extends MinimalEObjectImpl.Container implements ALSSignatureBody
{
/**
* 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 default value of the '{@link #isAbstract() Abstract}' attribute.
*
*
* @see #isAbstract()
* @generated
* @ordered
*/
protected static final boolean ABSTRACT_EDEFAULT = false;
/**
* The cached value of the '{@link #isAbstract() Abstract}' attribute.
*
*
* @see #isAbstract()
* @generated
* @ordered
*/
protected boolean abstract_ = ABSTRACT_EDEFAULT;
/**
* The cached value of the '{@link #getDeclarations() Declarations}' containment reference list.
*
*
* @see #getDeclarations()
* @generated
* @ordered
*/
protected EList declarations;
/**
* The cached value of the '{@link #getSupertype() Supertype}' reference.
*
*
* @see #getSupertype()
* @generated
* @ordered
*/
protected ALSSignatureDeclaration supertype;
/**
* The cached value of the '{@link #getSuperset() Superset}' reference list.
*
*
* @see #getSuperset()
* @generated
* @ordered
*/
protected EList superset;
/**
* The cached value of the '{@link #getFields() Fields}' containment reference list.
*
*
* @see #getFields()
* @generated
* @ordered
*/
protected EList fields;
/**
*
*
* @generated
*/
protected ALSSignatureBodyImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return AlloyLanguagePackage.Literals.ALS_SIGNATURE_BODY;
}
/**
*
*
* @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_SIGNATURE_BODY__MULTIPLICITY, oldMultiplicity, multiplicity));
}
/**
*
*
* @generated
*/
public boolean isAbstract()
{
return abstract_;
}
/**
*
*
* @generated
*/
public void setAbstract(boolean newAbstract)
{
boolean oldAbstract = abstract_;
abstract_ = newAbstract;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AlloyLanguagePackage.ALS_SIGNATURE_BODY__ABSTRACT, oldAbstract, abstract_));
}
/**
*
*
* @generated
*/
public EList getDeclarations()
{
if (declarations == null)
{
declarations = new EObjectContainmentEList(ALSSignatureDeclaration.class, this, AlloyLanguagePackage.ALS_SIGNATURE_BODY__DECLARATIONS);
}
return declarations;
}
/**
*
*
* @generated
*/
public ALSSignatureDeclaration getSupertype()
{
if (supertype != null && supertype.eIsProxy())
{
InternalEObject oldSupertype = (InternalEObject)supertype;
supertype = (ALSSignatureDeclaration)eResolveProxy(oldSupertype);
if (supertype != oldSupertype)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, AlloyLanguagePackage.ALS_SIGNATURE_BODY__SUPERTYPE, oldSupertype, supertype));
}
}
return supertype;
}
/**
*
*
* @generated
*/
public ALSSignatureDeclaration basicGetSupertype()
{
return supertype;
}
/**
*
*
* @generated
*/
public void setSupertype(ALSSignatureDeclaration newSupertype)
{
ALSSignatureDeclaration oldSupertype = supertype;
supertype = newSupertype;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AlloyLanguagePackage.ALS_SIGNATURE_BODY__SUPERTYPE, oldSupertype, supertype));
}
/**
*
*
* @generated
*/
public EList getSuperset()
{
if (superset == null)
{
superset = new EObjectResolvingEList(ALSSignatureDeclaration.class, this, AlloyLanguagePackage.ALS_SIGNATURE_BODY__SUPERSET);
}
return superset;
}
/**
*
*
* @generated
*/
public EList getFields()
{
if (fields == null)
{
fields = new EObjectContainmentEList(ALSFieldDeclaration.class, this, AlloyLanguagePackage.ALS_SIGNATURE_BODY__FIELDS);
}
return fields;
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__DECLARATIONS:
return ((InternalEList>)getDeclarations()).basicRemove(otherEnd, msgs);
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__FIELDS:
return ((InternalEList>)getFields()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__MULTIPLICITY:
return getMultiplicity();
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__ABSTRACT:
return isAbstract();
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__DECLARATIONS:
return getDeclarations();
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__SUPERTYPE:
if (resolve) return getSupertype();
return basicGetSupertype();
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__SUPERSET:
return getSuperset();
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__FIELDS:
return getFields();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__MULTIPLICITY:
setMultiplicity((ALSMultiplicity)newValue);
return;
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__ABSTRACT:
setAbstract((Boolean)newValue);
return;
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__DECLARATIONS:
getDeclarations().clear();
getDeclarations().addAll((Collection extends ALSSignatureDeclaration>)newValue);
return;
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__SUPERTYPE:
setSupertype((ALSSignatureDeclaration)newValue);
return;
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__SUPERSET:
getSuperset().clear();
getSuperset().addAll((Collection extends ALSSignatureDeclaration>)newValue);
return;
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__FIELDS:
getFields().clear();
getFields().addAll((Collection extends ALSFieldDeclaration>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__MULTIPLICITY:
setMultiplicity(MULTIPLICITY_EDEFAULT);
return;
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__ABSTRACT:
setAbstract(ABSTRACT_EDEFAULT);
return;
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__DECLARATIONS:
getDeclarations().clear();
return;
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__SUPERTYPE:
setSupertype((ALSSignatureDeclaration)null);
return;
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__SUPERSET:
getSuperset().clear();
return;
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__FIELDS:
getFields().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__MULTIPLICITY:
return multiplicity != MULTIPLICITY_EDEFAULT;
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__ABSTRACT:
return abstract_ != ABSTRACT_EDEFAULT;
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__DECLARATIONS:
return declarations != null && !declarations.isEmpty();
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__SUPERTYPE:
return supertype != null;
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__SUPERSET:
return superset != null && !superset.isEmpty();
case AlloyLanguagePackage.ALS_SIGNATURE_BODY__FIELDS:
return fields != null && !fields.isEmpty();
}
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(", abstract: ");
result.append(abstract_);
result.append(')');
return result.toString();
}
} //ALSSignatureBodyImpl