/** | |
* 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 java.util.Collection; | |
import org.eclipse.efm.ecore.formalml.expression.Expression; | |
import org.eclipse.efm.ecore.formalml.statement.InterruptStatement; | |
import org.eclipse.efm.ecore.formalml.statement.InterruptStatementKind; | |
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.common.util.EList; | |
import org.eclipse.emf.ecore.EClass; | |
import org.eclipse.emf.ecore.InternalEObject; | |
import org.eclipse.emf.ecore.impl.ENotificationImpl; | |
import org.eclipse.emf.ecore.util.EObjectContainmentEList; | |
import org.eclipse.emf.ecore.util.InternalEList; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Interrupt Statement</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* </p> | |
* <ul> | |
* <li>{@link org.eclipse.efm.ecore.formalml.statement.impl.InterruptStatementImpl#getKind <em>Kind</em>}</li> | |
* <li>{@link org.eclipse.efm.ecore.formalml.statement.impl.InterruptStatementImpl#getExpr <em>Expr</em>}</li> | |
* </ul> | |
* | |
* @generated | |
*/ | |
public class InterruptStatementImpl extends StatementImpl implements InterruptStatement { | |
/** | |
* The default value of the '{@link #getKind() <em>Kind</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getKind() | |
* @generated | |
* @ordered | |
*/ | |
protected static final InterruptStatementKind KIND_EDEFAULT = InterruptStatementKind.BREAK; | |
/** | |
* The cached value of the '{@link #getKind() <em>Kind</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getKind() | |
* @generated | |
* @ordered | |
*/ | |
protected InterruptStatementKind kind = KIND_EDEFAULT; | |
/** | |
* The cached value of the '{@link #getExpr() <em>Expr</em>}' containment reference list. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getExpr() | |
* @generated | |
* @ordered | |
*/ | |
protected EList<Expression> expr; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected InterruptStatementImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return StatementPackage.Literals.INTERRUPT_STATEMENT; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public InterruptStatementKind getKind() { | |
return kind; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void setKind(InterruptStatementKind newKind) { | |
InterruptStatementKind oldKind = kind; | |
kind = newKind == null ? KIND_EDEFAULT : newKind; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, StatementPackage.INTERRUPT_STATEMENT__KIND, oldKind, kind)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public EList<Expression> getExpr() { | |
if (expr == null) { | |
expr = new EObjectContainmentEList<Expression>(Expression.class, this, StatementPackage.INTERRUPT_STATEMENT__EXPR); | |
} | |
return expr; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case StatementPackage.INTERRUPT_STATEMENT__EXPR: | |
return ((InternalEList<?>)getExpr()).basicRemove(otherEnd, 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.INTERRUPT_STATEMENT__KIND: | |
return getKind(); | |
case StatementPackage.INTERRUPT_STATEMENT__EXPR: | |
return getExpr(); | |
} | |
return super.eGet(featureID, resolve, coreType); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@SuppressWarnings("unchecked") | |
@Override | |
public void eSet(int featureID, Object newValue) { | |
switch (featureID) { | |
case StatementPackage.INTERRUPT_STATEMENT__KIND: | |
setKind((InterruptStatementKind)newValue); | |
return; | |
case StatementPackage.INTERRUPT_STATEMENT__EXPR: | |
getExpr().clear(); | |
getExpr().addAll((Collection<? extends Expression>)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case StatementPackage.INTERRUPT_STATEMENT__KIND: | |
setKind(KIND_EDEFAULT); | |
return; | |
case StatementPackage.INTERRUPT_STATEMENT__EXPR: | |
getExpr().clear(); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case StatementPackage.INTERRUPT_STATEMENT__KIND: | |
return kind != KIND_EDEFAULT; | |
case StatementPackage.INTERRUPT_STATEMENT__EXPR: | |
return expr != null && !expr.isEmpty(); | |
} | |
return super.eIsSet(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public String toString() { | |
if (eIsProxy()) return super.toString(); | |
StringBuilder result = new StringBuilder(super.toString()); | |
result.append(" (kind: "); | |
result.append(kind); | |
result.append(')'); | |
return result.toString(); | |
} | |
} //InterruptStatementImpl |