blob: 6c6e47409fed698a17ec75a6bbaeaaf290db6a17 [file] [log] [blame]
/**
* <copyright>
* Copyright (c) 2009, 2010 Open Canarias, S.L.
* 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
*
* Contributors:
* Adolfo Sanchez-Barbudo Herrera - Initial API and implementation
*
* </copyright>
*/
package org.eclipse.modisco.omg.gastm.impl;
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.modisco.omg.gastm.GASTMPackage;
import org.eclipse.modisco.omg.gastm.LabelDefinition;
import org.eclipse.modisco.omg.gastm.LabeledStatement;
import org.eclipse.modisco.omg.gastm.Statement;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Labeled Statement</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.modisco.omg.gastm.impl.LabeledStatementImpl#getLabel <em>Label</em>}</li>
* <li>{@link org.eclipse.modisco.omg.gastm.impl.LabeledStatementImpl#getStatement <em>Statement</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class LabeledStatementImpl extends StatementImpl implements LabeledStatement {
/**
* The cached value of the '{@link #getLabel() <em>Label</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLabel()
* @generated
* @ordered
*/
protected LabelDefinition label;
/**
* 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;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected LabeledStatementImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return GASTMPackage.eINSTANCE.getLabeledStatement();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LabelDefinition getLabel() {
return label;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetLabel(LabelDefinition newLabel, NotificationChain msgs) {
LabelDefinition oldLabel = label;
label = newLabel;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GASTMPackage.LABELED_STATEMENT__LABEL, oldLabel, newLabel);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLabel(LabelDefinition newLabel) {
if (newLabel != label) {
NotificationChain msgs = null;
if (label != null)
msgs = ((InternalEObject)label).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GASTMPackage.LABELED_STATEMENT__LABEL, null, msgs);
if (newLabel != null)
msgs = ((InternalEObject)newLabel).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GASTMPackage.LABELED_STATEMENT__LABEL, null, msgs);
msgs = basicSetLabel(newLabel, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, GASTMPackage.LABELED_STATEMENT__LABEL, newLabel, newLabel));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
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, GASTMPackage.LABELED_STATEMENT__STATEMENT, oldStatement, newStatement);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStatement(Statement newStatement) {
if (newStatement != statement) {
NotificationChain msgs = null;
if (statement != null)
msgs = ((InternalEObject)statement).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GASTMPackage.LABELED_STATEMENT__STATEMENT, null, msgs);
if (newStatement != null)
msgs = ((InternalEObject)newStatement).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GASTMPackage.LABELED_STATEMENT__STATEMENT, null, msgs);
msgs = basicSetStatement(newStatement, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, GASTMPackage.LABELED_STATEMENT__STATEMENT, newStatement, newStatement));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case GASTMPackage.LABELED_STATEMENT__LABEL:
return basicSetLabel(null, msgs);
case GASTMPackage.LABELED_STATEMENT__STATEMENT:
return basicSetStatement(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 GASTMPackage.LABELED_STATEMENT__LABEL:
return getLabel();
case GASTMPackage.LABELED_STATEMENT__STATEMENT:
return getStatement();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case GASTMPackage.LABELED_STATEMENT__LABEL:
setLabel((LabelDefinition)newValue);
return;
case GASTMPackage.LABELED_STATEMENT__STATEMENT:
setStatement((Statement)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case GASTMPackage.LABELED_STATEMENT__LABEL:
setLabel((LabelDefinition)null);
return;
case GASTMPackage.LABELED_STATEMENT__STATEMENT:
setStatement((Statement)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case GASTMPackage.LABELED_STATEMENT__LABEL:
return label != null;
case GASTMPackage.LABELED_STATEMENT__STATEMENT:
return statement != null;
}
return super.eIsSet(featureID);
}
} //LabeledStatementImpl