
sculptormetamodel.impl.ResourceImpl Maven / Gradle / Ivy
/**
*/
package sculptormetamodel.impl;
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.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.InternalEList;
import sculptormetamodel.Module;
import sculptormetamodel.Resource;
import sculptormetamodel.ResourceOperation;
import sculptormetamodel.SculptormetamodelPackage;
import sculptormetamodel.Service;
/**
*
* An implementation of the model object 'Resource'.
*
*
* The following features are implemented:
*
* - {@link sculptormetamodel.impl.ResourceImpl#getServiceDependencies Service Dependencies}
* - {@link sculptormetamodel.impl.ResourceImpl#isGapClass Gap Class}
* - {@link sculptormetamodel.impl.ResourceImpl#getPath Path}
* - {@link sculptormetamodel.impl.ResourceImpl#getOperations Operations}
* - {@link sculptormetamodel.impl.ResourceImpl#getModule Module}
*
*
*
* @generated
*/
public class ResourceImpl extends NamedElementImpl implements Resource
{
/**
* The cached value of the '{@link #getServiceDependencies() Service Dependencies}' reference list.
*
*
* @see #getServiceDependencies()
* @generated
* @ordered
*/
protected EList serviceDependencies;
/**
* The default value of the '{@link #isGapClass() Gap Class}' attribute.
*
*
* @see #isGapClass()
* @generated
* @ordered
*/
protected static final boolean GAP_CLASS_EDEFAULT = false;
/**
* The cached value of the '{@link #isGapClass() Gap Class}' attribute.
*
*
* @see #isGapClass()
* @generated
* @ordered
*/
protected boolean gapClass = GAP_CLASS_EDEFAULT;
/**
* The default value of the '{@link #getPath() Path}' attribute.
*
*
* @see #getPath()
* @generated
* @ordered
*/
protected static final String PATH_EDEFAULT = null;
/**
* The cached value of the '{@link #getPath() Path}' attribute.
*
*
* @see #getPath()
* @generated
* @ordered
*/
protected String path = PATH_EDEFAULT;
/**
* The cached value of the '{@link #getOperations() Operations}' containment reference list.
*
*
* @see #getOperations()
* @generated
* @ordered
*/
protected EList operations;
/**
*
*
* @generated
*/
protected ResourceImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return SculptormetamodelPackage.Literals.RESOURCE;
}
/**
*
*
* @generated
*/
public EList getServiceDependencies()
{
if (serviceDependencies == null)
{
serviceDependencies = new EObjectResolvingEList(Service.class, this, SculptormetamodelPackage.RESOURCE__SERVICE_DEPENDENCIES);
}
return serviceDependencies;
}
/**
*
*
* @generated
*/
public boolean isGapClass()
{
return gapClass;
}
/**
*
*
* @generated
*/
public void setGapClass(boolean newGapClass)
{
boolean oldGapClass = gapClass;
gapClass = newGapClass;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SculptormetamodelPackage.RESOURCE__GAP_CLASS, oldGapClass, gapClass));
}
/**
*
*
* @generated
*/
public String getPath()
{
return path;
}
/**
*
*
* @generated
*/
public void setPath(String newPath)
{
String oldPath = path;
path = newPath;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SculptormetamodelPackage.RESOURCE__PATH, oldPath, path));
}
/**
*
*
* @generated
*/
public EList getOperations()
{
if (operations == null)
{
operations = new EObjectContainmentWithInverseEList(ResourceOperation.class, this, SculptormetamodelPackage.RESOURCE__OPERATIONS, SculptormetamodelPackage.RESOURCE_OPERATION__RESOURCE);
}
return operations;
}
/**
*
*
* @generated
*/
public Module getModule()
{
if (eContainerFeatureID() != SculptormetamodelPackage.RESOURCE__MODULE) return null;
return (Module)eInternalContainer();
}
/**
*
*
* @generated
*/
public NotificationChain basicSetModule(Module newModule, NotificationChain msgs)
{
msgs = eBasicSetContainer((InternalEObject)newModule, SculptormetamodelPackage.RESOURCE__MODULE, msgs);
return msgs;
}
/**
*
*
* @generated
*/
public void setModule(Module newModule)
{
if (newModule != eInternalContainer() || (eContainerFeatureID() != SculptormetamodelPackage.RESOURCE__MODULE && newModule != null))
{
if (EcoreUtil.isAncestor(this, newModule))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newModule != null)
msgs = ((InternalEObject)newModule).eInverseAdd(this, SculptormetamodelPackage.MODULE__RESOURCES, Module.class, msgs);
msgs = basicSetModule(newModule, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SculptormetamodelPackage.RESOURCE__MODULE, newModule, newModule));
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case SculptormetamodelPackage.RESOURCE__OPERATIONS:
return ((InternalEList)(InternalEList>)getOperations()).basicAdd(otherEnd, msgs);
case SculptormetamodelPackage.RESOURCE__MODULE:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetModule((Module)otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case SculptormetamodelPackage.RESOURCE__OPERATIONS:
return ((InternalEList>)getOperations()).basicRemove(otherEnd, msgs);
case SculptormetamodelPackage.RESOURCE__MODULE:
return basicSetModule(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs)
{
switch (eContainerFeatureID())
{
case SculptormetamodelPackage.RESOURCE__MODULE:
return eInternalContainer().eInverseRemove(this, SculptormetamodelPackage.MODULE__RESOURCES, Module.class, msgs);
}
return super.eBasicRemoveFromContainerFeature(msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case SculptormetamodelPackage.RESOURCE__SERVICE_DEPENDENCIES:
return getServiceDependencies();
case SculptormetamodelPackage.RESOURCE__GAP_CLASS:
return isGapClass();
case SculptormetamodelPackage.RESOURCE__PATH:
return getPath();
case SculptormetamodelPackage.RESOURCE__OPERATIONS:
return getOperations();
case SculptormetamodelPackage.RESOURCE__MODULE:
return getModule();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case SculptormetamodelPackage.RESOURCE__SERVICE_DEPENDENCIES:
getServiceDependencies().clear();
getServiceDependencies().addAll((Collection extends Service>)newValue);
return;
case SculptormetamodelPackage.RESOURCE__GAP_CLASS:
setGapClass((Boolean)newValue);
return;
case SculptormetamodelPackage.RESOURCE__PATH:
setPath((String)newValue);
return;
case SculptormetamodelPackage.RESOURCE__OPERATIONS:
getOperations().clear();
getOperations().addAll((Collection extends ResourceOperation>)newValue);
return;
case SculptormetamodelPackage.RESOURCE__MODULE:
setModule((Module)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case SculptormetamodelPackage.RESOURCE__SERVICE_DEPENDENCIES:
getServiceDependencies().clear();
return;
case SculptormetamodelPackage.RESOURCE__GAP_CLASS:
setGapClass(GAP_CLASS_EDEFAULT);
return;
case SculptormetamodelPackage.RESOURCE__PATH:
setPath(PATH_EDEFAULT);
return;
case SculptormetamodelPackage.RESOURCE__OPERATIONS:
getOperations().clear();
return;
case SculptormetamodelPackage.RESOURCE__MODULE:
setModule((Module)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case SculptormetamodelPackage.RESOURCE__SERVICE_DEPENDENCIES:
return serviceDependencies != null && !serviceDependencies.isEmpty();
case SculptormetamodelPackage.RESOURCE__GAP_CLASS:
return gapClass != GAP_CLASS_EDEFAULT;
case SculptormetamodelPackage.RESOURCE__PATH:
return PATH_EDEFAULT == null ? path != null : !PATH_EDEFAULT.equals(path);
case SculptormetamodelPackage.RESOURCE__OPERATIONS:
return operations != null && !operations.isEmpty();
case SculptormetamodelPackage.RESOURCE__MODULE:
return getModule() != null;
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (gapClass: ");
result.append(gapClass);
result.append(", path: ");
result.append(path);
result.append(')');
return result.toString();
}
} //ResourceImpl
© 2015 - 2025 Weber Informatics LLC | Privacy Policy