/**
* Copyright (c) 2013 CEA LIST
*
* 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:
* CEA LIST - Initial API and implementation
*
*/
package org.eclipse.papyrus.C_Cpp.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.papyrus.C_Cpp.C_CppPackage;
import org.eclipse.papyrus.C_Cpp.Typedef;
import org.eclipse.uml2.uml.PrimitiveType;
/**
*
* An implementation of the model object 'Typedef'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.papyrus.C_Cpp.impl.TypedefImpl#getDefinition Definition}
* - {@link org.eclipse.papyrus.C_Cpp.impl.TypedefImpl#getBase_primitivetype Base primitivetype}
*
*
*
* @generated
*/
public class TypedefImpl extends MinimalEObjectImpl.Container implements Typedef {
/**
* The default value of the '{@link #getDefinition() Definition}' attribute.
*
*
*
* @see #getDefinition()
* @generated
* @ordered
*/
protected static final String DEFINITION_EDEFAULT = null;
/**
* The cached value of the '{@link #getDefinition() Definition}' attribute.
*
*
*
* @see #getDefinition()
* @generated
* @ordered
*/
protected String definition = DEFINITION_EDEFAULT;
/**
* The cached value of the '{@link #getBase_primitivetype() Base primitivetype}' reference.
*
*
*
* @see #getBase_primitivetype()
* @generated
* @ordered
*/
protected PrimitiveType base_primitivetype;
/**
*
*
*
* @generated
*/
protected TypedefImpl() {
super();
}
/**
*
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return C_CppPackage.Literals.TYPEDEF;
}
/**
*
*
*
* @generated
*/
@Override
public String getDefinition() {
return definition;
}
/**
*
*
*
* @generated
*/
@Override
public void setDefinition(String newDefinition) {
String oldDefinition = definition;
definition = newDefinition;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, C_CppPackage.TYPEDEF__DEFINITION, oldDefinition, definition));
}
}
/**
*
*
*
* @generated
*/
@Override
public PrimitiveType getBase_primitivetype() {
if (base_primitivetype != null && base_primitivetype.eIsProxy()) {
InternalEObject oldBase_primitivetype = (InternalEObject) base_primitivetype;
base_primitivetype = (PrimitiveType) eResolveProxy(oldBase_primitivetype);
if (base_primitivetype != oldBase_primitivetype) {
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.RESOLVE, C_CppPackage.TYPEDEF__BASE_PRIMITIVETYPE, oldBase_primitivetype, base_primitivetype));
}
}
}
return base_primitivetype;
}
/**
*
*
*
* @generated
*/
public PrimitiveType basicGetBase_primitivetype() {
return base_primitivetype;
}
/**
*
*
*
* @generated
*/
@Override
public void setBase_primitivetype(PrimitiveType newBase_primitivetype) {
PrimitiveType oldBase_primitivetype = base_primitivetype;
base_primitivetype = newBase_primitivetype;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, C_CppPackage.TYPEDEF__BASE_PRIMITIVETYPE, oldBase_primitivetype, base_primitivetype));
}
}
/**
*
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case C_CppPackage.TYPEDEF__DEFINITION:
return getDefinition();
case C_CppPackage.TYPEDEF__BASE_PRIMITIVETYPE:
if (resolve) {
return getBase_primitivetype();
}
return basicGetBase_primitivetype();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case C_CppPackage.TYPEDEF__DEFINITION:
setDefinition((String) newValue);
return;
case C_CppPackage.TYPEDEF__BASE_PRIMITIVETYPE:
setBase_primitivetype((PrimitiveType) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case C_CppPackage.TYPEDEF__DEFINITION:
setDefinition(DEFINITION_EDEFAULT);
return;
case C_CppPackage.TYPEDEF__BASE_PRIMITIVETYPE:
setBase_primitivetype((PrimitiveType) null);
return;
}
super.eUnset(featureID);
}
/**
*
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case C_CppPackage.TYPEDEF__DEFINITION:
return DEFINITION_EDEFAULT == null ? definition != null : !DEFINITION_EDEFAULT.equals(definition);
case C_CppPackage.TYPEDEF__BASE_PRIMITIVETYPE:
return base_primitivetype != null;
}
return super.eIsSet(featureID);
}
/**
*
*
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) {
return super.toString();
}
StringBuffer result = new StringBuffer(super.toString());
result.append(" (definition: "); //$NON-NLS-1$
result.append(definition);
result.append(')');
return result.toString();
}
} // TypedefImpl