/**
*/
package hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl;
import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.FunctionDeclaration;
import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.FunctionDefinition;
import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage;
import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Term;
import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Variable;
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 'Function Definition'.
*
*
* The following features are implemented:
*
*
* - {@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.FunctionDefinitionImpl#getVariable Variable}
* - {@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.FunctionDefinitionImpl#getDefines Defines}
* - {@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.FunctionDefinitionImpl#getValue Value}
*
*
* @generated
*/
public class FunctionDefinitionImpl extends FunctionImpl implements FunctionDefinition {
/**
* The cached value of the '{@link #getVariable() Variable}' containment reference list.
*
*
* @see #getVariable()
* @generated
* @ordered
*/
protected EList variable;
/**
* The cached value of the '{@link #getDefines() Defines}' reference.
*
*
* @see #getDefines()
* @generated
* @ordered
*/
protected FunctionDeclaration defines;
/**
* The cached value of the '{@link #getValue() Value}' containment reference.
*
*
* @see #getValue()
* @generated
* @ordered
*/
protected Term value;
/**
*
*
* @generated
*/
protected FunctionDefinitionImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return LogiclanguagePackage.Literals.FUNCTION_DEFINITION;
}
/**
*
*
* @generated
*/
public EList getVariable() {
if (variable == null) {
variable = new EObjectContainmentEList(Variable.class, this, LogiclanguagePackage.FUNCTION_DEFINITION__VARIABLE);
}
return variable;
}
/**
*
*
* @generated
*/
public FunctionDeclaration getDefines() {
if (defines != null && defines.eIsProxy()) {
InternalEObject oldDefines = (InternalEObject)defines;
defines = (FunctionDeclaration)eResolveProxy(oldDefines);
if (defines != oldDefines) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, LogiclanguagePackage.FUNCTION_DEFINITION__DEFINES, oldDefines, defines));
}
}
return defines;
}
/**
*
*
* @generated
*/
public FunctionDeclaration basicGetDefines() {
return defines;
}
/**
*
*
* @generated
*/
public void setDefines(FunctionDeclaration newDefines) {
FunctionDeclaration oldDefines = defines;
defines = newDefines;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LogiclanguagePackage.FUNCTION_DEFINITION__DEFINES, oldDefines, defines));
}
/**
*
*
* @generated
*/
public Term getValue() {
return value;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetValue(Term newValue, NotificationChain msgs) {
Term oldValue = value;
value = newValue;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LogiclanguagePackage.FUNCTION_DEFINITION__VALUE, oldValue, newValue);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setValue(Term newValue) {
if (newValue != value) {
NotificationChain msgs = null;
if (value != null)
msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LogiclanguagePackage.FUNCTION_DEFINITION__VALUE, null, msgs);
if (newValue != null)
msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LogiclanguagePackage.FUNCTION_DEFINITION__VALUE, null, msgs);
msgs = basicSetValue(newValue, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LogiclanguagePackage.FUNCTION_DEFINITION__VALUE, newValue, newValue));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case LogiclanguagePackage.FUNCTION_DEFINITION__VARIABLE:
return ((InternalEList>)getVariable()).basicRemove(otherEnd, msgs);
case LogiclanguagePackage.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 LogiclanguagePackage.FUNCTION_DEFINITION__VARIABLE:
return getVariable();
case LogiclanguagePackage.FUNCTION_DEFINITION__DEFINES:
if (resolve) return getDefines();
return basicGetDefines();
case LogiclanguagePackage.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 LogiclanguagePackage.FUNCTION_DEFINITION__VARIABLE:
getVariable().clear();
getVariable().addAll((Collection extends Variable>)newValue);
return;
case LogiclanguagePackage.FUNCTION_DEFINITION__DEFINES:
setDefines((FunctionDeclaration)newValue);
return;
case LogiclanguagePackage.FUNCTION_DEFINITION__VALUE:
setValue((Term)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case LogiclanguagePackage.FUNCTION_DEFINITION__VARIABLE:
getVariable().clear();
return;
case LogiclanguagePackage.FUNCTION_DEFINITION__DEFINES:
setDefines((FunctionDeclaration)null);
return;
case LogiclanguagePackage.FUNCTION_DEFINITION__VALUE:
setValue((Term)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case LogiclanguagePackage.FUNCTION_DEFINITION__VARIABLE:
return variable != null && !variable.isEmpty();
case LogiclanguagePackage.FUNCTION_DEFINITION__DEFINES:
return defines != null;
case LogiclanguagePackage.FUNCTION_DEFINITION__VALUE:
return value != null;
}
return super.eIsSet(featureID);
}
} //FunctionDefinitionImpl