/**
* generated by Xtext 2.12.0
*/
package ca.mcgill.ecse.dslreasoner.vampireLanguage.impl;
import ca.mcgill.ecse.dslreasoner.vampireLanguage.VLSFunction;
import ca.mcgill.ecse.dslreasoner.vampireLanguage.VLSTerm;
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.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
*
* An implementation of the model object 'VLS Function'.
*
*
* The following features are implemented:
*
*
* - {@link ca.mcgill.ecse.dslreasoner.vampireLanguage.impl.VLSFunctionImpl#getConstant Constant}
* - {@link ca.mcgill.ecse.dslreasoner.vampireLanguage.impl.VLSFunctionImpl#getTerms Terms}
*
*
* @generated
*/
public class VLSFunctionImpl extends VLSTermImpl implements VLSFunction
{
/**
* The default value of the '{@link #getConstant() Constant}' attribute.
*
*
* @see #getConstant()
* @generated
* @ordered
*/
protected static final String CONSTANT_EDEFAULT = null;
/**
* The cached value of the '{@link #getConstant() Constant}' attribute.
*
*
* @see #getConstant()
* @generated
* @ordered
*/
protected String constant = CONSTANT_EDEFAULT;
/**
* The cached value of the '{@link #getTerms() Terms}' containment reference list.
*
*
* @see #getTerms()
* @generated
* @ordered
*/
protected EList terms;
/**
*
*
* @generated
*/
protected VLSFunctionImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return VampireLanguagePackage.Literals.VLS_FUNCTION;
}
/**
*
*
* @generated
*/
public String getConstant()
{
return constant;
}
/**
*
*
* @generated
*/
public void setConstant(String newConstant)
{
String oldConstant = constant;
constant = newConstant;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, VampireLanguagePackage.VLS_FUNCTION__CONSTANT, oldConstant, constant));
}
/**
*
*
* @generated
*/
public EList getTerms()
{
if (terms == null)
{
terms = new EObjectContainmentEList(VLSTerm.class, this, VampireLanguagePackage.VLS_FUNCTION__TERMS);
}
return terms;
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case VampireLanguagePackage.VLS_FUNCTION__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_FUNCTION__CONSTANT:
return getConstant();
case VampireLanguagePackage.VLS_FUNCTION__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_FUNCTION__CONSTANT:
setConstant((String)newValue);
return;
case VampireLanguagePackage.VLS_FUNCTION__TERMS:
getTerms().clear();
getTerms().addAll((Collection extends VLSTerm>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case VampireLanguagePackage.VLS_FUNCTION__CONSTANT:
setConstant(CONSTANT_EDEFAULT);
return;
case VampireLanguagePackage.VLS_FUNCTION__TERMS:
getTerms().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case VampireLanguagePackage.VLS_FUNCTION__CONSTANT:
return CONSTANT_EDEFAULT == null ? constant != null : !CONSTANT_EDEFAULT.equals(constant);
case VampireLanguagePackage.VLS_FUNCTION__TERMS:
return terms != null && !terms.isEmpty();
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (constant: ");
result.append(constant);
result.append(')');
return result.toString();
}
} //VLSFunctionImpl