blob: 301475224fe808379e75be94afc03f74de643319 [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
* Gregoire DUPE (Mia-Software) - initial API and implementation
* *******************************************************************************
*
* $Id$
*/
package org.eclipse.gmt.modisco.java.nousages.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.NamespaceAccess;
import org.eclipse.gmt.modisco.java.Type;
import org.eclipse.gmt.modisco.java.TypeAccess;
import org.eclipse.gmt.modisco.java.nousages.meta.JavaPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Type Access</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.gmt.modisco.java.nousages.impl.TypeAccessImpl#getType <em>Type</em>}</li>
* <li>{@link org.eclipse.gmt.modisco.java.nousages.impl.TypeAccessImpl#getQualifier <em>Qualifier</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class TypeAccessImpl extends ExpressionImpl implements TypeAccess {
/**
* The cached value of the '{@link #getType() <em>Type</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected Type type;
/**
* The cached value of the '{@link #getQualifier() <em>Qualifier</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getQualifier()
* @generated
* @ordered
*/
protected NamespaceAccess qualifier;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected TypeAccessImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return JavaPackage.eINSTANCE.getTypeAccess();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Type getType() {
if (type != null && type.eIsProxy()) {
InternalEObject oldType = (InternalEObject)type;
type = (Type)eResolveProxy(oldType);
if (type != oldType) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, JavaPackage.TYPE_ACCESS__TYPE, oldType, type));
}
}
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Type basicGetType() {
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setType(Type newType) {
Type oldType = type;
type = newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.TYPE_ACCESS__TYPE, oldType, type));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NamespaceAccess getQualifier() {
return qualifier;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetQualifier(NamespaceAccess newQualifier, NotificationChain msgs) {
NamespaceAccess oldQualifier = qualifier;
qualifier = newQualifier;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JavaPackage.TYPE_ACCESS__QUALIFIER, oldQualifier, newQualifier);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setQualifier(NamespaceAccess newQualifier) {
if (newQualifier != qualifier) {
NotificationChain msgs = null;
if (qualifier != null)
msgs = ((InternalEObject)qualifier).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JavaPackage.TYPE_ACCESS__QUALIFIER, null, msgs);
if (newQualifier != null)
msgs = ((InternalEObject)newQualifier).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JavaPackage.TYPE_ACCESS__QUALIFIER, null, msgs);
msgs = basicSetQualifier(newQualifier, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.TYPE_ACCESS__QUALIFIER, newQualifier, newQualifier));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case JavaPackage.TYPE_ACCESS__QUALIFIER:
return basicSetQualifier(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_ACCESS__TYPE:
if (resolve) return getType();
return basicGetType();
case JavaPackage.TYPE_ACCESS__QUALIFIER:
return getQualifier();
}
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_ACCESS__TYPE:
setType((Type)newValue);
return;
case JavaPackage.TYPE_ACCESS__QUALIFIER:
setQualifier((NamespaceAccess)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case JavaPackage.TYPE_ACCESS__TYPE:
setType((Type)null);
return;
case JavaPackage.TYPE_ACCESS__QUALIFIER:
setQualifier((NamespaceAccess)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case JavaPackage.TYPE_ACCESS__TYPE:
return type != null;
case JavaPackage.TYPE_ACCESS__QUALIFIER:
return qualifier != null;
}
return super.eIsSet(featureID);
}
} //TypeAccessImpl