/**
*/
package de.ugoe.cs.swe.bnftools.ebnf.impl;
import de.ugoe.cs.swe.bnftools.ebnf.BnfEntry;
import de.ugoe.cs.swe.bnftools.ebnf.EbnfPackage;
import de.ugoe.cs.swe.bnftools.ebnf.Rule;
import de.ugoe.cs.swe.bnftools.ebnf.SectionHeading;
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 'Bnf Entry'.
*
*
* The following features are implemented:
*
* - {@link de.ugoe.cs.swe.bnftools.ebnf.impl.BnfEntryImpl#getSectionheader Sectionheader}
* - {@link de.ugoe.cs.swe.bnftools.ebnf.impl.BnfEntryImpl#getRule Rule}
*
*
*
* @generated
*/
public class BnfEntryImpl extends MinimalEObjectImpl.Container implements BnfEntry
{
/**
* The cached value of the '{@link #getSectionheader() Sectionheader}' containment reference.
*
*
* @see #getSectionheader()
* @generated
* @ordered
*/
protected SectionHeading sectionheader;
/**
* The cached value of the '{@link #getRule() Rule}' containment reference.
*
*
* @see #getRule()
* @generated
* @ordered
*/
protected Rule rule;
/**
*
*
* @generated
*/
protected BnfEntryImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return EbnfPackage.Literals.BNF_ENTRY;
}
/**
*
*
* @generated
*/
public SectionHeading getSectionheader()
{
return sectionheader;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetSectionheader(SectionHeading newSectionheader, NotificationChain msgs)
{
SectionHeading oldSectionheader = sectionheader;
sectionheader = newSectionheader;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EbnfPackage.BNF_ENTRY__SECTIONHEADER, oldSectionheader, newSectionheader);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setSectionheader(SectionHeading newSectionheader)
{
if (newSectionheader != sectionheader)
{
NotificationChain msgs = null;
if (sectionheader != null)
msgs = ((InternalEObject)sectionheader).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EbnfPackage.BNF_ENTRY__SECTIONHEADER, null, msgs);
if (newSectionheader != null)
msgs = ((InternalEObject)newSectionheader).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EbnfPackage.BNF_ENTRY__SECTIONHEADER, null, msgs);
msgs = basicSetSectionheader(newSectionheader, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.BNF_ENTRY__SECTIONHEADER, newSectionheader, newSectionheader));
}
/**
*
*
* @generated
*/
public Rule getRule()
{
return rule;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetRule(Rule newRule, NotificationChain msgs)
{
Rule oldRule = rule;
rule = newRule;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EbnfPackage.BNF_ENTRY__RULE, oldRule, newRule);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setRule(Rule newRule)
{
if (newRule != rule)
{
NotificationChain msgs = null;
if (rule != null)
msgs = ((InternalEObject)rule).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EbnfPackage.BNF_ENTRY__RULE, null, msgs);
if (newRule != null)
msgs = ((InternalEObject)newRule).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EbnfPackage.BNF_ENTRY__RULE, null, msgs);
msgs = basicSetRule(newRule, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.BNF_ENTRY__RULE, newRule, newRule));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case EbnfPackage.BNF_ENTRY__SECTIONHEADER:
return basicSetSectionheader(null, msgs);
case EbnfPackage.BNF_ENTRY__RULE:
return basicSetRule(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case EbnfPackage.BNF_ENTRY__SECTIONHEADER:
return getSectionheader();
case EbnfPackage.BNF_ENTRY__RULE:
return getRule();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case EbnfPackage.BNF_ENTRY__SECTIONHEADER:
setSectionheader((SectionHeading)newValue);
return;
case EbnfPackage.BNF_ENTRY__RULE:
setRule((Rule)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case EbnfPackage.BNF_ENTRY__SECTIONHEADER:
setSectionheader((SectionHeading)null);
return;
case EbnfPackage.BNF_ENTRY__RULE:
setRule((Rule)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case EbnfPackage.BNF_ENTRY__SECTIONHEADER:
return sectionheader != null;
case EbnfPackage.BNF_ENTRY__RULE:
return rule != null;
}
return super.eIsSet(featureID);
}
} //BnfEntryImpl