blob: 58f112b9ddc3119c238b674afd7a77abb4750e16 [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:
*
* Sebastien Minguet (Mia-Software) - initial API and implementation
* Frederic Madiot (Mia-Software) - initial API and implementation
* Fabien Giquel (Mia-Software) - initial API and implementation
* Gabriel Barbier (Mia-Software) - initial API and implementation
* Erwan Breton (Sodifrance) - initial API and implementation
* Romain Dervaux (Mia-Software) - initial API and implementation
* *******************************************************************************
*
* $Id$
*/
package org.eclipse.gmt.modisco.java.emf.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.AbstractTypeDeclaration;
import org.eclipse.gmt.modisco.java.TypeDeclarationStatement;
import org.eclipse.gmt.modisco.java.emf.JavaPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Type Declaration Statement</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.gmt.modisco.java.emf.impl.TypeDeclarationStatementImpl#getDeclaration <em>Declaration</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class TypeDeclarationStatementImpl extends StatementImpl implements TypeDeclarationStatement {
/**
* The cached value of the '{@link #getDeclaration() <em>Declaration</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDeclaration()
* @generated
* @ordered
*/
protected AbstractTypeDeclaration declaration;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected TypeDeclarationStatementImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return JavaPackage.eINSTANCE.getTypeDeclarationStatement();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AbstractTypeDeclaration getDeclaration() {
return declaration;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetDeclaration(AbstractTypeDeclaration newDeclaration, NotificationChain msgs) {
AbstractTypeDeclaration oldDeclaration = declaration;
declaration = newDeclaration;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JavaPackage.TYPE_DECLARATION_STATEMENT__DECLARATION, oldDeclaration, newDeclaration);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDeclaration(AbstractTypeDeclaration newDeclaration) {
if (newDeclaration != declaration) {
NotificationChain msgs = null;
if (declaration != null)
msgs = ((InternalEObject)declaration).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JavaPackage.TYPE_DECLARATION_STATEMENT__DECLARATION, null, msgs);
if (newDeclaration != null)
msgs = ((InternalEObject)newDeclaration).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JavaPackage.TYPE_DECLARATION_STATEMENT__DECLARATION, null, msgs);
msgs = basicSetDeclaration(newDeclaration, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.TYPE_DECLARATION_STATEMENT__DECLARATION, newDeclaration, newDeclaration));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case JavaPackage.TYPE_DECLARATION_STATEMENT__DECLARATION:
return basicSetDeclaration(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.TYPE_DECLARATION_STATEMENT__DECLARATION:
return getDeclaration();
}
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.TYPE_DECLARATION_STATEMENT__DECLARATION:
setDeclaration((AbstractTypeDeclaration)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case JavaPackage.TYPE_DECLARATION_STATEMENT__DECLARATION:
setDeclaration((AbstractTypeDeclaration)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case JavaPackage.TYPE_DECLARATION_STATEMENT__DECLARATION:
return declaration != null;
}
return super.eIsSet(featureID);
}
} //TypeDeclarationStatementImpl