/**
*/
package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.impl;
import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialTypeInterpratation;
import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage;
import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.Scope;
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 'Scope'.
*
*
* The following features are implemented:
*
*
* - {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.impl.ScopeImpl#getMinNewElements Min New Elements}
* - {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.impl.ScopeImpl#getMaxNewElements Max New Elements}
* - {@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.impl.ScopeImpl#getTargetTypeInterpretation Target Type Interpretation}
*
*
* @generated
*/
public class ScopeImpl extends MinimalEObjectImpl.Container implements Scope {
/**
* The default value of the '{@link #getMinNewElements() Min New Elements}' attribute.
*
*
* @see #getMinNewElements()
* @generated
* @ordered
*/
protected static final int MIN_NEW_ELEMENTS_EDEFAULT = 0;
/**
* The cached value of the '{@link #getMinNewElements() Min New Elements}' attribute.
*
*
* @see #getMinNewElements()
* @generated
* @ordered
*/
protected int minNewElements = MIN_NEW_ELEMENTS_EDEFAULT;
/**
* The default value of the '{@link #getMaxNewElements() Max New Elements}' attribute.
*
*
* @see #getMaxNewElements()
* @generated
* @ordered
*/
protected static final int MAX_NEW_ELEMENTS_EDEFAULT = -1;
/**
* The cached value of the '{@link #getMaxNewElements() Max New Elements}' attribute.
*
*
* @see #getMaxNewElements()
* @generated
* @ordered
*/
protected int maxNewElements = MAX_NEW_ELEMENTS_EDEFAULT;
/**
* The cached value of the '{@link #getTargetTypeInterpretation() Target Type Interpretation}' reference.
*
*
* @see #getTargetTypeInterpretation()
* @generated
* @ordered
*/
protected PartialTypeInterpratation targetTypeInterpretation;
/**
*
*
* @generated
*/
protected ScopeImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return PartialinterpretationPackage.Literals.SCOPE;
}
/**
*
*
* @generated
*/
public int getMinNewElements() {
return minNewElements;
}
/**
*
*
* @generated
*/
public void setMinNewElements(int newMinNewElements) {
int oldMinNewElements = minNewElements;
minNewElements = newMinNewElements;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PartialinterpretationPackage.SCOPE__MIN_NEW_ELEMENTS, oldMinNewElements, minNewElements));
}
/**
*
*
* @generated
*/
public int getMaxNewElements() {
return maxNewElements;
}
/**
*
*
* @generated
*/
public void setMaxNewElements(int newMaxNewElements) {
int oldMaxNewElements = maxNewElements;
maxNewElements = newMaxNewElements;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PartialinterpretationPackage.SCOPE__MAX_NEW_ELEMENTS, oldMaxNewElements, maxNewElements));
}
/**
*
*
* @generated
*/
public PartialTypeInterpratation getTargetTypeInterpretation() {
if (targetTypeInterpretation != null && targetTypeInterpretation.eIsProxy()) {
InternalEObject oldTargetTypeInterpretation = (InternalEObject)targetTypeInterpretation;
targetTypeInterpretation = (PartialTypeInterpratation)eResolveProxy(oldTargetTypeInterpretation);
if (targetTypeInterpretation != oldTargetTypeInterpretation) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, PartialinterpretationPackage.SCOPE__TARGET_TYPE_INTERPRETATION, oldTargetTypeInterpretation, targetTypeInterpretation));
}
}
return targetTypeInterpretation;
}
/**
*
*
* @generated
*/
public PartialTypeInterpratation basicGetTargetTypeInterpretation() {
return targetTypeInterpretation;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetTargetTypeInterpretation(PartialTypeInterpratation newTargetTypeInterpretation, NotificationChain msgs) {
PartialTypeInterpratation oldTargetTypeInterpretation = targetTypeInterpretation;
targetTypeInterpretation = newTargetTypeInterpretation;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, PartialinterpretationPackage.SCOPE__TARGET_TYPE_INTERPRETATION, oldTargetTypeInterpretation, newTargetTypeInterpretation);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setTargetTypeInterpretation(PartialTypeInterpratation newTargetTypeInterpretation) {
if (newTargetTypeInterpretation != targetTypeInterpretation) {
NotificationChain msgs = null;
if (targetTypeInterpretation != null)
msgs = ((InternalEObject)targetTypeInterpretation).eInverseRemove(this, PartialinterpretationPackage.PARTIAL_TYPE_INTERPRATATION__SCOPES, PartialTypeInterpratation.class, msgs);
if (newTargetTypeInterpretation != null)
msgs = ((InternalEObject)newTargetTypeInterpretation).eInverseAdd(this, PartialinterpretationPackage.PARTIAL_TYPE_INTERPRATATION__SCOPES, PartialTypeInterpratation.class, msgs);
msgs = basicSetTargetTypeInterpretation(newTargetTypeInterpretation, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PartialinterpretationPackage.SCOPE__TARGET_TYPE_INTERPRETATION, newTargetTypeInterpretation, newTargetTypeInterpretation));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case PartialinterpretationPackage.SCOPE__TARGET_TYPE_INTERPRETATION:
if (targetTypeInterpretation != null)
msgs = ((InternalEObject)targetTypeInterpretation).eInverseRemove(this, PartialinterpretationPackage.PARTIAL_TYPE_INTERPRATATION__SCOPES, PartialTypeInterpratation.class, msgs);
return basicSetTargetTypeInterpretation((PartialTypeInterpratation)otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case PartialinterpretationPackage.SCOPE__TARGET_TYPE_INTERPRETATION:
return basicSetTargetTypeInterpretation(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case PartialinterpretationPackage.SCOPE__MIN_NEW_ELEMENTS:
return getMinNewElements();
case PartialinterpretationPackage.SCOPE__MAX_NEW_ELEMENTS:
return getMaxNewElements();
case PartialinterpretationPackage.SCOPE__TARGET_TYPE_INTERPRETATION:
if (resolve) return getTargetTypeInterpretation();
return basicGetTargetTypeInterpretation();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case PartialinterpretationPackage.SCOPE__MIN_NEW_ELEMENTS:
setMinNewElements((Integer)newValue);
return;
case PartialinterpretationPackage.SCOPE__MAX_NEW_ELEMENTS:
setMaxNewElements((Integer)newValue);
return;
case PartialinterpretationPackage.SCOPE__TARGET_TYPE_INTERPRETATION:
setTargetTypeInterpretation((PartialTypeInterpratation)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case PartialinterpretationPackage.SCOPE__MIN_NEW_ELEMENTS:
setMinNewElements(MIN_NEW_ELEMENTS_EDEFAULT);
return;
case PartialinterpretationPackage.SCOPE__MAX_NEW_ELEMENTS:
setMaxNewElements(MAX_NEW_ELEMENTS_EDEFAULT);
return;
case PartialinterpretationPackage.SCOPE__TARGET_TYPE_INTERPRETATION:
setTargetTypeInterpretation((PartialTypeInterpratation)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case PartialinterpretationPackage.SCOPE__MIN_NEW_ELEMENTS:
return minNewElements != MIN_NEW_ELEMENTS_EDEFAULT;
case PartialinterpretationPackage.SCOPE__MAX_NEW_ELEMENTS:
return maxNewElements != MAX_NEW_ELEMENTS_EDEFAULT;
case PartialinterpretationPackage.SCOPE__TARGET_TYPE_INTERPRETATION:
return targetTypeInterpretation != null;
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (minNewElements: ");
result.append(minNewElements);
result.append(", maxNewElements: ");
result.append(maxNewElements);
result.append(')');
return result.toString();
}
} //ScopeImpl