/**
*/
package de.ugoe.cs.swe.bnftools.ebnf.impl;
import de.ugoe.cs.swe.bnftools.ebnf.DefinitionList;
import de.ugoe.cs.swe.bnftools.ebnf.EbnfPackage;
import de.ugoe.cs.swe.bnftools.ebnf.Rule;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
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;
/**
*
* An implementation of the model object 'Rule'.
*
*
* The following features are implemented:
*
* - {@link de.ugoe.cs.swe.bnftools.ebnf.impl.RuleImpl#getRulenumber Rulenumber}
* - {@link de.ugoe.cs.swe.bnftools.ebnf.impl.RuleImpl#getRulevariant Rulevariant}
* - {@link de.ugoe.cs.swe.bnftools.ebnf.impl.RuleImpl#getName Name}
* - {@link de.ugoe.cs.swe.bnftools.ebnf.impl.RuleImpl#getDefinitionList Definition List}
*
*
*
* @generated
*/
public class RuleImpl extends MinimalEObjectImpl.Container implements Rule
{
/**
* The default value of the '{@link #getRulenumber() Rulenumber}' attribute.
*
*
* @see #getRulenumber()
* @generated
* @ordered
*/
protected static final int RULENUMBER_EDEFAULT = 0;
/**
* The cached value of the '{@link #getRulenumber() Rulenumber}' attribute.
*
*
* @see #getRulenumber()
* @generated
* @ordered
*/
protected int rulenumber = RULENUMBER_EDEFAULT;
/**
* The default value of the '{@link #getRulevariant() Rulevariant}' attribute.
*
*
* @see #getRulevariant()
* @generated
* @ordered
*/
protected static final String RULEVARIANT_EDEFAULT = null;
/**
* The cached value of the '{@link #getRulevariant() Rulevariant}' attribute.
*
*
* @see #getRulevariant()
* @generated
* @ordered
*/
protected String rulevariant = RULEVARIANT_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 #getDefinitionList() Definition List}' containment reference.
*
*
* @see #getDefinitionList()
* @generated
* @ordered
*/
protected DefinitionList definitionList;
/**
*
*
* @generated
*/
protected RuleImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return EbnfPackage.Literals.RULE;
}
/**
*
*
* @generated
*/
public int getRulenumber()
{
return rulenumber;
}
/**
*
*
* @generated
*/
public void setRulenumber(int newRulenumber)
{
int oldRulenumber = rulenumber;
rulenumber = newRulenumber;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.RULE__RULENUMBER, oldRulenumber, rulenumber));
}
/**
*
*
* @generated
*/
public String getRulevariant()
{
return rulevariant;
}
/**
*
*
* @generated
*/
public void setRulevariant(String newRulevariant)
{
String oldRulevariant = rulevariant;
rulevariant = newRulevariant;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.RULE__RULEVARIANT, oldRulevariant, rulevariant));
}
/**
*
*
* @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, EbnfPackage.RULE__NAME, oldName, name));
}
/**
*
*
* @generated
*/
public DefinitionList getDefinitionList()
{
return definitionList;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetDefinitionList(DefinitionList newDefinitionList, NotificationChain msgs)
{
DefinitionList oldDefinitionList = definitionList;
definitionList = newDefinitionList;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EbnfPackage.RULE__DEFINITION_LIST, oldDefinitionList, newDefinitionList);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setDefinitionList(DefinitionList newDefinitionList)
{
if (newDefinitionList != definitionList)
{
NotificationChain msgs = null;
if (definitionList != null)
msgs = ((InternalEObject)definitionList).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EbnfPackage.RULE__DEFINITION_LIST, null, msgs);
if (newDefinitionList != null)
msgs = ((InternalEObject)newDefinitionList).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EbnfPackage.RULE__DEFINITION_LIST, null, msgs);
msgs = basicSetDefinitionList(newDefinitionList, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.RULE__DEFINITION_LIST, newDefinitionList, newDefinitionList));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case EbnfPackage.RULE__DEFINITION_LIST:
return basicSetDefinitionList(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case EbnfPackage.RULE__RULENUMBER:
return getRulenumber();
case EbnfPackage.RULE__RULEVARIANT:
return getRulevariant();
case EbnfPackage.RULE__NAME:
return getName();
case EbnfPackage.RULE__DEFINITION_LIST:
return getDefinitionList();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case EbnfPackage.RULE__RULENUMBER:
setRulenumber((Integer)newValue);
return;
case EbnfPackage.RULE__RULEVARIANT:
setRulevariant((String)newValue);
return;
case EbnfPackage.RULE__NAME:
setName((String)newValue);
return;
case EbnfPackage.RULE__DEFINITION_LIST:
setDefinitionList((DefinitionList)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case EbnfPackage.RULE__RULENUMBER:
setRulenumber(RULENUMBER_EDEFAULT);
return;
case EbnfPackage.RULE__RULEVARIANT:
setRulevariant(RULEVARIANT_EDEFAULT);
return;
case EbnfPackage.RULE__NAME:
setName(NAME_EDEFAULT);
return;
case EbnfPackage.RULE__DEFINITION_LIST:
setDefinitionList((DefinitionList)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case EbnfPackage.RULE__RULENUMBER:
return rulenumber != RULENUMBER_EDEFAULT;
case EbnfPackage.RULE__RULEVARIANT:
return RULEVARIANT_EDEFAULT == null ? rulevariant != null : !RULEVARIANT_EDEFAULT.equals(rulevariant);
case EbnfPackage.RULE__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case EbnfPackage.RULE__DEFINITION_LIST:
return definitionList != null;
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (rulenumber: ");
result.append(rulenumber);
result.append(", rulevariant: ");
result.append(rulevariant);
result.append(", name: ");
result.append(name);
result.append(')');
return result.toString();
}
} //RuleImpl