/**
*/
package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.impl;
import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RelationDeclaration;
import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.impl.AssertionAnnotationImpl;
import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.Partial2logicannotationsPackage;
import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion;
import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RelationLink;
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 'Partial Model Relation2 Assertion'.
*
*
* The following features are implemented:
*
*
* - {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.impl.PartialModelRelation2AssertionImpl#getLinks Links}
* - {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.impl.PartialModelRelation2AssertionImpl#getTargetRelation Target Relation}
*
*
* @generated
*/
public class PartialModelRelation2AssertionImpl extends AssertionAnnotationImpl implements PartialModelRelation2Assertion {
/**
* The cached value of the '{@link #getLinks() Links}' containment reference list.
*
*
* @see #getLinks()
* @generated
* @ordered
*/
protected EList links;
/**
* The cached value of the '{@link #getTargetRelation() Target Relation}' reference.
*
*
* @see #getTargetRelation()
* @generated
* @ordered
*/
protected RelationDeclaration targetRelation;
/**
*
*
* @generated
*/
protected PartialModelRelation2AssertionImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return Partial2logicannotationsPackage.Literals.PARTIAL_MODEL_RELATION2_ASSERTION;
}
/**
*
*
* @generated
*/
public EList getLinks() {
if (links == null) {
links = new EObjectContainmentEList(RelationLink.class, this, Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__LINKS);
}
return links;
}
/**
*
*
* @generated
*/
public RelationDeclaration getTargetRelation() {
if (targetRelation != null && targetRelation.eIsProxy()) {
InternalEObject oldTargetRelation = (InternalEObject)targetRelation;
targetRelation = (RelationDeclaration)eResolveProxy(oldTargetRelation);
if (targetRelation != oldTargetRelation) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__TARGET_RELATION, oldTargetRelation, targetRelation));
}
}
return targetRelation;
}
/**
*
*
* @generated
*/
public RelationDeclaration basicGetTargetRelation() {
return targetRelation;
}
/**
*
*
* @generated
*/
public void setTargetRelation(RelationDeclaration newTargetRelation) {
RelationDeclaration oldTargetRelation = targetRelation;
targetRelation = newTargetRelation;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__TARGET_RELATION, oldTargetRelation, targetRelation));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__LINKS:
return ((InternalEList>)getLinks()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__LINKS:
return getLinks();
case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__TARGET_RELATION:
if (resolve) return getTargetRelation();
return basicGetTargetRelation();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__LINKS:
getLinks().clear();
getLinks().addAll((Collection extends RelationLink>)newValue);
return;
case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__TARGET_RELATION:
setTargetRelation((RelationDeclaration)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__LINKS:
getLinks().clear();
return;
case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__TARGET_RELATION:
setTargetRelation((RelationDeclaration)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__LINKS:
return links != null && !links.isEmpty();
case Partial2logicannotationsPackage.PARTIAL_MODEL_RELATION2_ASSERTION__TARGET_RELATION:
return targetRelation != null;
}
return super.eIsSet(featureID);
}
} //PartialModelRelation2AssertionImpl