/**
*/
package hu.bme.mit.inf.dslreasoner.smtLanguage.impl;
import hu.bme.mit.inf.dslreasoner.smtLanguage.SMTFunctionDefinition;
import hu.bme.mit.inf.dslreasoner.smtLanguage.SMTSortedVariable;
import hu.bme.mit.inf.dslreasoner.smtLanguage.SMTTerm;
import hu.bme.mit.inf.dslreasoner.smtLanguage.SMTTypeReference;
import hu.bme.mit.inf.dslreasoner.smtLanguage.SmtLanguagePackage;
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 'SMT Function Definition'.
*
*
* The following features are implemented:
*
* - {@link hu.bme.mit.inf.dslreasoner.smtLanguage.impl.SMTFunctionDefinitionImpl#getParameters Parameters}
* - {@link hu.bme.mit.inf.dslreasoner.smtLanguage.impl.SMTFunctionDefinitionImpl#getRange Range}
* - {@link hu.bme.mit.inf.dslreasoner.smtLanguage.impl.SMTFunctionDefinitionImpl#getValue Value}
*
*
*
* @generated
*/
public class SMTFunctionDefinitionImpl extends SMTSymbolicDeclarationImpl implements SMTFunctionDefinition
{
/**
* The cached value of the '{@link #getParameters() Parameters}' containment reference list.
*
*
* @see #getParameters()
* @generated
* @ordered
*/
protected EList parameters;
/**
* The cached value of the '{@link #getRange() Range}' containment reference.
*
*
* @see #getRange()
* @generated
* @ordered
*/
protected SMTTypeReference range;
/**
* The cached value of the '{@link #getValue() Value}' containment reference.
*
*
* @see #getValue()
* @generated
* @ordered
*/
protected SMTTerm value;
/**
*
*
* @generated
*/
protected SMTFunctionDefinitionImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return SmtLanguagePackage.Literals.SMT_FUNCTION_DEFINITION;
}
/**
*
*
* @generated
*/
public EList getParameters()
{
if (parameters == null)
{
parameters = new EObjectContainmentEList(SMTSortedVariable.class, this, SmtLanguagePackage.SMT_FUNCTION_DEFINITION__PARAMETERS);
}
return parameters;
}
/**
*
*
* @generated
*/
public SMTTypeReference getRange()
{
return range;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetRange(SMTTypeReference newRange, NotificationChain msgs)
{
SMTTypeReference oldRange = range;
range = newRange;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SmtLanguagePackage.SMT_FUNCTION_DEFINITION__RANGE, oldRange, newRange);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setRange(SMTTypeReference newRange)
{
if (newRange != range)
{
NotificationChain msgs = null;
if (range != null)
msgs = ((InternalEObject)range).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SmtLanguagePackage.SMT_FUNCTION_DEFINITION__RANGE, null, msgs);
if (newRange != null)
msgs = ((InternalEObject)newRange).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SmtLanguagePackage.SMT_FUNCTION_DEFINITION__RANGE, null, msgs);
msgs = basicSetRange(newRange, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SmtLanguagePackage.SMT_FUNCTION_DEFINITION__RANGE, newRange, newRange));
}
/**
*
*
* @generated
*/
public SMTTerm getValue()
{
return value;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetValue(SMTTerm newValue, NotificationChain msgs)
{
SMTTerm oldValue = value;
value = newValue;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SmtLanguagePackage.SMT_FUNCTION_DEFINITION__VALUE, oldValue, newValue);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setValue(SMTTerm newValue)
{
if (newValue != value)
{
NotificationChain msgs = null;
if (value != null)
msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SmtLanguagePackage.SMT_FUNCTION_DEFINITION__VALUE, null, msgs);
if (newValue != null)
msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SmtLanguagePackage.SMT_FUNCTION_DEFINITION__VALUE, null, msgs);
msgs = basicSetValue(newValue, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SmtLanguagePackage.SMT_FUNCTION_DEFINITION__VALUE, newValue, newValue));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case SmtLanguagePackage.SMT_FUNCTION_DEFINITION__PARAMETERS:
return ((InternalEList>)getParameters()).basicRemove(otherEnd, msgs);
case SmtLanguagePackage.SMT_FUNCTION_DEFINITION__RANGE:
return basicSetRange(null, msgs);
case SmtLanguagePackage.SMT_FUNCTION_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 SmtLanguagePackage.SMT_FUNCTION_DEFINITION__PARAMETERS:
return getParameters();
case SmtLanguagePackage.SMT_FUNCTION_DEFINITION__RANGE:
return getRange();
case SmtLanguagePackage.SMT_FUNCTION_DEFINITION__VALUE:
return getValue();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case SmtLanguagePackage.SMT_FUNCTION_DEFINITION__PARAMETERS:
getParameters().clear();
getParameters().addAll((Collection extends SMTSortedVariable>)newValue);
return;
case SmtLanguagePackage.SMT_FUNCTION_DEFINITION__RANGE:
setRange((SMTTypeReference)newValue);
return;
case SmtLanguagePackage.SMT_FUNCTION_DEFINITION__VALUE:
setValue((SMTTerm)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case SmtLanguagePackage.SMT_FUNCTION_DEFINITION__PARAMETERS:
getParameters().clear();
return;
case SmtLanguagePackage.SMT_FUNCTION_DEFINITION__RANGE:
setRange((SMTTypeReference)null);
return;
case SmtLanguagePackage.SMT_FUNCTION_DEFINITION__VALUE:
setValue((SMTTerm)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case SmtLanguagePackage.SMT_FUNCTION_DEFINITION__PARAMETERS:
return parameters != null && !parameters.isEmpty();
case SmtLanguagePackage.SMT_FUNCTION_DEFINITION__RANGE:
return range != null;
case SmtLanguagePackage.SMT_FUNCTION_DEFINITION__VALUE:
return value != null;
}
return super.eIsSet(featureID);
}
} //SMTFunctionDefinitionImpl