blob: f24bed4fd0a6d6c2bfacfa156119a872cf800f2f [file] [log] [blame]
/**
*/
package morphisms.impl;
import graph.Graph;
import java.util.Collection;
import morphisms.Mapping;
import morphisms.Morphism;
import morphisms.MorphismsPackage;
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.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Morphism</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link morphisms.impl.MorphismImpl#getDomain <em>Domain</em>}</li>
* <li>{@link morphisms.impl.MorphismImpl#getCodomain <em>Codomain</em>}</li>
* <li>{@link morphisms.impl.MorphismImpl#getMappings <em>Mappings</em>}</li>
* </ul>
*
* @generated
*/
public class MorphismImpl extends MinimalEObjectImpl.Container implements Morphism {
/**
* The cached value of the '{@link #getDomain() <em>Domain</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDomain()
* @generated
* @ordered
*/
protected Graph domain;
/**
* The cached value of the '{@link #getCodomain() <em>Codomain</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCodomain()
* @generated
* @ordered
*/
protected Graph codomain;
/**
* The cached value of the '{@link #getMappings() <em>Mappings</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMappings()
* @generated
* @ordered
*/
protected EList<Mapping> mappings;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected MorphismImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return MorphismsPackage.Literals.MORPHISM;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Graph getDomain() {
if (domain != null && domain.eIsProxy()) {
InternalEObject oldDomain = (InternalEObject)domain;
domain = (Graph)eResolveProxy(oldDomain);
if (domain != oldDomain) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, MorphismsPackage.MORPHISM__DOMAIN, oldDomain, domain));
}
}
return domain;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Graph basicGetDomain() {
return domain;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDomain(Graph newDomain) {
Graph oldDomain = domain;
domain = newDomain;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, MorphismsPackage.MORPHISM__DOMAIN, oldDomain, domain));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Graph getCodomain() {
if (codomain != null && codomain.eIsProxy()) {
InternalEObject oldCodomain = (InternalEObject)codomain;
codomain = (Graph)eResolveProxy(oldCodomain);
if (codomain != oldCodomain) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, MorphismsPackage.MORPHISM__CODOMAIN, oldCodomain, codomain));
}
}
return codomain;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Graph basicGetCodomain() {
return codomain;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCodomain(Graph newCodomain) {
Graph oldCodomain = codomain;
codomain = newCodomain;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, MorphismsPackage.MORPHISM__CODOMAIN, oldCodomain, codomain));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Mapping> getMappings() {
if (mappings == null) {
mappings = new EObjectContainmentEList<Mapping>(Mapping.class, this, MorphismsPackage.MORPHISM__MAPPINGS);
}
return mappings;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case MorphismsPackage.MORPHISM__MAPPINGS:
return ((InternalEList<?>)getMappings()).basicRemove(otherEnd, 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 MorphismsPackage.MORPHISM__DOMAIN:
if (resolve) return getDomain();
return basicGetDomain();
case MorphismsPackage.MORPHISM__CODOMAIN:
if (resolve) return getCodomain();
return basicGetCodomain();
case MorphismsPackage.MORPHISM__MAPPINGS:
return getMappings();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case MorphismsPackage.MORPHISM__DOMAIN:
setDomain((Graph)newValue);
return;
case MorphismsPackage.MORPHISM__CODOMAIN:
setCodomain((Graph)newValue);
return;
case MorphismsPackage.MORPHISM__MAPPINGS:
getMappings().clear();
getMappings().addAll((Collection<? extends Mapping>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case MorphismsPackage.MORPHISM__DOMAIN:
setDomain((Graph)null);
return;
case MorphismsPackage.MORPHISM__CODOMAIN:
setCodomain((Graph)null);
return;
case MorphismsPackage.MORPHISM__MAPPINGS:
getMappings().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case MorphismsPackage.MORPHISM__DOMAIN:
return domain != null;
case MorphismsPackage.MORPHISM__CODOMAIN:
return codomain != null;
case MorphismsPackage.MORPHISM__MAPPINGS:
return mappings != null && !mappings.isEmpty();
}
return super.eIsSet(featureID);
}
} //MorphismImpl