/**
* generated by Xtext 2.14.0
*/
package ca.mcgill.ecse.dslreasoner.vampireLanguage.impl;
import ca.mcgill.ecse.dslreasoner.vampireLanguage.VLSAnnotation;
import ca.mcgill.ecse.dslreasoner.vampireLanguage.VampireLanguagePackage;
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 'VLS Annotation'.
*
*
* The following features are implemented:
*
*
* - {@link ca.mcgill.ecse.dslreasoner.vampireLanguage.impl.VLSAnnotationImpl#getName Name}
* - {@link ca.mcgill.ecse.dslreasoner.vampireLanguage.impl.VLSAnnotationImpl#getFollowup Followup}
* - {@link ca.mcgill.ecse.dslreasoner.vampireLanguage.impl.VLSAnnotationImpl#getTerms Terms}
*
*
* @generated
*/
public class VLSAnnotationImpl extends MinimalEObjectImpl.Container implements VLSAnnotation
{
/**
* 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 #getFollowup() Followup}' containment reference.
*
*
* @see #getFollowup()
* @generated
* @ordered
*/
protected VLSAnnotation followup;
/**
* The cached value of the '{@link #getTerms() Terms}' containment reference list.
*
*
* @see #getTerms()
* @generated
* @ordered
*/
protected EList terms;
/**
*
*
* @generated
*/
protected VLSAnnotationImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return VampireLanguagePackage.Literals.VLS_ANNOTATION;
}
/**
*
*
* @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, VampireLanguagePackage.VLS_ANNOTATION__NAME, oldName, name));
}
/**
*
*
* @generated
*/
public VLSAnnotation getFollowup()
{
return followup;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetFollowup(VLSAnnotation newFollowup, NotificationChain msgs)
{
VLSAnnotation oldFollowup = followup;
followup = newFollowup;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, VampireLanguagePackage.VLS_ANNOTATION__FOLLOWUP, oldFollowup, newFollowup);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setFollowup(VLSAnnotation newFollowup)
{
if (newFollowup != followup)
{
NotificationChain msgs = null;
if (followup != null)
msgs = ((InternalEObject)followup).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - VampireLanguagePackage.VLS_ANNOTATION__FOLLOWUP, null, msgs);
if (newFollowup != null)
msgs = ((InternalEObject)newFollowup).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - VampireLanguagePackage.VLS_ANNOTATION__FOLLOWUP, null, msgs);
msgs = basicSetFollowup(newFollowup, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, VampireLanguagePackage.VLS_ANNOTATION__FOLLOWUP, newFollowup, newFollowup));
}
/**
*
*
* @generated
*/
public EList getTerms()
{
if (terms == null)
{
terms = new EObjectContainmentEList(VLSAnnotation.class, this, VampireLanguagePackage.VLS_ANNOTATION__TERMS);
}
return terms;
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case VampireLanguagePackage.VLS_ANNOTATION__FOLLOWUP:
return basicSetFollowup(null, msgs);
case VampireLanguagePackage.VLS_ANNOTATION__TERMS:
return ((InternalEList>)getTerms()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case VampireLanguagePackage.VLS_ANNOTATION__NAME:
return getName();
case VampireLanguagePackage.VLS_ANNOTATION__FOLLOWUP:
return getFollowup();
case VampireLanguagePackage.VLS_ANNOTATION__TERMS:
return getTerms();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case VampireLanguagePackage.VLS_ANNOTATION__NAME:
setName((String)newValue);
return;
case VampireLanguagePackage.VLS_ANNOTATION__FOLLOWUP:
setFollowup((VLSAnnotation)newValue);
return;
case VampireLanguagePackage.VLS_ANNOTATION__TERMS:
getTerms().clear();
getTerms().addAll((Collection extends VLSAnnotation>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case VampireLanguagePackage.VLS_ANNOTATION__NAME:
setName(NAME_EDEFAULT);
return;
case VampireLanguagePackage.VLS_ANNOTATION__FOLLOWUP:
setFollowup((VLSAnnotation)null);
return;
case VampireLanguagePackage.VLS_ANNOTATION__TERMS:
getTerms().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case VampireLanguagePackage.VLS_ANNOTATION__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case VampireLanguagePackage.VLS_ANNOTATION__FOLLOWUP:
return followup != null;
case VampireLanguagePackage.VLS_ANNOTATION__TERMS:
return terms != null && !terms.isEmpty();
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (name: ");
result.append(name);
result.append(')');
return result.toString();
}
} //VLSAnnotationImpl