org.contextmapper.tactic.dsl.tacticdsl.impl.EnumImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of context-mapper-dsl Show documentation
Show all versions of context-mapper-dsl Show documentation
Use the ContextMapper DSL in your standalone application.
/**
* generated by Xtext 2.21.0
*/
package org.contextmapper.tactic.dsl.tacticdsl.impl;
import java.util.Collection;
import org.contextmapper.tactic.dsl.tacticdsl.EnumAttribute;
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.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
*
* An implementation of the model object 'Enum'.
*
*
* The following features are implemented:
*
*
* - {@link org.contextmapper.tactic.dsl.tacticdsl.impl.EnumImpl#isOrdinal Ordinal}
* - {@link org.contextmapper.tactic.dsl.tacticdsl.impl.EnumImpl#getAttributes Attributes}
* - {@link org.contextmapper.tactic.dsl.tacticdsl.impl.EnumImpl#getValues Values}
*
*
* @generated
*/
public class EnumImpl extends SimpleDomainObjectImpl implements org.contextmapper.tactic.dsl.tacticdsl.Enum
{
/**
* The default value of the '{@link #isOrdinal() Ordinal}' attribute.
*
*
* @see #isOrdinal()
* @generated
* @ordered
*/
protected static final boolean ORDINAL_EDEFAULT = false;
/**
* The cached value of the '{@link #isOrdinal() Ordinal}' attribute.
*
*
* @see #isOrdinal()
* @generated
* @ordered
*/
protected boolean ordinal = ORDINAL_EDEFAULT;
/**
* The cached value of the '{@link #getAttributes() Attributes}' containment reference list.
*
*
* @see #getAttributes()
* @generated
* @ordered
*/
protected EList attributes;
/**
* The cached value of the '{@link #getValues() Values}' containment reference list.
*
*
* @see #getValues()
* @generated
* @ordered
*/
protected EList values;
/**
*
*
* @generated
*/
protected EnumImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return TacticdslPackage.Literals.ENUM;
}
/**
*
*
* @generated
*/
@Override
public boolean isOrdinal()
{
return ordinal;
}
/**
*
*
* @generated
*/
@Override
public void setOrdinal(boolean newOrdinal)
{
boolean oldOrdinal = ordinal;
ordinal = newOrdinal;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TacticdslPackage.ENUM__ORDINAL, oldOrdinal, ordinal));
}
/**
*
*
* @generated
*/
@Override
public EList getAttributes()
{
if (attributes == null)
{
attributes = new EObjectContainmentEList(EnumAttribute.class, this, TacticdslPackage.ENUM__ATTRIBUTES);
}
return attributes;
}
/**
*
*
* @generated
*/
@Override
public EList getValues()
{
if (values == null)
{
values = new EObjectContainmentEList(EnumValue.class, this, TacticdslPackage.ENUM__VALUES);
}
return values;
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case TacticdslPackage.ENUM__ATTRIBUTES:
return ((InternalEList>)getAttributes()).basicRemove(otherEnd, msgs);
case TacticdslPackage.ENUM__VALUES:
return ((InternalEList>)getValues()).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__ORDINAL:
return isOrdinal();
case TacticdslPackage.ENUM__ATTRIBUTES:
return getAttributes();
case TacticdslPackage.ENUM__VALUES:
return getValues();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case TacticdslPackage.ENUM__ORDINAL:
setOrdinal((Boolean)newValue);
return;
case TacticdslPackage.ENUM__ATTRIBUTES:
getAttributes().clear();
getAttributes().addAll((Collection extends EnumAttribute>)newValue);
return;
case TacticdslPackage.ENUM__VALUES:
getValues().clear();
getValues().addAll((Collection extends EnumValue>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case TacticdslPackage.ENUM__ORDINAL:
setOrdinal(ORDINAL_EDEFAULT);
return;
case TacticdslPackage.ENUM__ATTRIBUTES:
getAttributes().clear();
return;
case TacticdslPackage.ENUM__VALUES:
getValues().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case TacticdslPackage.ENUM__ORDINAL:
return ordinal != ORDINAL_EDEFAULT;
case TacticdslPackage.ENUM__ATTRIBUTES:
return attributes != null && !attributes.isEmpty();
case TacticdslPackage.ENUM__VALUES:
return values != null && !values.isEmpty();
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (ordinal: ");
result.append(ordinal);
result.append(')');
return result.toString();
}
} //EnumImpl