blob: 4184857c16adefc1dfceb64866350a959fb2c097 [file] [log] [blame]
/**
* *******************************************************************************
* Copyright (c) 2009 Mia-Software.
* 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:
*
* Fabien Giquel (Mia-Software) - initial API and implementation
* *******************************************************************************
*
* $Id$
*/
package org.eclipse.gmt.modisco.java.emf.classic.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.gmt.modisco.java.ClassDeclaration;
import org.eclipse.gmt.modisco.java.TypeAccess;
import org.eclipse.gmt.modisco.java.emf.classic.JavaPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Class Declaration</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.gmt.modisco.java.emf.classic.impl.ClassDeclarationImpl#getSuperClass <em>Super Class</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ClassDeclarationImpl extends TypeDeclarationImpl implements ClassDeclaration {
/**
* The cached value of the '{@link #getSuperClass() <em>Super Class</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSuperClass()
* @generated
* @ordered
*/
protected TypeAccess superClass;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ClassDeclarationImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return JavaPackage.eINSTANCE.getClassDeclaration();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TypeAccess getSuperClass() {
return superClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetSuperClass(TypeAccess newSuperClass, NotificationChain msgs) {
TypeAccess oldSuperClass = superClass;
superClass = newSuperClass;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JavaPackage.CLASS_DECLARATION__SUPER_CLASS, oldSuperClass, newSuperClass);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSuperClass(TypeAccess newSuperClass) {
if (newSuperClass != superClass) {
NotificationChain msgs = null;
if (superClass != null)
msgs = ((InternalEObject)superClass).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JavaPackage.CLASS_DECLARATION__SUPER_CLASS, null, msgs);
if (newSuperClass != null)
msgs = ((InternalEObject)newSuperClass).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JavaPackage.CLASS_DECLARATION__SUPER_CLASS, null, msgs);
msgs = basicSetSuperClass(newSuperClass, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.CLASS_DECLARATION__SUPER_CLASS, newSuperClass, newSuperClass));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case JavaPackage.CLASS_DECLARATION__SUPER_CLASS:
return basicSetSuperClass(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 JavaPackage.CLASS_DECLARATION__SUPER_CLASS:
return getSuperClass();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case JavaPackage.CLASS_DECLARATION__SUPER_CLASS:
setSuperClass((TypeAccess)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case JavaPackage.CLASS_DECLARATION__SUPER_CLASS:
setSuperClass((TypeAccess)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case JavaPackage.CLASS_DECLARATION__SUPER_CLASS:
return superClass != null;
}
return super.eIsSet(featureID);
}
} //ClassDeclarationImpl