/**
*/
package net.certware.evidence.hugin.netDSL.impl;
import net.certware.evidence.hugin.netDSL.NetDSLPackage;
import net.certware.evidence.hugin.netDSL.Potential;
import net.certware.evidence.hugin.netDSL.PotentialGraph;
import net.certware.evidence.hugin.netDSL.PotentialModel;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Potential</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link net.certware.evidence.hugin.netDSL.impl.PotentialImpl#getGraph <em>Graph</em>}</li>
* <li>{@link net.certware.evidence.hugin.netDSL.impl.PotentialImpl#getModel <em>Model</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class PotentialImpl extends DomainElementImpl implements Potential
{
/**
* The cached value of the '{@link #getGraph() <em>Graph</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getGraph()
* @generated
* @ordered
*/
protected PotentialGraph graph;
/**
* The cached value of the '{@link #getModel() <em>Model</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getModel()
* @generated
* @ordered
*/
protected PotentialModel model;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PotentialImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return NetDSLPackage.Literals.POTENTIAL;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PotentialGraph getGraph()
{
return graph;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetGraph(PotentialGraph newGraph, NotificationChain msgs)
{
PotentialGraph oldGraph = graph;
graph = newGraph;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, NetDSLPackage.POTENTIAL__GRAPH, oldGraph, newGraph);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setGraph(PotentialGraph newGraph)
{
if (newGraph != graph)
{
NotificationChain msgs = null;
if (graph != null)
msgs = ((InternalEObject)graph).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - NetDSLPackage.POTENTIAL__GRAPH, null, msgs);
if (newGraph != null)
msgs = ((InternalEObject)newGraph).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - NetDSLPackage.POTENTIAL__GRAPH, null, msgs);
msgs = basicSetGraph(newGraph, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, NetDSLPackage.POTENTIAL__GRAPH, newGraph, newGraph));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PotentialModel getModel()
{
return model;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetModel(PotentialModel newModel, NotificationChain msgs)
{
PotentialModel oldModel = model;
model = newModel;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, NetDSLPackage.POTENTIAL__MODEL, oldModel, newModel);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setModel(PotentialModel newModel)
{
if (newModel != model)
{
NotificationChain msgs = null;
if (model != null)
msgs = ((InternalEObject)model).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - NetDSLPackage.POTENTIAL__MODEL, null, msgs);
if (newModel != null)
msgs = ((InternalEObject)newModel).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - NetDSLPackage.POTENTIAL__MODEL, null, msgs);
msgs = basicSetModel(newModel, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, NetDSLPackage.POTENTIAL__MODEL, newModel, newModel));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case NetDSLPackage.POTENTIAL__GRAPH:
return basicSetGraph(null, msgs);
case NetDSLPackage.POTENTIAL__MODEL:
return basicSetModel(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case NetDSLPackage.POTENTIAL__GRAPH:
return getGraph();
case NetDSLPackage.POTENTIAL__MODEL:
return getModel();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case NetDSLPackage.POTENTIAL__GRAPH:
setGraph((PotentialGraph)newValue);
return;
case NetDSLPackage.POTENTIAL__MODEL:
setModel((PotentialModel)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case NetDSLPackage.POTENTIAL__GRAPH:
setGraph((PotentialGraph)null);
return;
case NetDSLPackage.POTENTIAL__MODEL:
setModel((PotentialModel)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case NetDSLPackage.POTENTIAL__GRAPH:
return graph != null;
case NetDSLPackage.POTENTIAL__MODEL:
return model != null;
}
return super.eIsSet(featureID);
}
} //PotentialImpl