org.contextmapper.tactic.dsl.tacticdsl.impl.EnumValueImpl Maven / Gradle / Ivy
/**
* generated by Xtext 2.21.0
*/
package org.contextmapper.tactic.dsl.tacticdsl.impl;
import java.util.Collection;
import org.contextmapper.tactic.dsl.tacticdsl.EnumParameter;
import org.contextmapper.tactic.dsl.tacticdsl.EnumValue;
import org.contextmapper.tactic.dsl.tacticdsl.TacticdslPackage;
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 'Enum Value'.
*
*
* The following features are implemented:
*
*
* - {@link org.contextmapper.tactic.dsl.tacticdsl.impl.EnumValueImpl#getDoc Doc}
* - {@link org.contextmapper.tactic.dsl.tacticdsl.impl.EnumValueImpl#getName Name}
* - {@link org.contextmapper.tactic.dsl.tacticdsl.impl.EnumValueImpl#getParameters Parameters}
*
*
* @generated
*/
public class EnumValueImpl extends MinimalEObjectImpl.Container implements EnumValue
{
/**
* The default value of the '{@link #getDoc() Doc}' attribute.
*
*
* @see #getDoc()
* @generated
* @ordered
*/
protected static final String DOC_EDEFAULT = null;
/**
* The cached value of the '{@link #getDoc() Doc}' attribute.
*
*
* @see #getDoc()
* @generated
* @ordered
*/
protected String doc = DOC_EDEFAULT;
/**
* 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 cached value of the '{@link #getParameters() Parameters}' containment reference list.
*
*
* @see #getParameters()
* @generated
* @ordered
*/
protected EList parameters;
/**
*
*
* @generated
*/
protected EnumValueImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return TacticdslPackage.Literals.ENUM_VALUE;
}
/**
*
*
* @generated
*/
@Override
public String getDoc()
{
return doc;
}
/**
*
*
* @generated
*/
@Override
public void setDoc(String newDoc)
{
String oldDoc = doc;
doc = newDoc;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TacticdslPackage.ENUM_VALUE__DOC, oldDoc, doc));
}
/**
*
*
* @generated
*/
@Override
public String getName()
{
return name;
}
/**
*
*
* @generated
*/
@Override
public void setName(String newName)
{
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TacticdslPackage.ENUM_VALUE__NAME, oldName, name));
}
/**
*
*
* @generated
*/
@Override
public EList getParameters()
{
if (parameters == null)
{
parameters = new EObjectContainmentEList(EnumParameter.class, this, TacticdslPackage.ENUM_VALUE__PARAMETERS);
}
return parameters;
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case TacticdslPackage.ENUM_VALUE__PARAMETERS:
return ((InternalEList>)getParameters()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case TacticdslPackage.ENUM_VALUE__DOC:
return getDoc();
case TacticdslPackage.ENUM_VALUE__NAME:
return getName();
case TacticdslPackage.ENUM_VALUE__PARAMETERS:
return getParameters();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case TacticdslPackage.ENUM_VALUE__DOC:
setDoc((String)newValue);
return;
case TacticdslPackage.ENUM_VALUE__NAME:
setName((String)newValue);
return;
case TacticdslPackage.ENUM_VALUE__PARAMETERS:
getParameters().clear();
getParameters().addAll((Collection extends EnumParameter>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case TacticdslPackage.ENUM_VALUE__DOC:
setDoc(DOC_EDEFAULT);
return;
case TacticdslPackage.ENUM_VALUE__NAME:
setName(NAME_EDEFAULT);
return;
case TacticdslPackage.ENUM_VALUE__PARAMETERS:
getParameters().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case TacticdslPackage.ENUM_VALUE__DOC:
return DOC_EDEFAULT == null ? doc != null : !DOC_EDEFAULT.equals(doc);
case TacticdslPackage.ENUM_VALUE__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case TacticdslPackage.ENUM_VALUE__PARAMETERS:
return parameters != null && !parameters.isEmpty();
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (doc: ");
result.append(doc);
result.append(", name: ");
result.append(name);
result.append(')');
return result.toString();
}
} //EnumValueImpl