/**
*/
package hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.impl;
import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir;
import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject;
import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage;
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.emf.ecore.util.EcoreUtil;
/**
*
* An implementation of the model object 'FS Object'.
*
*
* The following features are implemented:
*
*
* - {@link hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.impl.FSObjectImpl#getParent Parent}
*
*
* @generated
*/
public abstract class FSObjectImpl extends MinimalEObjectImpl.Container implements FSObject {
/**
*
*
* @generated
*/
protected FSObjectImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return FilesystemPackage.Literals.FS_OBJECT;
}
/**
*
*
* @generated
*/
public Dir getParent() {
if (eContainerFeatureID() != FilesystemPackage.FS_OBJECT__PARENT) return null;
return (Dir)eInternalContainer();
}
/**
*
*
* @generated
*/
public NotificationChain basicSetParent(Dir newParent, NotificationChain msgs) {
msgs = eBasicSetContainer((InternalEObject)newParent, FilesystemPackage.FS_OBJECT__PARENT, msgs);
return msgs;
}
/**
*
*
* @generated
*/
public void setParent(Dir newParent) {
if (newParent != eInternalContainer() || (eContainerFeatureID() != FilesystemPackage.FS_OBJECT__PARENT && newParent != null)) {
if (EcoreUtil.isAncestor(this, newParent))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newParent != null)
msgs = ((InternalEObject)newParent).eInverseAdd(this, FilesystemPackage.DIR__CONTENTS, Dir.class, msgs);
msgs = basicSetParent(newParent, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FilesystemPackage.FS_OBJECT__PARENT, newParent, newParent));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FilesystemPackage.FS_OBJECT__PARENT:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetParent((Dir)otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FilesystemPackage.FS_OBJECT__PARENT:
return basicSetParent(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
switch (eContainerFeatureID()) {
case FilesystemPackage.FS_OBJECT__PARENT:
return eInternalContainer().eInverseRemove(this, FilesystemPackage.DIR__CONTENTS, Dir.class, msgs);
}
return super.eBasicRemoveFromContainerFeature(msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case FilesystemPackage.FS_OBJECT__PARENT:
return getParent();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case FilesystemPackage.FS_OBJECT__PARENT:
setParent((Dir)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FilesystemPackage.FS_OBJECT__PARENT:
setParent((Dir)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FilesystemPackage.FS_OBJECT__PARENT:
return getParent() != null;
}
return super.eIsSet(featureID);
}
} //FSObjectImpl