org.contextmapper.dsl.contextMappingDSL.impl.ContextMapImpl Maven / Gradle / Ivy
/**
* generated by Xtext 2.20.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.ContextMapState;
import org.contextmapper.dsl.contextMappingDSL.ContextMapType;
import org.contextmapper.dsl.contextMappingDSL.ContextMappingDSLPackage;
import org.contextmapper.dsl.contextMappingDSL.Relationship;
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.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
*
* An implementation of the model object 'Context Map'.
*
*
* The following features are implemented:
*
*
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.ContextMapImpl#getName Name}
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.ContextMapImpl#getType Type}
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.ContextMapImpl#getState State}
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.ContextMapImpl#getBoundedContexts Bounded Contexts}
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.ContextMapImpl#getRelationships Relationships}
*
*
* @generated
*/
public class ContextMapImpl extends MinimalEObjectImpl.Container implements ContextMap
{
/**
* The default value of the '{@link #getName() Name}' attribute.
*
*
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() Name}' attribute.
*
*
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The default value of the '{@link #getType() Type}' attribute.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected static final ContextMapType TYPE_EDEFAULT = ContextMapType.SYSTEM_LANDSCAPE;
/**
* The cached value of the '{@link #getType() Type}' attribute.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected ContextMapType type = TYPE_EDEFAULT;
/**
* The default value of the '{@link #getState() State}' attribute.
*
*
* @see #getState()
* @generated
* @ordered
*/
protected static final ContextMapState STATE_EDEFAULT = ContextMapState.AS_IS;
/**
* The cached value of the '{@link #getState() State}' attribute.
*
*
* @see #getState()
* @generated
* @ordered
*/
protected ContextMapState state = STATE_EDEFAULT;
/**
* The cached value of the '{@link #getBoundedContexts() Bounded Contexts}' reference list.
*
*
* @see #getBoundedContexts()
* @generated
* @ordered
*/
protected EList boundedContexts;
/**
* The cached value of the '{@link #getRelationships() Relationships}' containment reference list.
*
*
* @see #getRelationships()
* @generated
* @ordered
*/
protected EList relationships;
/**
*
*
* @generated
*/
protected ContextMapImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return ContextMappingDSLPackage.Literals.CONTEXT_MAP;
}
/**
*
*
* @generated
*/
public String getName()
{
return name;
}
/**
*
*
* @generated
*/
public void setName(String newName)
{
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ContextMappingDSLPackage.CONTEXT_MAP__NAME, oldName, name));
}
/**
*
*
* @generated
*/
public ContextMapType getType()
{
return type;
}
/**
*
*
* @generated
*/
public void setType(ContextMapType newType)
{
ContextMapType oldType = type;
type = newType == null ? TYPE_EDEFAULT : newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ContextMappingDSLPackage.CONTEXT_MAP__TYPE, oldType, type));
}
/**
*
*
* @generated
*/
public ContextMapState getState()
{
return state;
}
/**
*
*
* @generated
*/
public void setState(ContextMapState newState)
{
ContextMapState oldState = state;
state = newState == null ? STATE_EDEFAULT : newState;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ContextMappingDSLPackage.CONTEXT_MAP__STATE, oldState, state));
}
/**
*
*
* @generated
*/
public EList getBoundedContexts()
{
if (boundedContexts == null)
{
boundedContexts = new EObjectResolvingEList(BoundedContext.class, this, ContextMappingDSLPackage.CONTEXT_MAP__BOUNDED_CONTEXTS);
}
return boundedContexts;
}
/**
*
*
* @generated
*/
public EList getRelationships()
{
if (relationships == null)
{
relationships = new EObjectContainmentEList(Relationship.class, this, ContextMappingDSLPackage.CONTEXT_MAP__RELATIONSHIPS);
}
return relationships;
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case ContextMappingDSLPackage.CONTEXT_MAP__RELATIONSHIPS:
return ((InternalEList>)getRelationships()).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_MAP__NAME:
return getName();
case ContextMappingDSLPackage.CONTEXT_MAP__TYPE:
return getType();
case ContextMappingDSLPackage.CONTEXT_MAP__STATE:
return getState();
case ContextMappingDSLPackage.CONTEXT_MAP__BOUNDED_CONTEXTS:
return getBoundedContexts();
case ContextMappingDSLPackage.CONTEXT_MAP__RELATIONSHIPS:
return getRelationships();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case ContextMappingDSLPackage.CONTEXT_MAP__NAME:
setName((String)newValue);
return;
case ContextMappingDSLPackage.CONTEXT_MAP__TYPE:
setType((ContextMapType)newValue);
return;
case ContextMappingDSLPackage.CONTEXT_MAP__STATE:
setState((ContextMapState)newValue);
return;
case ContextMappingDSLPackage.CONTEXT_MAP__BOUNDED_CONTEXTS:
getBoundedContexts().clear();
getBoundedContexts().addAll((Collection extends BoundedContext>)newValue);
return;
case ContextMappingDSLPackage.CONTEXT_MAP__RELATIONSHIPS:
getRelationships().clear();
getRelationships().addAll((Collection extends Relationship>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case ContextMappingDSLPackage.CONTEXT_MAP__NAME:
setName(NAME_EDEFAULT);
return;
case ContextMappingDSLPackage.CONTEXT_MAP__TYPE:
setType(TYPE_EDEFAULT);
return;
case ContextMappingDSLPackage.CONTEXT_MAP__STATE:
setState(STATE_EDEFAULT);
return;
case ContextMappingDSLPackage.CONTEXT_MAP__BOUNDED_CONTEXTS:
getBoundedContexts().clear();
return;
case ContextMappingDSLPackage.CONTEXT_MAP__RELATIONSHIPS:
getRelationships().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case ContextMappingDSLPackage.CONTEXT_MAP__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case ContextMappingDSLPackage.CONTEXT_MAP__TYPE:
return type != TYPE_EDEFAULT;
case ContextMappingDSLPackage.CONTEXT_MAP__STATE:
return state != STATE_EDEFAULT;
case ContextMappingDSLPackage.CONTEXT_MAP__BOUNDED_CONTEXTS:
return boundedContexts != null && !boundedContexts.isEmpty();
case ContextMappingDSLPackage.CONTEXT_MAP__RELATIONSHIPS:
return relationships != null && !relationships.isEmpty();
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (name: ");
result.append(name);
result.append(", type: ");
result.append(type);
result.append(", state: ");
result.append(state);
result.append(')');
return result.toString();
}
} //ContextMapImpl