blob: 90e7d40f7944954c85a11c84339d255713c38b41 [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.ForStatement;
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>For Statement</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.efm.ecore.formalml.statement.impl.ForStatementImpl#getInit <em>Init</em>}</li>
* <li>{@link org.eclipse.efm.ecore.formalml.statement.impl.ForStatementImpl#getIterate <em>Iterate</em>}</li>
* </ul>
*
* @generated
*/
public class ForStatementImpl extends ConditionalBlockStatementImpl implements ForStatement {
/**
* The cached value of the '{@link #getInit() <em>Init</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getInit()
* @generated
* @ordered
*/
protected Expression init;
/**
* The cached value of the '{@link #getIterate() <em>Iterate</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIterate()
* @generated
* @ordered
*/
protected Expression iterate;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ForStatementImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return StatementPackage.Literals.FOR_STATEMENT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Expression getInit() {
return init;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetInit(Expression newInit, NotificationChain msgs) {
Expression oldInit = init;
init = newInit;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StatementPackage.FOR_STATEMENT__INIT, oldInit, newInit);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setInit(Expression newInit) {
if (newInit != init) {
NotificationChain msgs = null;
if (init != null)
msgs = ((InternalEObject)init).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StatementPackage.FOR_STATEMENT__INIT, null, msgs);
if (newInit != null)
msgs = ((InternalEObject)newInit).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StatementPackage.FOR_STATEMENT__INIT, null, msgs);
msgs = basicSetInit(newInit, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StatementPackage.FOR_STATEMENT__INIT, newInit, newInit));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Expression getIterate() {
return iterate;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetIterate(Expression newIterate, NotificationChain msgs) {
Expression oldIterate = iterate;
iterate = newIterate;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StatementPackage.FOR_STATEMENT__ITERATE, oldIterate, newIterate);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setIterate(Expression newIterate) {
if (newIterate != iterate) {
NotificationChain msgs = null;
if (iterate != null)
msgs = ((InternalEObject)iterate).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StatementPackage.FOR_STATEMENT__ITERATE, null, msgs);
if (newIterate != null)
msgs = ((InternalEObject)newIterate).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StatementPackage.FOR_STATEMENT__ITERATE, null, msgs);
msgs = basicSetIterate(newIterate, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StatementPackage.FOR_STATEMENT__ITERATE, newIterate, newIterate));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case StatementPackage.FOR_STATEMENT__INIT:
return basicSetInit(null, msgs);
case StatementPackage.FOR_STATEMENT__ITERATE:
return basicSetIterate(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.FOR_STATEMENT__INIT:
return getInit();
case StatementPackage.FOR_STATEMENT__ITERATE:
return getIterate();
}
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.FOR_STATEMENT__INIT:
setInit((Expression)newValue);
return;
case StatementPackage.FOR_STATEMENT__ITERATE:
setIterate((Expression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case StatementPackage.FOR_STATEMENT__INIT:
setInit((Expression)null);
return;
case StatementPackage.FOR_STATEMENT__ITERATE:
setIterate((Expression)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case StatementPackage.FOR_STATEMENT__INIT:
return init != null;
case StatementPackage.FOR_STATEMENT__ITERATE:
return iterate != null;
}
return super.eIsSet(featureID);
}
} //ForStatementImpl