blob: efdbf5d4b2220226d8ea248f39643382ba8e52b0 [file] [log] [blame]
/**
* Copyright (c) 2020 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html\n\nContributors:
* Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr
* - Initial API and Implementation
*/
package org.eclipse.efm.ecore.formalml.statement.impl;
import org.eclipse.efm.ecore.formalml.expression.Expression;
import org.eclipse.efm.ecore.formalml.statement.ObserverStatement;
import org.eclipse.efm.ecore.formalml.statement.Statement;
import org.eclipse.efm.ecore.formalml.statement.StatementPackage;
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>Observer Statement</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.efm.ecore.formalml.statement.impl.ObserverStatementImpl#getContext <em>Context</em>}</li>
* <li>{@link org.eclipse.efm.ecore.formalml.statement.impl.ObserverStatementImpl#getStatement <em>Statement</em>}</li>
* <li>{@link org.eclipse.efm.ecore.formalml.statement.impl.ObserverStatementImpl#getPostCondition <em>Post Condition</em>}</li>
* </ul>
*
* @generated
*/
public class ObserverStatementImpl extends StatementImpl implements ObserverStatement {
/**
* The cached value of the '{@link #getContext() <em>Context</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getContext()
* @generated
* @ordered
*/
protected Expression context;
/**
* The cached value of the '{@link #getStatement() <em>Statement</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStatement()
* @generated
* @ordered
*/
protected Statement statement;
/**
* The cached value of the '{@link #getPostCondition() <em>Post Condition</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPostCondition()
* @generated
* @ordered
*/
protected Expression postCondition;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ObserverStatementImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return StatementPackage.Literals.OBSERVER_STATEMENT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Expression getContext() {
return context;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetContext(Expression newContext, NotificationChain msgs) {
Expression oldContext = context;
context = newContext;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StatementPackage.OBSERVER_STATEMENT__CONTEXT, oldContext, newContext);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setContext(Expression newContext) {
if (newContext != context) {
NotificationChain msgs = null;
if (context != null)
msgs = ((InternalEObject)context).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StatementPackage.OBSERVER_STATEMENT__CONTEXT, null, msgs);
if (newContext != null)
msgs = ((InternalEObject)newContext).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StatementPackage.OBSERVER_STATEMENT__CONTEXT, null, msgs);
msgs = basicSetContext(newContext, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StatementPackage.OBSERVER_STATEMENT__CONTEXT, newContext, newContext));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Statement getStatement() {
return statement;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetStatement(Statement newStatement, NotificationChain msgs) {
Statement oldStatement = statement;
statement = newStatement;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StatementPackage.OBSERVER_STATEMENT__STATEMENT, oldStatement, newStatement);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setStatement(Statement newStatement) {
if (newStatement != statement) {
NotificationChain msgs = null;
if (statement != null)
msgs = ((InternalEObject)statement).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StatementPackage.OBSERVER_STATEMENT__STATEMENT, null, msgs);
if (newStatement != null)
msgs = ((InternalEObject)newStatement).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StatementPackage.OBSERVER_STATEMENT__STATEMENT, null, msgs);
msgs = basicSetStatement(newStatement, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StatementPackage.OBSERVER_STATEMENT__STATEMENT, newStatement, newStatement));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Expression getPostCondition() {
return postCondition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetPostCondition(Expression newPostCondition, NotificationChain msgs) {
Expression oldPostCondition = postCondition;
postCondition = newPostCondition;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StatementPackage.OBSERVER_STATEMENT__POST_CONDITION, oldPostCondition, newPostCondition);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setPostCondition(Expression newPostCondition) {
if (newPostCondition != postCondition) {
NotificationChain msgs = null;
if (postCondition != null)
msgs = ((InternalEObject)postCondition).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StatementPackage.OBSERVER_STATEMENT__POST_CONDITION, null, msgs);
if (newPostCondition != null)
msgs = ((InternalEObject)newPostCondition).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StatementPackage.OBSERVER_STATEMENT__POST_CONDITION, null, msgs);
msgs = basicSetPostCondition(newPostCondition, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StatementPackage.OBSERVER_STATEMENT__POST_CONDITION, newPostCondition, newPostCondition));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case StatementPackage.OBSERVER_STATEMENT__CONTEXT:
return basicSetContext(null, msgs);
case StatementPackage.OBSERVER_STATEMENT__STATEMENT:
return basicSetStatement(null, msgs);
case StatementPackage.OBSERVER_STATEMENT__POST_CONDITION:
return basicSetPostCondition(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 StatementPackage.OBSERVER_STATEMENT__CONTEXT:
return getContext();
case StatementPackage.OBSERVER_STATEMENT__STATEMENT:
return getStatement();
case StatementPackage.OBSERVER_STATEMENT__POST_CONDITION:
return getPostCondition();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case StatementPackage.OBSERVER_STATEMENT__CONTEXT:
setContext((Expression)newValue);
return;
case StatementPackage.OBSERVER_STATEMENT__STATEMENT:
setStatement((Statement)newValue);
return;
case StatementPackage.OBSERVER_STATEMENT__POST_CONDITION:
setPostCondition((Expression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case StatementPackage.OBSERVER_STATEMENT__CONTEXT:
setContext((Expression)null);
return;
case StatementPackage.OBSERVER_STATEMENT__STATEMENT:
setStatement((Statement)null);
return;
case StatementPackage.OBSERVER_STATEMENT__POST_CONDITION:
setPostCondition((Expression)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case StatementPackage.OBSERVER_STATEMENT__CONTEXT:
return context != null;
case StatementPackage.OBSERVER_STATEMENT__STATEMENT:
return statement != null;
case StatementPackage.OBSERVER_STATEMENT__POST_CONDITION:
return postCondition != null;
}
return super.eIsSet(featureID);
}
} //ObserverStatementImpl