org.contextmapper.dsl.contextMappingDSL.impl.UserRequirementImpl 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.Feature;
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.EDataTypeEList;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
*
* An implementation of the model object 'User Requirement'.
*
*
* The following features are implemented:
*
*
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.UserRequirementImpl#getName Name}
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.UserRequirementImpl#getRole Role}
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.UserRequirementImpl#getFeatures Features}
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.UserRequirementImpl#getBenefit Benefit}
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.UserRequirementImpl#isIsLatencyCritical Is Latency Critical}
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.UserRequirementImpl#getNanoentitiesRead Nanoentities Read}
* - {@link org.contextmapper.dsl.contextMappingDSL.impl.UserRequirementImpl#getNanoentitiesWritten Nanoentities Written}
*
*
* @generated
*/
public class UserRequirementImpl extends MinimalEObjectImpl.Container implements UserRequirement
{
/**
* 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 #getRole() Role}' attribute.
*
*
* @see #getRole()
* @generated
* @ordered
*/
protected static final String ROLE_EDEFAULT = null;
/**
* The cached value of the '{@link #getRole() Role}' attribute.
*
*
* @see #getRole()
* @generated
* @ordered
*/
protected String role = ROLE_EDEFAULT;
/**
* The cached value of the '{@link #getFeatures() Features}' containment reference list.
*
*
* @see #getFeatures()
* @generated
* @ordered
*/
protected EList features;
/**
* The default value of the '{@link #getBenefit() Benefit}' attribute.
*
*
* @see #getBenefit()
* @generated
* @ordered
*/
protected static final String BENEFIT_EDEFAULT = null;
/**
* The cached value of the '{@link #getBenefit() Benefit}' attribute.
*
*
* @see #getBenefit()
* @generated
* @ordered
*/
protected String benefit = BENEFIT_EDEFAULT;
/**
* The default value of the '{@link #isIsLatencyCritical() Is Latency Critical}' attribute.
*
*
* @see #isIsLatencyCritical()
* @generated
* @ordered
*/
protected static final boolean IS_LATENCY_CRITICAL_EDEFAULT = false;
/**
* The cached value of the '{@link #isIsLatencyCritical() Is Latency Critical}' attribute.
*
*
* @see #isIsLatencyCritical()
* @generated
* @ordered
*/
protected boolean isLatencyCritical = IS_LATENCY_CRITICAL_EDEFAULT;
/**
* The cached value of the '{@link #getNanoentitiesRead() Nanoentities Read}' attribute list.
*
*
* @see #getNanoentitiesRead()
* @generated
* @ordered
*/
protected EList nanoentitiesRead;
/**
* The cached value of the '{@link #getNanoentitiesWritten() Nanoentities Written}' attribute list.
*
*
* @see #getNanoentitiesWritten()
* @generated
* @ordered
*/
protected EList nanoentitiesWritten;
/**
*
*
* @generated
*/
protected UserRequirementImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return ContextMappingDSLPackage.Literals.USER_REQUIREMENT;
}
/**
*
*
* @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.USER_REQUIREMENT__NAME, oldName, name));
}
/**
*
*
* @generated
*/
public String getRole()
{
return role;
}
/**
*
*
* @generated
*/
public void setRole(String newRole)
{
String oldRole = role;
role = newRole;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ContextMappingDSLPackage.USER_REQUIREMENT__ROLE, oldRole, role));
}
/**
*
*
* @generated
*/
public EList getFeatures()
{
if (features == null)
{
features = new EObjectContainmentEList(Feature.class, this, ContextMappingDSLPackage.USER_REQUIREMENT__FEATURES);
}
return features;
}
/**
*
*
* @generated
*/
public String getBenefit()
{
return benefit;
}
/**
*
*
* @generated
*/
public void setBenefit(String newBenefit)
{
String oldBenefit = benefit;
benefit = newBenefit;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ContextMappingDSLPackage.USER_REQUIREMENT__BENEFIT, oldBenefit, benefit));
}
/**
*
*
* @generated
*/
public boolean isIsLatencyCritical()
{
return isLatencyCritical;
}
/**
*
*
* @generated
*/
public void setIsLatencyCritical(boolean newIsLatencyCritical)
{
boolean oldIsLatencyCritical = isLatencyCritical;
isLatencyCritical = newIsLatencyCritical;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ContextMappingDSLPackage.USER_REQUIREMENT__IS_LATENCY_CRITICAL, oldIsLatencyCritical, isLatencyCritical));
}
/**
*
*
* @generated
*/
public EList getNanoentitiesRead()
{
if (nanoentitiesRead == null)
{
nanoentitiesRead = new EDataTypeEList(String.class, this, ContextMappingDSLPackage.USER_REQUIREMENT__NANOENTITIES_READ);
}
return nanoentitiesRead;
}
/**
*
*
* @generated
*/
public EList getNanoentitiesWritten()
{
if (nanoentitiesWritten == null)
{
nanoentitiesWritten = new EDataTypeEList(String.class, this, ContextMappingDSLPackage.USER_REQUIREMENT__NANOENTITIES_WRITTEN);
}
return nanoentitiesWritten;
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case ContextMappingDSLPackage.USER_REQUIREMENT__FEATURES:
return ((InternalEList>)getFeatures()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case ContextMappingDSLPackage.USER_REQUIREMENT__NAME:
return getName();
case ContextMappingDSLPackage.USER_REQUIREMENT__ROLE:
return getRole();
case ContextMappingDSLPackage.USER_REQUIREMENT__FEATURES:
return getFeatures();
case ContextMappingDSLPackage.USER_REQUIREMENT__BENEFIT:
return getBenefit();
case ContextMappingDSLPackage.USER_REQUIREMENT__IS_LATENCY_CRITICAL:
return isIsLatencyCritical();
case ContextMappingDSLPackage.USER_REQUIREMENT__NANOENTITIES_READ:
return getNanoentitiesRead();
case ContextMappingDSLPackage.USER_REQUIREMENT__NANOENTITIES_WRITTEN:
return getNanoentitiesWritten();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case ContextMappingDSLPackage.USER_REQUIREMENT__NAME:
setName((String)newValue);
return;
case ContextMappingDSLPackage.USER_REQUIREMENT__ROLE:
setRole((String)newValue);
return;
case ContextMappingDSLPackage.USER_REQUIREMENT__FEATURES:
getFeatures().clear();
getFeatures().addAll((Collection extends Feature>)newValue);
return;
case ContextMappingDSLPackage.USER_REQUIREMENT__BENEFIT:
setBenefit((String)newValue);
return;
case ContextMappingDSLPackage.USER_REQUIREMENT__IS_LATENCY_CRITICAL:
setIsLatencyCritical((Boolean)newValue);
return;
case ContextMappingDSLPackage.USER_REQUIREMENT__NANOENTITIES_READ:
getNanoentitiesRead().clear();
getNanoentitiesRead().addAll((Collection extends String>)newValue);
return;
case ContextMappingDSLPackage.USER_REQUIREMENT__NANOENTITIES_WRITTEN:
getNanoentitiesWritten().clear();
getNanoentitiesWritten().addAll((Collection extends String>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case ContextMappingDSLPackage.USER_REQUIREMENT__NAME:
setName(NAME_EDEFAULT);
return;
case ContextMappingDSLPackage.USER_REQUIREMENT__ROLE:
setRole(ROLE_EDEFAULT);
return;
case ContextMappingDSLPackage.USER_REQUIREMENT__FEATURES:
getFeatures().clear();
return;
case ContextMappingDSLPackage.USER_REQUIREMENT__BENEFIT:
setBenefit(BENEFIT_EDEFAULT);
return;
case ContextMappingDSLPackage.USER_REQUIREMENT__IS_LATENCY_CRITICAL:
setIsLatencyCritical(IS_LATENCY_CRITICAL_EDEFAULT);
return;
case ContextMappingDSLPackage.USER_REQUIREMENT__NANOENTITIES_READ:
getNanoentitiesRead().clear();
return;
case ContextMappingDSLPackage.USER_REQUIREMENT__NANOENTITIES_WRITTEN:
getNanoentitiesWritten().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case ContextMappingDSLPackage.USER_REQUIREMENT__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case ContextMappingDSLPackage.USER_REQUIREMENT__ROLE:
return ROLE_EDEFAULT == null ? role != null : !ROLE_EDEFAULT.equals(role);
case ContextMappingDSLPackage.USER_REQUIREMENT__FEATURES:
return features != null && !features.isEmpty();
case ContextMappingDSLPackage.USER_REQUIREMENT__BENEFIT:
return BENEFIT_EDEFAULT == null ? benefit != null : !BENEFIT_EDEFAULT.equals(benefit);
case ContextMappingDSLPackage.USER_REQUIREMENT__IS_LATENCY_CRITICAL:
return isLatencyCritical != IS_LATENCY_CRITICAL_EDEFAULT;
case ContextMappingDSLPackage.USER_REQUIREMENT__NANOENTITIES_READ:
return nanoentitiesRead != null && !nanoentitiesRead.isEmpty();
case ContextMappingDSLPackage.USER_REQUIREMENT__NANOENTITIES_WRITTEN:
return nanoentitiesWritten != null && !nanoentitiesWritten.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(", role: ");
result.append(role);
result.append(", benefit: ");
result.append(benefit);
result.append(", isLatencyCritical: ");
result.append(isLatencyCritical);
result.append(", nanoentitiesRead: ");
result.append(nanoentitiesRead);
result.append(", nanoentitiesWritten: ");
result.append(nanoentitiesWritten);
result.append(')');
return result.toString();
}
} //UserRequirementImpl