org.contextmapper.dsl.contextMappingDSL.impl.SubdomainImpl Maven / Gradle / Ivy
/**
* generated by Xtext 2.20.0
*/
package org.contextmapper.dsl.contextMappingDSL.impl;
import java.util.Collection;
import org.contextmapper.dsl.contextMappingDSL.ContextMappingDSLPackage;
import org.contextmapper.dsl.contextMappingDSL.SubDomainType;
import org.contextmapper.dsl.contextMappingDSL.Subdomain;
import org.contextmapper.tactic.dsl.tacticdsl.Entity;
import org.contextmapper.tactic.dsl.tacticdsl.Service;
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.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
*
* An implementation of the model object 'Subdomain'.
*
*
* The following features are implemented:
*
*
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.SubdomainImpl#getType Type}
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.SubdomainImpl#getEntities Entities}
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.SubdomainImpl#getServices Services}
*
*
* @generated
*/
public class SubdomainImpl extends DomainPartImpl implements Subdomain
{
/**
* The default value of the '{@link #getType() Type}' attribute.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected static final SubDomainType TYPE_EDEFAULT = SubDomainType.CORE_DOMAIN;
/**
* The cached value of the '{@link #getType() Type}' attribute.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected SubDomainType type = TYPE_EDEFAULT;
/**
* The cached value of the '{@link #getEntities() Entities}' containment reference list.
*
*
* @see #getEntities()
* @generated
* @ordered
*/
protected EList entities;
/**
* The cached value of the '{@link #getServices() Services}' containment reference list.
*
*
* @see #getServices()
* @generated
* @ordered
*/
protected EList services;
/**
*
*
* @generated
*/
protected SubdomainImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return ContextMappingDSLPackage.Literals.SUBDOMAIN;
}
/**
*
*
* @generated
*/
public SubDomainType getType()
{
return type;
}
/**
*
*
* @generated
*/
public void setType(SubDomainType newType)
{
SubDomainType oldType = type;
type = newType == null ? TYPE_EDEFAULT : newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ContextMappingDSLPackage.SUBDOMAIN__TYPE, oldType, type));
}
/**
*
*
* @generated
*/
public EList getEntities()
{
if (entities == null)
{
entities = new EObjectContainmentEList(Entity.class, this, ContextMappingDSLPackage.SUBDOMAIN__ENTITIES);
}
return entities;
}
/**
*
*
* @generated
*/
public EList getServices()
{
if (services == null)
{
services = new EObjectContainmentEList(Service.class, this, ContextMappingDSLPackage.SUBDOMAIN__SERVICES);
}
return services;
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case ContextMappingDSLPackage.SUBDOMAIN__ENTITIES:
return ((InternalEList>)getEntities()).basicRemove(otherEnd, msgs);
case ContextMappingDSLPackage.SUBDOMAIN__SERVICES:
return ((InternalEList>)getServices()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case ContextMappingDSLPackage.SUBDOMAIN__TYPE:
return getType();
case ContextMappingDSLPackage.SUBDOMAIN__ENTITIES:
return getEntities();
case ContextMappingDSLPackage.SUBDOMAIN__SERVICES:
return getServices();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case ContextMappingDSLPackage.SUBDOMAIN__TYPE:
setType((SubDomainType)newValue);
return;
case ContextMappingDSLPackage.SUBDOMAIN__ENTITIES:
getEntities().clear();
getEntities().addAll((Collection extends Entity>)newValue);
return;
case ContextMappingDSLPackage.SUBDOMAIN__SERVICES:
getServices().clear();
getServices().addAll((Collection extends Service>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case ContextMappingDSLPackage.SUBDOMAIN__TYPE:
setType(TYPE_EDEFAULT);
return;
case ContextMappingDSLPackage.SUBDOMAIN__ENTITIES:
getEntities().clear();
return;
case ContextMappingDSLPackage.SUBDOMAIN__SERVICES:
getServices().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case ContextMappingDSLPackage.SUBDOMAIN__TYPE:
return type != TYPE_EDEFAULT;
case ContextMappingDSLPackage.SUBDOMAIN__ENTITIES:
return entities != null && !entities.isEmpty();
case ContextMappingDSLPackage.SUBDOMAIN__SERVICES:
return services != null && !services.isEmpty();
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (type: ");
result.append(type);
result.append(')');
return result.toString();
}
} //SubdomainImpl