/** | |
* | |
* 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 v2.0 | |
* which accompanies this distribution, and is available at | |
* http://www.eclipse.org/legal/epl-v20.html | |
* | |
* Contributors: | |
* Nikolai Mansourov (Hatha Systems) - initial API and implementation | |
* Gabriel Barbier (Mia-Software) - minor evolutions for version 1.1 | |
* | |
* $Id$ | |
*/ | |
package org.eclipse.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.modisco.omg.kdm.code.CodePackage; | |
import org.eclipse.modisco.omg.kdm.code.MacroKind; | |
import org.eclipse.modisco.omg.kdm.code.MacroUnit; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Macro Unit</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* <ul> | |
* <li>{@link org.eclipse.modisco.omg.kdm.code.impl.MacroUnitImpl#getKind <em>Kind</em>}</li> | |
* </ul> | |
* </p> | |
* | |
* @generated | |
*/ | |
public class MacroUnitImpl extends PreprocessorDirectiveImpl implements MacroUnit { | |
/** | |
* The default value of the '{@link #getKind() <em>Kind</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getKind() | |
* @generated | |
* @ordered | |
*/ | |
protected static final MacroKind KIND_EDEFAULT = MacroKind.REGULAR; | |
/** | |
* The cached value of the '{@link #getKind() <em>Kind</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getKind() | |
* @generated | |
* @ordered | |
*/ | |
protected MacroKind kind = KIND_EDEFAULT; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected MacroUnitImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return CodePackage.Literals.MACRO_UNIT; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public MacroKind getKind() { | |
return kind; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setKind(MacroKind newKind) { | |
MacroKind oldKind = kind; | |
kind = newKind == null ? KIND_EDEFAULT : newKind; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, CodePackage.MACRO_UNIT__KIND, oldKind, kind)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public Object eGet(int featureID, boolean resolve, boolean coreType) { | |
switch (featureID) { | |
case CodePackage.MACRO_UNIT__KIND: | |
return getKind(); | |
} | |
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.MACRO_UNIT__KIND: | |
setKind((MacroKind)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case CodePackage.MACRO_UNIT__KIND: | |
setKind(KIND_EDEFAULT); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case CodePackage.MACRO_UNIT__KIND: | |
return kind != KIND_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(')'); | |
return result.toString(); | |
} | |
} //MacroUnitImpl |