| /** |
| * Copyright (c) 2016 Willink Transformations, Univesity of York and others. |
| * 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: |
| * Adolfo Sanchez-Barbudo Herrera - initial API and implementation |
| */ |
| package astm.impl; |
| |
| import astm.AstmPackage; |
| import astm.MacroDefinition; |
| |
| import astm.util.Visitor; |
| |
| import java.lang.String; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| |
| import org.eclipse.emf.ecore.EClass; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.jdt.annotation.NonNull; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Macro Definition</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link astm.impl.MacroDefinitionImpl#getMacroName <em>Macro Name</em>}</li> |
| * <li>{@link astm.impl.MacroDefinitionImpl#getBody <em>Body</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class MacroDefinitionImpl extends PreprocessorElementImpl implements MacroDefinition { |
| /** |
| * The default value of the '{@link #getMacroName() <em>Macro Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMacroName() |
| * @generated |
| * @ordered |
| */ |
| protected static final String MACRO_NAME_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getMacroName() <em>Macro Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMacroName() |
| * @generated |
| * @ordered |
| */ |
| protected String macroName = MACRO_NAME_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getBody() <em>Body</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getBody() |
| * @generated |
| * @ordered |
| */ |
| protected static final String BODY_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getBody() <em>Body</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getBody() |
| * @generated |
| * @ordered |
| */ |
| protected String body = BODY_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected MacroDefinitionImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AstmPackage.Literals.MACRO_DEFINITION; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getMacroName() { |
| return macroName; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setMacroName(String newMacroName) { |
| String oldMacroName = macroName; |
| macroName = newMacroName; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AstmPackage.MACRO_DEFINITION__MACRO_NAME, oldMacroName, macroName)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getBody() { |
| return body; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setBody(String newBody) { |
| String oldBody = body; |
| body = newBody; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AstmPackage.MACRO_DEFINITION__BODY, oldBody, body)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case AstmPackage.MACRO_DEFINITION__MACRO_NAME: |
| return getMacroName(); |
| case AstmPackage.MACRO_DEFINITION__BODY: |
| return getBody(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case AstmPackage.MACRO_DEFINITION__MACRO_NAME: |
| setMacroName((String)newValue); |
| return; |
| case AstmPackage.MACRO_DEFINITION__BODY: |
| setBody((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AstmPackage.MACRO_DEFINITION__MACRO_NAME: |
| setMacroName(MACRO_NAME_EDEFAULT); |
| return; |
| case AstmPackage.MACRO_DEFINITION__BODY: |
| setBody(BODY_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AstmPackage.MACRO_DEFINITION__MACRO_NAME: |
| return MACRO_NAME_EDEFAULT == null ? macroName != null : !MACRO_NAME_EDEFAULT.equals(macroName); |
| case AstmPackage.MACRO_DEFINITION__BODY: |
| return BODY_EDEFAULT == null ? body != null : !BODY_EDEFAULT.equals(body); |
| } |
| 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(" (macroName: "); |
| result.append(macroName); |
| result.append(", body: "); |
| result.append(body); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public <R> R accept(@NonNull Visitor<R> visitor) { |
| return visitor.visitMacroDefinition(this); |
| } |
| |
| } //MacroDefinitionImpl |