/** | |
* | |
* Copyright (c) 2009 Hatha Systems. | |
* 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: | |
* Nikolai Mansourov (Hatha Systems) - initial API and implementation | |
* Gabriel Barbier (Mia-Software) - minor evolutions for version 1.1 | |
* | |
* $Id$ | |
*/ | |
package org.eclipse.gmt.modisco.omg.kdm.code.impl; | |
import org.eclipse.emf.common.notify.Notification; | |
import org.eclipse.emf.ecore.EClass; | |
import org.eclipse.emf.ecore.impl.ENotificationImpl; | |
import org.eclipse.gmt.modisco.omg.kdm.code.CodePackage; | |
import org.eclipse.gmt.modisco.omg.kdm.code.ExportKind; | |
import org.eclipse.gmt.modisco.omg.kdm.code.MethodKind; | |
import org.eclipse.gmt.modisco.omg.kdm.code.MethodUnit; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Method Unit</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* <ul> | |
* <li>{@link org.eclipse.gmt.modisco.omg.kdm.code.impl.MethodUnitImpl#getKind <em>Kind</em>}</li> | |
* <li>{@link org.eclipse.gmt.modisco.omg.kdm.code.impl.MethodUnitImpl#getExport <em>Export</em>}</li> | |
* </ul> | |
* </p> | |
* | |
* @generated | |
*/ | |
public class MethodUnitImpl extends ControlElementImpl implements MethodUnit { | |
/** | |
* The default value of the '{@link #getKind() <em>Kind</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getKind() | |
* @generated | |
* @ordered | |
*/ | |
protected static final MethodKind KIND_EDEFAULT = MethodKind.METHOD; | |
/** | |
* The cached value of the '{@link #getKind() <em>Kind</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getKind() | |
* @generated | |
* @ordered | |
*/ | |
protected MethodKind kind = KIND_EDEFAULT; | |
/** | |
* The default value of the '{@link #getExport() <em>Export</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getExport() | |
* @generated | |
* @ordered | |
*/ | |
protected static final ExportKind EXPORT_EDEFAULT = ExportKind.PUBLIC; | |
/** | |
* The cached value of the '{@link #getExport() <em>Export</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getExport() | |
* @generated | |
* @ordered | |
*/ | |
protected ExportKind export = EXPORT_EDEFAULT; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected MethodUnitImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return CodePackage.Literals.METHOD_UNIT; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public MethodKind getKind() { | |
return kind; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setKind(MethodKind newKind) { | |
MethodKind oldKind = kind; | |
kind = newKind == null ? KIND_EDEFAULT : newKind; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, CodePackage.METHOD_UNIT__KIND, oldKind, kind)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public ExportKind getExport() { | |
return export; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setExport(ExportKind newExport) { | |
ExportKind oldExport = export; | |
export = newExport == null ? EXPORT_EDEFAULT : newExport; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, CodePackage.METHOD_UNIT__EXPORT, oldExport, export)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public Object eGet(int featureID, boolean resolve, boolean coreType) { | |
switch (featureID) { | |
case CodePackage.METHOD_UNIT__KIND: | |
return getKind(); | |
case CodePackage.METHOD_UNIT__EXPORT: | |
return getExport(); | |
} | |
return super.eGet(featureID, resolve, coreType); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eSet(int featureID, Object newValue) { | |
switch (featureID) { | |
case CodePackage.METHOD_UNIT__KIND: | |
setKind((MethodKind)newValue); | |
return; | |
case CodePackage.METHOD_UNIT__EXPORT: | |
setExport((ExportKind)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case CodePackage.METHOD_UNIT__KIND: | |
setKind(KIND_EDEFAULT); | |
return; | |
case CodePackage.METHOD_UNIT__EXPORT: | |
setExport(EXPORT_EDEFAULT); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case CodePackage.METHOD_UNIT__KIND: | |
return kind != KIND_EDEFAULT; | |
case CodePackage.METHOD_UNIT__EXPORT: | |
return export != EXPORT_EDEFAULT; | |
} | |
return super.eIsSet(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public String toString() { | |
if (eIsProxy()) return super.toString(); | |
StringBuffer result = new StringBuffer(super.toString()); | |
result.append(" (kind: "); //$NON-NLS-1$ | |
result.append(kind); | |
result.append(", export: "); //$NON-NLS-1$ | |
result.append(export); | |
result.append(')'); | |
return result.toString(); | |
} | |
} //MethodUnitImpl |