/**
* <copyright>
* </copyright>
*
* $Id$
*/
package net.sf.etl.samples.ej.ast.impl;
import net.sf.etl.samples.ej.ast.AssertStatement;
import net.sf.etl.samples.ej.ast.AstPackage;
import net.sf.etl.samples.ej.ast.Expression;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Assert Statement</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link net.sf.etl.samples.ej.ast.impl.AssertStatementImpl#getTest <em>Test</em>}</li>
* <li>{@link net.sf.etl.samples.ej.ast.impl.AssertStatementImpl#getMessage <em>Message</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class AssertStatementImpl extends MethodContentStatementImpl implements AssertStatement {
/**
* The cached value of the '{@link #getTest() <em>Test</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTest()
* @generated
* @ordered
*/
protected Expression test = null;
/**
* The cached value of the '{@link #getMessage() <em>Message</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMessage()
* @generated
* @ordered
*/
protected Expression message = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected AssertStatementImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return AstPackage.Literals.ASSERT_STATEMENT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression getTest() {
return test;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTest(Expression newTest, NotificationChain msgs) {
Expression oldTest = test;
test = newTest;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AstPackage.ASSERT_STATEMENT__TEST, oldTest, newTest);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTest(Expression newTest) {
if (newTest != test) {
NotificationChain msgs = null;
if (test != null)
msgs = ((InternalEObject)test).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AstPackage.ASSERT_STATEMENT__TEST, null, msgs);
if (newTest != null)
msgs = ((InternalEObject)newTest).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstPackage.ASSERT_STATEMENT__TEST, null, msgs);
msgs = basicSetTest(newTest, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AstPackage.ASSERT_STATEMENT__TEST, newTest, newTest));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Expression getMessage() {
return message;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetMessage(Expression newMessage, NotificationChain msgs) {
Expression oldMessage = message;
message = newMessage;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AstPackage.ASSERT_STATEMENT__MESSAGE, oldMessage, newMessage);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMessage(Expression newMessage) {
if (newMessage != message) {
NotificationChain msgs = null;
if (message != null)
msgs = ((InternalEObject)message).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AstPackage.ASSERT_STATEMENT__MESSAGE, null, msgs);
if (newMessage != null)
msgs = ((InternalEObject)newMessage).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstPackage.ASSERT_STATEMENT__MESSAGE, null, msgs);
msgs = basicSetMessage(newMessage, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AstPackage.ASSERT_STATEMENT__MESSAGE, newMessage, newMessage));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AstPackage.ASSERT_STATEMENT__TEST:
return basicSetTest(null, msgs);
case AstPackage.ASSERT_STATEMENT__MESSAGE:
return basicSetMessage(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case AstPackage.ASSERT_STATEMENT__TEST:
return getTest();
case AstPackage.ASSERT_STATEMENT__MESSAGE:
return getMessage();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case AstPackage.ASSERT_STATEMENT__TEST:
setTest((Expression)newValue);
return;
case AstPackage.ASSERT_STATEMENT__MESSAGE:
setMessage((Expression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID) {
switch (featureID) {
case AstPackage.ASSERT_STATEMENT__TEST:
setTest((Expression)null);
return;
case AstPackage.ASSERT_STATEMENT__MESSAGE:
setMessage((Expression)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
case AstPackage.ASSERT_STATEMENT__TEST:
return test != null;
case AstPackage.ASSERT_STATEMENT__MESSAGE:
return message != null;
}
return super.eIsSet(featureID);
}
} //AssertStatementImpl