blob: 92b3480d32becc132346c952b502738b6ff3b6b8 [file] [log] [blame]
/**
* <copyright>
* </copyright>
*
* $Id: ConditionalImpl.java,v 1.2 2011/03/05 21:52:04 auhl Exp $
*/
package dataaccess.expressions.impl;
import dataaccess.expressions.Conditional;
import dataaccess.expressions.Expression;
import dataaccess.expressions.ExpressionsPackage;
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.EObjectImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Conditional</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link dataaccess.expressions.impl.ConditionalImpl#getCondition <em>Condition</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public abstract class ConditionalImpl extends EObjectImpl implements Conditional {
/**
* The cached value of the '{@link #getCondition() <em>Condition</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCondition()
* @generated
* @ordered
*/
protected Expression condition;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ConditionalImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ExpressionsPackage.Literals.CONDITIONAL;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression getCondition() {
if (condition != null && condition.eIsProxy()) {
InternalEObject oldCondition = (InternalEObject)condition;
condition = (Expression)eResolveProxy(oldCondition);
if (condition != oldCondition) {
InternalEObject newCondition = (InternalEObject)condition;
NotificationChain msgs = oldCondition.eInverseRemove(this, ExpressionsPackage.EXPRESSION__CONDITIONAL, Expression.class, null);
if (newCondition.eInternalContainer() == null) {
msgs = newCondition.eInverseAdd(this, ExpressionsPackage.EXPRESSION__CONDITIONAL, Expression.class, msgs);
}
if (msgs != null) msgs.dispatch();
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ExpressionsPackage.CONDITIONAL__CONDITION, oldCondition, condition));
}
}
return condition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression basicGetCondition() {
return condition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetCondition(Expression newCondition, NotificationChain msgs) {
Expression oldCondition = condition;
condition = newCondition;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ExpressionsPackage.CONDITIONAL__CONDITION, oldCondition, newCondition);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCondition(Expression newCondition) {
if (newCondition != condition) {
NotificationChain msgs = null;
if (condition != null)
msgs = ((InternalEObject)condition).eInverseRemove(this, ExpressionsPackage.EXPRESSION__CONDITIONAL, Expression.class, msgs);
if (newCondition != null)
msgs = ((InternalEObject)newCondition).eInverseAdd(this, ExpressionsPackage.EXPRESSION__CONDITIONAL, Expression.class, msgs);
msgs = basicSetCondition(newCondition, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ExpressionsPackage.CONDITIONAL__CONDITION, newCondition, newCondition));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ExpressionsPackage.CONDITIONAL__CONDITION:
if (condition != null)
msgs = ((InternalEObject)condition).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ExpressionsPackage.CONDITIONAL__CONDITION, null, msgs);
return basicSetCondition((Expression)otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ExpressionsPackage.CONDITIONAL__CONDITION:
return basicSetCondition(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ExpressionsPackage.CONDITIONAL__CONDITION:
if (resolve) return getCondition();
return basicGetCondition();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ExpressionsPackage.CONDITIONAL__CONDITION:
setCondition((Expression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ExpressionsPackage.CONDITIONAL__CONDITION:
setCondition((Expression)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ExpressionsPackage.CONDITIONAL__CONDITION:
return condition != null;
}
return super.eIsSet(featureID);
}
} //ConditionalImpl