mirror of https://github.com/Minres/RDL-Editor.git
298 lines
6.9 KiB
Java
298 lines
6.9 KiB
Java
/**
|
|
* generated by Xtext 2.14.0
|
|
*/
|
|
package com.minres.rdl.rdl.impl;
|
|
|
|
import com.minres.rdl.rdl.EnumEntry;
|
|
import com.minres.rdl.rdl.EnumProperty;
|
|
import com.minres.rdl.rdl.RdlPackage;
|
|
|
|
import java.util.Collection;
|
|
|
|
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;
|
|
|
|
/**
|
|
* <!-- begin-user-doc -->
|
|
* An implementation of the model object '<em><b>Enum Entry</b></em>'.
|
|
* <!-- end-user-doc -->
|
|
* <p>
|
|
* The following features are implemented:
|
|
* </p>
|
|
* <ul>
|
|
* <li>{@link com.minres.rdl.rdl.impl.EnumEntryImpl#getName <em>Name</em>}</li>
|
|
* <li>{@link com.minres.rdl.rdl.impl.EnumEntryImpl#getIndex <em>Index</em>}</li>
|
|
* <li>{@link com.minres.rdl.rdl.impl.EnumEntryImpl#getProperties <em>Properties</em>}</li>
|
|
* </ul>
|
|
*
|
|
* @generated
|
|
*/
|
|
public class EnumEntryImpl extends MinimalEObjectImpl.Container implements EnumEntry
|
|
{
|
|
/**
|
|
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @see #getName()
|
|
* @generated
|
|
* @ordered
|
|
*/
|
|
protected static final String NAME_EDEFAULT = null;
|
|
|
|
/**
|
|
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @see #getName()
|
|
* @generated
|
|
* @ordered
|
|
*/
|
|
protected String name = NAME_EDEFAULT;
|
|
|
|
/**
|
|
* The default value of the '{@link #getIndex() <em>Index</em>}' attribute.
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @see #getIndex()
|
|
* @generated
|
|
* @ordered
|
|
*/
|
|
protected static final Object INDEX_EDEFAULT = null;
|
|
|
|
/**
|
|
* The cached value of the '{@link #getIndex() <em>Index</em>}' attribute.
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @see #getIndex()
|
|
* @generated
|
|
* @ordered
|
|
*/
|
|
protected Object index = INDEX_EDEFAULT;
|
|
|
|
/**
|
|
* The cached value of the '{@link #getProperties() <em>Properties</em>}' containment reference list.
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @see #getProperties()
|
|
* @generated
|
|
* @ordered
|
|
*/
|
|
protected EList<EnumProperty> properties;
|
|
|
|
/**
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @generated
|
|
*/
|
|
protected EnumEntryImpl()
|
|
{
|
|
super();
|
|
}
|
|
|
|
/**
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @generated
|
|
*/
|
|
@Override
|
|
protected EClass eStaticClass()
|
|
{
|
|
return RdlPackage.Literals.ENUM_ENTRY;
|
|
}
|
|
|
|
/**
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @generated
|
|
*/
|
|
public String getName()
|
|
{
|
|
return name;
|
|
}
|
|
|
|
/**
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @generated
|
|
*/
|
|
public void setName(String newName)
|
|
{
|
|
String oldName = name;
|
|
name = newName;
|
|
if (eNotificationRequired())
|
|
eNotify(new ENotificationImpl(this, Notification.SET, RdlPackage.ENUM_ENTRY__NAME, oldName, name));
|
|
}
|
|
|
|
/**
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @generated
|
|
*/
|
|
public Object getIndex()
|
|
{
|
|
return index;
|
|
}
|
|
|
|
/**
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @generated
|
|
*/
|
|
public void setIndex(Object newIndex)
|
|
{
|
|
Object oldIndex = index;
|
|
index = newIndex;
|
|
if (eNotificationRequired())
|
|
eNotify(new ENotificationImpl(this, Notification.SET, RdlPackage.ENUM_ENTRY__INDEX, oldIndex, index));
|
|
}
|
|
|
|
/**
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @generated
|
|
*/
|
|
public EList<EnumProperty> getProperties()
|
|
{
|
|
if (properties == null)
|
|
{
|
|
properties = new EObjectContainmentEList<EnumProperty>(EnumProperty.class, this, RdlPackage.ENUM_ENTRY__PROPERTIES);
|
|
}
|
|
return properties;
|
|
}
|
|
|
|
/**
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @generated
|
|
*/
|
|
@Override
|
|
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
|
|
{
|
|
switch (featureID)
|
|
{
|
|
case RdlPackage.ENUM_ENTRY__PROPERTIES:
|
|
return ((InternalEList<?>)getProperties()).basicRemove(otherEnd, msgs);
|
|
}
|
|
return super.eInverseRemove(otherEnd, featureID, msgs);
|
|
}
|
|
|
|
/**
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @generated
|
|
*/
|
|
@Override
|
|
public Object eGet(int featureID, boolean resolve, boolean coreType)
|
|
{
|
|
switch (featureID)
|
|
{
|
|
case RdlPackage.ENUM_ENTRY__NAME:
|
|
return getName();
|
|
case RdlPackage.ENUM_ENTRY__INDEX:
|
|
return getIndex();
|
|
case RdlPackage.ENUM_ENTRY__PROPERTIES:
|
|
return getProperties();
|
|
}
|
|
return super.eGet(featureID, resolve, coreType);
|
|
}
|
|
|
|
/**
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @generated
|
|
*/
|
|
@SuppressWarnings("unchecked")
|
|
@Override
|
|
public void eSet(int featureID, Object newValue)
|
|
{
|
|
switch (featureID)
|
|
{
|
|
case RdlPackage.ENUM_ENTRY__NAME:
|
|
setName((String)newValue);
|
|
return;
|
|
case RdlPackage.ENUM_ENTRY__INDEX:
|
|
setIndex(newValue);
|
|
return;
|
|
case RdlPackage.ENUM_ENTRY__PROPERTIES:
|
|
getProperties().clear();
|
|
getProperties().addAll((Collection<? extends EnumProperty>)newValue);
|
|
return;
|
|
}
|
|
super.eSet(featureID, newValue);
|
|
}
|
|
|
|
/**
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @generated
|
|
*/
|
|
@Override
|
|
public void eUnset(int featureID)
|
|
{
|
|
switch (featureID)
|
|
{
|
|
case RdlPackage.ENUM_ENTRY__NAME:
|
|
setName(NAME_EDEFAULT);
|
|
return;
|
|
case RdlPackage.ENUM_ENTRY__INDEX:
|
|
setIndex(INDEX_EDEFAULT);
|
|
return;
|
|
case RdlPackage.ENUM_ENTRY__PROPERTIES:
|
|
getProperties().clear();
|
|
return;
|
|
}
|
|
super.eUnset(featureID);
|
|
}
|
|
|
|
/**
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @generated
|
|
*/
|
|
@Override
|
|
public boolean eIsSet(int featureID)
|
|
{
|
|
switch (featureID)
|
|
{
|
|
case RdlPackage.ENUM_ENTRY__NAME:
|
|
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
|
|
case RdlPackage.ENUM_ENTRY__INDEX:
|
|
return INDEX_EDEFAULT == null ? index != null : !INDEX_EDEFAULT.equals(index);
|
|
case RdlPackage.ENUM_ENTRY__PROPERTIES:
|
|
return properties != null && !properties.isEmpty();
|
|
}
|
|
return super.eIsSet(featureID);
|
|
}
|
|
|
|
/**
|
|
* <!-- begin-user-doc -->
|
|
* <!-- end-user-doc -->
|
|
* @generated
|
|
*/
|
|
@Override
|
|
public String toString()
|
|
{
|
|
if (eIsProxy()) return super.toString();
|
|
|
|
StringBuffer result = new StringBuffer(super.toString());
|
|
result.append(" (name: ");
|
|
result.append(name);
|
|
result.append(", index: ");
|
|
result.append(index);
|
|
result.append(')');
|
|
return result.toString();
|
|
}
|
|
|
|
} //EnumEntryImpl
|