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