/**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.reuseware.air.language.cmsl.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.emf.ecore.impl.EObjectImpl;
import org.reuseware.air.language.cmsl.Cardinality;
import org.reuseware.air.language.cmsl.CmslPackage;
import org.reuseware.air.language.cmsl.Construct;
import org.reuseware.air.language.cmsl.NonTerminal;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Construct</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.reuseware.air.language.cmsl.impl.ConstructImpl#getName <em>Name</em>}</li>
* <li>{@link org.reuseware.air.language.cmsl.impl.ConstructImpl#getCardinality <em>Cardinality</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ConstructImpl extends EObjectImpl implements Construct {
/**
* The cached value of the '{@link #getName() <em>Name</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected NonTerminal name;
/**
* The cached value of the '{@link #getCardinality() <em>Cardinality</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCardinality()
* @generated
* @ordered
*/
protected Cardinality cardinality;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ConstructImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return CmslPackage.Literals.CONSTRUCT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NonTerminal getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetName(NonTerminal newName, NotificationChain msgs) {
NonTerminal oldName = name;
name = newName;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CmslPackage.CONSTRUCT__NAME, oldName, newName);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(NonTerminal newName) {
if (newName != name)
{
NotificationChain msgs = null;
if (name != null)
msgs = ((InternalEObject)name).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CmslPackage.CONSTRUCT__NAME, null, msgs);
if (newName != null)
msgs = ((InternalEObject)newName).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CmslPackage.CONSTRUCT__NAME, null, msgs);
msgs = basicSetName(newName, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CmslPackage.CONSTRUCT__NAME, newName, newName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Cardinality getCardinality() {
return cardinality;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetCardinality(Cardinality newCardinality, NotificationChain msgs) {
Cardinality oldCardinality = cardinality;
cardinality = newCardinality;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CmslPackage.CONSTRUCT__CARDINALITY, oldCardinality, newCardinality);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCardinality(Cardinality newCardinality) {
if (newCardinality != cardinality)
{
NotificationChain msgs = null;
if (cardinality != null)
msgs = ((InternalEObject)cardinality).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CmslPackage.CONSTRUCT__CARDINALITY, null, msgs);
if (newCardinality != null)
msgs = ((InternalEObject)newCardinality).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CmslPackage.CONSTRUCT__CARDINALITY, null, msgs);
msgs = basicSetCardinality(newCardinality, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CmslPackage.CONSTRUCT__CARDINALITY, newCardinality, newCardinality));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID)
{
case CmslPackage.CONSTRUCT__NAME:
return basicSetName(null, msgs);
case CmslPackage.CONSTRUCT__CARDINALITY:
return basicSetCardinality(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 CmslPackage.CONSTRUCT__NAME:
return getName();
case CmslPackage.CONSTRUCT__CARDINALITY:
return getCardinality();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue) {
switch (featureID)
{
case CmslPackage.CONSTRUCT__NAME:
setName((NonTerminal)newValue);
return;
case CmslPackage.CONSTRUCT__CARDINALITY:
setCardinality((Cardinality)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID) {
switch (featureID)
{
case CmslPackage.CONSTRUCT__NAME:
setName((NonTerminal)null);
return;
case CmslPackage.CONSTRUCT__CARDINALITY:
setCardinality((Cardinality)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID)
{
case CmslPackage.CONSTRUCT__NAME:
return name != null;
case CmslPackage.CONSTRUCT__CARDINALITY:
return cardinality != null;
}
return super.eIsSet(featureID);
}
} //ConstructImpl