/**
*/
package hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl;
import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Constant;
import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage;
import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.TypeReference;
import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.ConstantAnnotation;
import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicproblemPackage;
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.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
*
* An implementation of the model object 'Constant'.
*
*
* The following features are implemented:
*
*
* - {@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.ConstantImpl#getType Type}
* - {@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.ConstantImpl#getAnnotations Annotations}
*
*
* @generated
*/
public abstract class ConstantImpl extends SymbolicDeclarationImpl implements Constant {
/**
* The cached value of the '{@link #getType() Type}' containment reference.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected TypeReference type;
/**
* The cached value of the '{@link #getAnnotations() Annotations}' reference list.
*
*
* @see #getAnnotations()
* @generated
* @ordered
*/
protected EList annotations;
/**
*
*
* @generated
*/
protected ConstantImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return LogiclanguagePackage.Literals.CONSTANT;
}
/**
*
*
* @generated
*/
@Override
public TypeReference getType() {
return type;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetType(TypeReference newType, NotificationChain msgs) {
TypeReference oldType = type;
type = newType;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LogiclanguagePackage.CONSTANT__TYPE, oldType, newType);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setType(TypeReference newType) {
if (newType != type) {
NotificationChain msgs = null;
if (type != null)
msgs = ((InternalEObject)type).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LogiclanguagePackage.CONSTANT__TYPE, null, msgs);
if (newType != null)
msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LogiclanguagePackage.CONSTANT__TYPE, null, msgs);
msgs = basicSetType(newType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LogiclanguagePackage.CONSTANT__TYPE, newType, newType));
}
/**
*
*
* @generated
*/
@Override
public EList getAnnotations() {
if (annotations == null) {
annotations = new EObjectWithInverseResolvingEList(ConstantAnnotation.class, this, LogiclanguagePackage.CONSTANT__ANNOTATIONS, LogicproblemPackage.CONSTANT_ANNOTATION__TARGET);
}
return annotations;
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case LogiclanguagePackage.CONSTANT__ANNOTATIONS:
return ((InternalEList)(InternalEList>)getAnnotations()).basicAdd(otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case LogiclanguagePackage.CONSTANT__TYPE:
return basicSetType(null, msgs);
case LogiclanguagePackage.CONSTANT__ANNOTATIONS:
return ((InternalEList>)getAnnotations()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case LogiclanguagePackage.CONSTANT__TYPE:
return getType();
case LogiclanguagePackage.CONSTANT__ANNOTATIONS:
return getAnnotations();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case LogiclanguagePackage.CONSTANT__TYPE:
setType((TypeReference)newValue);
return;
case LogiclanguagePackage.CONSTANT__ANNOTATIONS:
getAnnotations().clear();
getAnnotations().addAll((Collection extends ConstantAnnotation>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case LogiclanguagePackage.CONSTANT__TYPE:
setType((TypeReference)null);
return;
case LogiclanguagePackage.CONSTANT__ANNOTATIONS:
getAnnotations().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case LogiclanguagePackage.CONSTANT__TYPE:
return type != null;
case LogiclanguagePackage.CONSTANT__ANNOTATIONS:
return annotations != null && !annotations.isEmpty();
}
return super.eIsSet(featureID);
}
} //ConstantImpl