/**
* generated by Xtext 2.16.0
*/
package hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.impl;
import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.ApplicationConfigurationPackage;
import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.CostEntry;
import hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.PatternElement;
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 'Cost Entry'.
*
*
* The following features are implemented:
*
*
* - {@link hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.impl.CostEntryImpl#getPatternElement Pattern Element}
* - {@link hu.bme.mit.inf.dslreasoner.application.applicationConfiguration.impl.CostEntryImpl#getWeight Weight}
*
*
* @generated
*/
public class CostEntryImpl extends MinimalEObjectImpl.Container implements CostEntry
{
/**
* The cached value of the '{@link #getPatternElement() Pattern Element}' containment reference.
*
*
* @see #getPatternElement()
* @generated
* @ordered
*/
protected PatternElement patternElement;
/**
* The default value of the '{@link #getWeight() Weight}' attribute.
*
*
* @see #getWeight()
* @generated
* @ordered
*/
protected static final int WEIGHT_EDEFAULT = 0;
/**
* The cached value of the '{@link #getWeight() Weight}' attribute.
*
*
* @see #getWeight()
* @generated
* @ordered
*/
protected int weight = WEIGHT_EDEFAULT;
/**
*
*
* @generated
*/
protected CostEntryImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return ApplicationConfigurationPackage.Literals.COST_ENTRY;
}
/**
*
*
* @generated
*/
@Override
public PatternElement getPatternElement()
{
return patternElement;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetPatternElement(PatternElement newPatternElement, NotificationChain msgs)
{
PatternElement oldPatternElement = patternElement;
patternElement = newPatternElement;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ApplicationConfigurationPackage.COST_ENTRY__PATTERN_ELEMENT, oldPatternElement, newPatternElement);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setPatternElement(PatternElement newPatternElement)
{
if (newPatternElement != patternElement)
{
NotificationChain msgs = null;
if (patternElement != null)
msgs = ((InternalEObject)patternElement).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ApplicationConfigurationPackage.COST_ENTRY__PATTERN_ELEMENT, null, msgs);
if (newPatternElement != null)
msgs = ((InternalEObject)newPatternElement).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ApplicationConfigurationPackage.COST_ENTRY__PATTERN_ELEMENT, null, msgs);
msgs = basicSetPatternElement(newPatternElement, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ApplicationConfigurationPackage.COST_ENTRY__PATTERN_ELEMENT, newPatternElement, newPatternElement));
}
/**
*
*
* @generated
*/
@Override
public int getWeight()
{
return weight;
}
/**
*
*
* @generated
*/
@Override
public void setWeight(int newWeight)
{
int oldWeight = weight;
weight = newWeight;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ApplicationConfigurationPackage.COST_ENTRY__WEIGHT, oldWeight, weight));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case ApplicationConfigurationPackage.COST_ENTRY__PATTERN_ELEMENT:
return basicSetPatternElement(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case ApplicationConfigurationPackage.COST_ENTRY__PATTERN_ELEMENT:
return getPatternElement();
case ApplicationConfigurationPackage.COST_ENTRY__WEIGHT:
return getWeight();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case ApplicationConfigurationPackage.COST_ENTRY__PATTERN_ELEMENT:
setPatternElement((PatternElement)newValue);
return;
case ApplicationConfigurationPackage.COST_ENTRY__WEIGHT:
setWeight((Integer)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case ApplicationConfigurationPackage.COST_ENTRY__PATTERN_ELEMENT:
setPatternElement((PatternElement)null);
return;
case ApplicationConfigurationPackage.COST_ENTRY__WEIGHT:
setWeight(WEIGHT_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case ApplicationConfigurationPackage.COST_ENTRY__PATTERN_ELEMENT:
return patternElement != null;
case ApplicationConfigurationPackage.COST_ENTRY__WEIGHT:
return weight != WEIGHT_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (weight: ");
result.append(weight);
result.append(')');
return result.toString();
}
} //CostEntryImpl