blob: dfe5b5f70d46817c8f631f3e117b10fdc2ee8875 [file] [log] [blame]
/**
* Copyright (c) 2016 Willink Transformations, Univesity of York and others.
* 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
*/
package delphi.impl;
import delphi.DelphiPackage;
import delphi.constExpr;
import delphi.exportsItem;
import delphi.ident;
import java.util.Collection;
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>exports Item</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link delphi.impl.exportsItemImpl#getId <em>Id</em>}</li>
* <li>{@link delphi.impl.exportsItemImpl#getConstExp <em>Const Exp</em>}</li>
* </ul>
*
* @generated
*/
public class exportsItemImpl extends CSTraceImpl implements exportsItem {
/**
* The cached value of the '{@link #getId() <em>Id</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected ident id;
/**
* The cached value of the '{@link #getConstExp() <em>Const Exp</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getConstExp()
* @generated
* @ordered
*/
protected EList<constExpr> constExp;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected exportsItemImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return DelphiPackage.Literals.EXPORTS_ITEM;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ident getId() {
return id;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetId(ident newId, NotificationChain msgs) {
ident oldId = id;
id = newId;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DelphiPackage.EXPORTS_ITEM__ID, oldId, newId);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setId(ident newId) {
if (newId != id) {
NotificationChain msgs = null;
if (id != null)
msgs = ((InternalEObject)id).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DelphiPackage.EXPORTS_ITEM__ID, null, msgs);
if (newId != null)
msgs = ((InternalEObject)newId).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DelphiPackage.EXPORTS_ITEM__ID, null, msgs);
msgs = basicSetId(newId, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DelphiPackage.EXPORTS_ITEM__ID, newId, newId));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<constExpr> getConstExp() {
if (constExp == null) {
constExp = new EObjectContainmentEList<constExpr>(constExpr.class, this, DelphiPackage.EXPORTS_ITEM__CONST_EXP);
}
return constExp;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case DelphiPackage.EXPORTS_ITEM__ID:
return basicSetId(null, msgs);
case DelphiPackage.EXPORTS_ITEM__CONST_EXP:
return ((InternalEList<?>)getConstExp()).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 DelphiPackage.EXPORTS_ITEM__ID:
return getId();
case DelphiPackage.EXPORTS_ITEM__CONST_EXP:
return getConstExp();
}
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 DelphiPackage.EXPORTS_ITEM__ID:
setId((ident)newValue);
return;
case DelphiPackage.EXPORTS_ITEM__CONST_EXP:
getConstExp().clear();
getConstExp().addAll((Collection<? extends constExpr>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case DelphiPackage.EXPORTS_ITEM__ID:
setId((ident)null);
return;
case DelphiPackage.EXPORTS_ITEM__CONST_EXP:
getConstExp().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DelphiPackage.EXPORTS_ITEM__ID:
return id != null;
case DelphiPackage.EXPORTS_ITEM__CONST_EXP:
return constExp != null && !constExp.isEmpty();
}
return super.eIsSet(featureID);
}
} //exportsItemImpl