/**
*/
package org.eclipse.viatra.solver.language.model.problem.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
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.viatra.solver.language.model.problem.Constant;
import org.eclipse.viatra.solver.language.model.problem.Node;
import org.eclipse.viatra.solver.language.model.problem.NodeValueAssertion;
import org.eclipse.viatra.solver.language.model.problem.ProblemPackage;
/**
*
* An implementation of the model object 'Node Value Assertion'.
*
*
* The following features are implemented:
*
*
* - {@link org.eclipse.viatra.solver.language.model.problem.impl.NodeValueAssertionImpl#getNode Node}
* - {@link org.eclipse.viatra.solver.language.model.problem.impl.NodeValueAssertionImpl#getValue Value}
*
*
* @generated
*/
public class NodeValueAssertionImpl extends MinimalEObjectImpl.Container implements NodeValueAssertion {
/**
* The cached value of the '{@link #getNode() Node}' reference.
*
*
* @see #getNode()
* @generated
* @ordered
*/
protected Node node;
/**
* The cached value of the '{@link #getValue() Value}' containment reference.
*
*
* @see #getValue()
* @generated
* @ordered
*/
protected Constant value;
/**
*
*
* @generated
*/
protected NodeValueAssertionImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return ProblemPackage.Literals.NODE_VALUE_ASSERTION;
}
/**
*
*
* @generated
*/
public Node getNode() {
if (node != null && node.eIsProxy()) {
InternalEObject oldNode = (InternalEObject) node;
node = (Node) eResolveProxy(oldNode);
if (node != oldNode) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProblemPackage.NODE_VALUE_ASSERTION__NODE,
oldNode, node));
}
}
return node;
}
/**
*
*
* @generated
*/
public Node basicGetNode() {
return node;
}
/**
*
*
* @generated
*/
public void setNode(Node newNode) {
Node oldNode = node;
node = newNode;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProblemPackage.NODE_VALUE_ASSERTION__NODE, oldNode,
node));
}
/**
*
*
* @generated
*/
public Constant getValue() {
return value;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetValue(Constant newValue, NotificationChain msgs) {
Constant oldValue = value;
value = newValue;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
ProblemPackage.NODE_VALUE_ASSERTION__VALUE, oldValue, newValue);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setValue(Constant newValue) {
if (newValue != value) {
NotificationChain msgs = null;
if (value != null)
msgs = ((InternalEObject) value).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE - ProblemPackage.NODE_VALUE_ASSERTION__VALUE, null, msgs);
if (newValue != null)
msgs = ((InternalEObject) newValue).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE - ProblemPackage.NODE_VALUE_ASSERTION__VALUE, null, msgs);
msgs = basicSetValue(newValue, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProblemPackage.NODE_VALUE_ASSERTION__VALUE, newValue,
newValue));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ProblemPackage.NODE_VALUE_ASSERTION__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 ProblemPackage.NODE_VALUE_ASSERTION__NODE:
if (resolve)
return getNode();
return basicGetNode();
case ProblemPackage.NODE_VALUE_ASSERTION__VALUE:
return getValue();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ProblemPackage.NODE_VALUE_ASSERTION__NODE:
setNode((Node) newValue);
return;
case ProblemPackage.NODE_VALUE_ASSERTION__VALUE:
setValue((Constant) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ProblemPackage.NODE_VALUE_ASSERTION__NODE:
setNode((Node) null);
return;
case ProblemPackage.NODE_VALUE_ASSERTION__VALUE:
setValue((Constant) null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ProblemPackage.NODE_VALUE_ASSERTION__NODE:
return node != null;
case ProblemPackage.NODE_VALUE_ASSERTION__VALUE:
return value != null;
}
return super.eIsSet(featureID);
}
} //NodeValueAssertionImpl