org.contextmapper.dsl.contextMappingDSL.impl.ContextMappingModelImpl Maven / Gradle / Ivy
/**
* generated by Xtext 2.21.0
*/
package org.contextmapper.dsl.contextMappingDSL.impl;
import java.util.Collection;
import org.contextmapper.dsl.contextMappingDSL.BoundedContext;
import org.contextmapper.dsl.contextMappingDSL.ContextMap;
import org.contextmapper.dsl.contextMappingDSL.ContextMappingDSLPackage;
import org.contextmapper.dsl.contextMappingDSL.ContextMappingModel;
import org.contextmapper.dsl.contextMappingDSL.Domain;
import org.contextmapper.dsl.contextMappingDSL.Import;
import org.contextmapper.dsl.contextMappingDSL.UserRequirement;
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;
/**
*
* An implementation of the model object 'Context Mapping Model'.
*
*
* The following features are implemented:
*
*
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.ContextMappingModelImpl#getFirstLineComment First Line Comment}
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.ContextMappingModelImpl#getImports Imports}
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.ContextMappingModelImpl#getMap Map}
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.ContextMappingModelImpl#getBoundedContexts Bounded Contexts}
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.ContextMappingModelImpl#getDomains Domains}
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.ContextMappingModelImpl#getUserRequirements User Requirements}
*
*
* @generated
*/
public class ContextMappingModelImpl extends MinimalEObjectImpl.Container implements ContextMappingModel
{
/**
* The default value of the '{@link #getFirstLineComment() First Line Comment}' attribute.
*
*
* @see #getFirstLineComment()
* @generated
* @ordered
*/
protected static final String FIRST_LINE_COMMENT_EDEFAULT = null;
/**
* The cached value of the '{@link #getFirstLineComment() First Line Comment}' attribute.
*
*
* @see #getFirstLineComment()
* @generated
* @ordered
*/
protected String firstLineComment = FIRST_LINE_COMMENT_EDEFAULT;
/**
* The cached value of the '{@link #getImports() Imports}' containment reference list.
*
*
* @see #getImports()
* @generated
* @ordered
*/
protected EList imports;
/**
* The cached value of the '{@link #getMap() Map}' containment reference.
*
*
* @see #getMap()
* @generated
* @ordered
*/
protected ContextMap map;
/**
* The cached value of the '{@link #getBoundedContexts() Bounded Contexts}' containment reference list.
*
*
* @see #getBoundedContexts()
* @generated
* @ordered
*/
protected EList boundedContexts;
/**
* The cached value of the '{@link #getDomains() Domains}' containment reference list.
*
*
* @see #getDomains()
* @generated
* @ordered
*/
protected EList domains;
/**
* The cached value of the '{@link #getUserRequirements() User Requirements}' containment reference list.
*
*
* @see #getUserRequirements()
* @generated
* @ordered
*/
protected EList userRequirements;
/**
*
*
* @generated
*/
protected ContextMappingModelImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return ContextMappingDSLPackage.Literals.CONTEXT_MAPPING_MODEL;
}
/**
*
*
* @generated
*/
@Override
public String getFirstLineComment()
{
return firstLineComment;
}
/**
*
*
* @generated
*/
@Override
public void setFirstLineComment(String newFirstLineComment)
{
String oldFirstLineComment = firstLineComment;
firstLineComment = newFirstLineComment;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__FIRST_LINE_COMMENT, oldFirstLineComment, firstLineComment));
}
/**
*
*
* @generated
*/
@Override
public EList getImports()
{
if (imports == null)
{
imports = new EObjectContainmentEList(Import.class, this, ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__IMPORTS);
}
return imports;
}
/**
*
*
* @generated
*/
@Override
public ContextMap getMap()
{
return map;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetMap(ContextMap newMap, NotificationChain msgs)
{
ContextMap oldMap = map;
map = newMap;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__MAP, oldMap, newMap);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setMap(ContextMap newMap)
{
if (newMap != map)
{
NotificationChain msgs = null;
if (map != null)
msgs = ((InternalEObject)map).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__MAP, null, msgs);
if (newMap != null)
msgs = ((InternalEObject)newMap).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__MAP, null, msgs);
msgs = basicSetMap(newMap, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__MAP, newMap, newMap));
}
/**
*
*
* @generated
*/
@Override
public EList getBoundedContexts()
{
if (boundedContexts == null)
{
boundedContexts = new EObjectContainmentEList(BoundedContext.class, this, ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__BOUNDED_CONTEXTS);
}
return boundedContexts;
}
/**
*
*
* @generated
*/
@Override
public EList getDomains()
{
if (domains == null)
{
domains = new EObjectContainmentEList(Domain.class, this, ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__DOMAINS);
}
return domains;
}
/**
*
*
* @generated
*/
@Override
public EList getUserRequirements()
{
if (userRequirements == null)
{
userRequirements = new EObjectContainmentEList(UserRequirement.class, this, ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__USER_REQUIREMENTS);
}
return userRequirements;
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__IMPORTS:
return ((InternalEList>)getImports()).basicRemove(otherEnd, msgs);
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__MAP:
return basicSetMap(null, msgs);
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__BOUNDED_CONTEXTS:
return ((InternalEList>)getBoundedContexts()).basicRemove(otherEnd, msgs);
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__DOMAINS:
return ((InternalEList>)getDomains()).basicRemove(otherEnd, msgs);
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__USER_REQUIREMENTS:
return ((InternalEList>)getUserRequirements()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__FIRST_LINE_COMMENT:
return getFirstLineComment();
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__IMPORTS:
return getImports();
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__MAP:
return getMap();
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__BOUNDED_CONTEXTS:
return getBoundedContexts();
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__DOMAINS:
return getDomains();
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__USER_REQUIREMENTS:
return getUserRequirements();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__FIRST_LINE_COMMENT:
setFirstLineComment((String)newValue);
return;
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__IMPORTS:
getImports().clear();
getImports().addAll((Collection extends Import>)newValue);
return;
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__MAP:
setMap((ContextMap)newValue);
return;
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__BOUNDED_CONTEXTS:
getBoundedContexts().clear();
getBoundedContexts().addAll((Collection extends BoundedContext>)newValue);
return;
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__DOMAINS:
getDomains().clear();
getDomains().addAll((Collection extends Domain>)newValue);
return;
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__USER_REQUIREMENTS:
getUserRequirements().clear();
getUserRequirements().addAll((Collection extends UserRequirement>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__FIRST_LINE_COMMENT:
setFirstLineComment(FIRST_LINE_COMMENT_EDEFAULT);
return;
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__IMPORTS:
getImports().clear();
return;
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__MAP:
setMap((ContextMap)null);
return;
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__BOUNDED_CONTEXTS:
getBoundedContexts().clear();
return;
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__DOMAINS:
getDomains().clear();
return;
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__USER_REQUIREMENTS:
getUserRequirements().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__FIRST_LINE_COMMENT:
return FIRST_LINE_COMMENT_EDEFAULT == null ? firstLineComment != null : !FIRST_LINE_COMMENT_EDEFAULT.equals(firstLineComment);
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__IMPORTS:
return imports != null && !imports.isEmpty();
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__MAP:
return map != null;
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__BOUNDED_CONTEXTS:
return boundedContexts != null && !boundedContexts.isEmpty();
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__DOMAINS:
return domains != null && !domains.isEmpty();
case ContextMappingDSLPackage.CONTEXT_MAPPING_MODEL__USER_REQUIREMENTS:
return userRequirements != null && !userRequirements.isEmpty();
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (firstLineComment: ");
result.append(firstLineComment);
result.append(')');
return result.toString();
}
} //ContextMappingModelImpl