blob: 37c7223710fcfab4381909c52ab7adc577e6da63 [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.ordinalType;
import delphi.setType;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>set Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link delphi.impl.setTypeImpl#getOrdinal <em>Ordinal</em>}</li>
* </ul>
*
* @generated
*/
public class setTypeImpl extends strucTypeImpl implements setType {
/**
* The cached value of the '{@link #getOrdinal() <em>Ordinal</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOrdinal()
* @generated
* @ordered
*/
protected ordinalType ordinal;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected setTypeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return DelphiPackage.Literals.SET_TYPE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ordinalType getOrdinal() {
return ordinal;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetOrdinal(ordinalType newOrdinal, NotificationChain msgs) {
ordinalType oldOrdinal = ordinal;
ordinal = newOrdinal;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DelphiPackage.SET_TYPE__ORDINAL, oldOrdinal, newOrdinal);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOrdinal(ordinalType newOrdinal) {
if (newOrdinal != ordinal) {
NotificationChain msgs = null;
if (ordinal != null)
msgs = ((InternalEObject)ordinal).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DelphiPackage.SET_TYPE__ORDINAL, null, msgs);
if (newOrdinal != null)
msgs = ((InternalEObject)newOrdinal).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DelphiPackage.SET_TYPE__ORDINAL, null, msgs);
msgs = basicSetOrdinal(newOrdinal, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DelphiPackage.SET_TYPE__ORDINAL, newOrdinal, newOrdinal));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case DelphiPackage.SET_TYPE__ORDINAL:
return basicSetOrdinal(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 DelphiPackage.SET_TYPE__ORDINAL:
return getOrdinal();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case DelphiPackage.SET_TYPE__ORDINAL:
setOrdinal((ordinalType)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case DelphiPackage.SET_TYPE__ORDINAL:
setOrdinal((ordinalType)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DelphiPackage.SET_TYPE__ORDINAL:
return ordinal != null;
}
return super.eIsSet(featureID);
}
} //setTypeImpl