/**
*/
package hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl;
import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Assertion;
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.logicproblem.AssertionAnnotation;
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.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
*
* An implementation of the model object 'Assertion'.
*
*
* The following features are implemented:
*
*
* - {@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.AssertionImpl#getValue Value}
* - {@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.AssertionImpl#getName Name}
* - {@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl.AssertionImpl#getAnnotations Annotations}
*
*
* @generated
*/
public class AssertionImpl extends MinimalEObjectImpl.Container implements Assertion {
/**
* The cached value of the '{@link #getValue() Value}' containment reference.
*
*
* @see #getValue()
* @generated
* @ordered
*/
protected Term value;
/**
* 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 #getAnnotations() Annotations}' reference list.
*
*
* @see #getAnnotations()
* @generated
* @ordered
*/
protected EList annotations;
/**
*
*
* @generated
*/
protected AssertionImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return LogiclanguagePackage.Literals.ASSERTION;
}
/**
*
*
* @generated
*/
@Override
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.ASSERTION__VALUE, oldValue, newValue);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setValue(Term newValue) {
if (newValue != value) {
NotificationChain msgs = null;
if (value != null)
msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LogiclanguagePackage.ASSERTION__VALUE, null, msgs);
if (newValue != null)
msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LogiclanguagePackage.ASSERTION__VALUE, null, msgs);
msgs = basicSetValue(newValue, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LogiclanguagePackage.ASSERTION__VALUE, newValue, newValue));
}
/**
*
*
* @generated
*/
@Override
public String getName() {
return name;
}
/**
*
*
* @generated
*/
@Override
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LogiclanguagePackage.ASSERTION__NAME, oldName, name));
}
/**
*
*
* @generated
*/
@Override
public EList getAnnotations() {
if (annotations == null) {
annotations = new EObjectWithInverseResolvingEList(AssertionAnnotation.class, this, LogiclanguagePackage.ASSERTION__ANNOTATIONS, LogicproblemPackage.ASSERTION_ANNOTATION__TARGET);
}
return annotations;
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case LogiclanguagePackage.ASSERTION__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.ASSERTION__VALUE:
return basicSetValue(null, msgs);
case LogiclanguagePackage.ASSERTION__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.ASSERTION__VALUE:
return getValue();
case LogiclanguagePackage.ASSERTION__NAME:
return getName();
case LogiclanguagePackage.ASSERTION__ANNOTATIONS:
return getAnnotations();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case LogiclanguagePackage.ASSERTION__VALUE:
setValue((Term)newValue);
return;
case LogiclanguagePackage.ASSERTION__NAME:
setName((String)newValue);
return;
case LogiclanguagePackage.ASSERTION__ANNOTATIONS:
getAnnotations().clear();
getAnnotations().addAll((Collection extends AssertionAnnotation>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case LogiclanguagePackage.ASSERTION__VALUE:
setValue((Term)null);
return;
case LogiclanguagePackage.ASSERTION__NAME:
setName(NAME_EDEFAULT);
return;
case LogiclanguagePackage.ASSERTION__ANNOTATIONS:
getAnnotations().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case LogiclanguagePackage.ASSERTION__VALUE:
return value != null;
case LogiclanguagePackage.ASSERTION__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case LogiclanguagePackage.ASSERTION__ANNOTATIONS:
return annotations != null && !annotations.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();
}
} //AssertionImpl