blob: cefee21e0c7c2edecca24e2a0f7e6a954194afe5 [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 astm.impl;
import astm.AstmPackage;
import astm.DelphiImplementationSection;
import astm.DelphiInterfaceSection;
import astm.DelphiUnit;
import astm.Name;
import astm.util.Visitor;
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.jdt.annotation.NonNull;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Delphi Unit</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link astm.impl.DelphiUnitImpl#getName <em>Name</em>}</li>
* <li>{@link astm.impl.DelphiUnitImpl#getInterface <em>Interface</em>}</li>
* <li>{@link astm.impl.DelphiUnitImpl#getImplementation <em>Implementation</em>}</li>
* </ul>
*
* @generated
*/
public class DelphiUnitImpl extends CompilationUnitImpl implements DelphiUnit {
/**
* The cached value of the '{@link #getName() <em>Name</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected Name name;
/**
* The cached value of the '{@link #getInterface() <em>Interface</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getInterface()
* @generated
* @ordered
*/
protected DelphiInterfaceSection interface_;
/**
* The cached value of the '{@link #getImplementation() <em>Implementation</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getImplementation()
* @generated
* @ordered
*/
protected DelphiImplementationSection implementation;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DelphiUnitImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return AstmPackage.Literals.DELPHI_UNIT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Name getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetName(Name newName, NotificationChain msgs) {
Name oldName = name;
name = newName;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AstmPackage.DELPHI_UNIT__NAME, oldName, newName);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(Name newName) {
if (newName != name) {
NotificationChain msgs = null;
if (name != null)
msgs = ((InternalEObject)name).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AstmPackage.DELPHI_UNIT__NAME, null, msgs);
if (newName != null)
msgs = ((InternalEObject)newName).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstmPackage.DELPHI_UNIT__NAME, null, msgs);
msgs = basicSetName(newName, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AstmPackage.DELPHI_UNIT__NAME, newName, newName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DelphiInterfaceSection getInterface() {
return interface_;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetInterface(DelphiInterfaceSection newInterface, NotificationChain msgs) {
DelphiInterfaceSection oldInterface = interface_;
interface_ = newInterface;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AstmPackage.DELPHI_UNIT__INTERFACE, oldInterface, newInterface);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setInterface(DelphiInterfaceSection newInterface) {
if (newInterface != interface_) {
NotificationChain msgs = null;
if (interface_ != null)
msgs = ((InternalEObject)interface_).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AstmPackage.DELPHI_UNIT__INTERFACE, null, msgs);
if (newInterface != null)
msgs = ((InternalEObject)newInterface).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstmPackage.DELPHI_UNIT__INTERFACE, null, msgs);
msgs = basicSetInterface(newInterface, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AstmPackage.DELPHI_UNIT__INTERFACE, newInterface, newInterface));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DelphiImplementationSection getImplementation() {
return implementation;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetImplementation(DelphiImplementationSection newImplementation, NotificationChain msgs) {
DelphiImplementationSection oldImplementation = implementation;
implementation = newImplementation;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AstmPackage.DELPHI_UNIT__IMPLEMENTATION, oldImplementation, newImplementation);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setImplementation(DelphiImplementationSection newImplementation) {
if (newImplementation != implementation) {
NotificationChain msgs = null;
if (implementation != null)
msgs = ((InternalEObject)implementation).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AstmPackage.DELPHI_UNIT__IMPLEMENTATION, null, msgs);
if (newImplementation != null)
msgs = ((InternalEObject)newImplementation).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AstmPackage.DELPHI_UNIT__IMPLEMENTATION, null, msgs);
msgs = basicSetImplementation(newImplementation, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AstmPackage.DELPHI_UNIT__IMPLEMENTATION, newImplementation, newImplementation));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AstmPackage.DELPHI_UNIT__NAME:
return basicSetName(null, msgs);
case AstmPackage.DELPHI_UNIT__INTERFACE:
return basicSetInterface(null, msgs);
case AstmPackage.DELPHI_UNIT__IMPLEMENTATION:
return basicSetImplementation(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 AstmPackage.DELPHI_UNIT__NAME:
return getName();
case AstmPackage.DELPHI_UNIT__INTERFACE:
return getInterface();
case AstmPackage.DELPHI_UNIT__IMPLEMENTATION:
return getImplementation();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case AstmPackage.DELPHI_UNIT__NAME:
setName((Name)newValue);
return;
case AstmPackage.DELPHI_UNIT__INTERFACE:
setInterface((DelphiInterfaceSection)newValue);
return;
case AstmPackage.DELPHI_UNIT__IMPLEMENTATION:
setImplementation((DelphiImplementationSection)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AstmPackage.DELPHI_UNIT__NAME:
setName((Name)null);
return;
case AstmPackage.DELPHI_UNIT__INTERFACE:
setInterface((DelphiInterfaceSection)null);
return;
case AstmPackage.DELPHI_UNIT__IMPLEMENTATION:
setImplementation((DelphiImplementationSection)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AstmPackage.DELPHI_UNIT__NAME:
return name != null;
case AstmPackage.DELPHI_UNIT__INTERFACE:
return interface_ != null;
case AstmPackage.DELPHI_UNIT__IMPLEMENTATION:
return implementation != null;
}
return super.eIsSet(featureID);
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public <R> R accept(@NonNull Visitor<R> visitor) {
return visitor.visitDelphiUnit(this);
}
} //DelphiUnitImpl