| /******************************************************************************* |
| * Copyright (c) 2008, 2012 Obeo. |
| * 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: |
| * Obeo - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.acceleo.parser.cst.impl; |
| |
| import org.eclipse.acceleo.parser.cst.CstPackage; |
| import org.eclipse.acceleo.parser.cst.ModuleImportsValue; |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.impl.EObjectImpl; |
| |
| /** |
| * <!-- begin-user-doc --> An implementation of the model object '<em><b>Module Imports Value</b></em>'. <!-- |
| * end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.acceleo.parser.cst.impl.ModuleImportsValueImpl#getStartPosition <em>Start Position |
| * </em>}</li> |
| * <li>{@link org.eclipse.acceleo.parser.cst.impl.ModuleImportsValueImpl#getEndPosition <em>End Position</em>} |
| * </li> |
| * <li>{@link org.eclipse.acceleo.parser.cst.impl.ModuleImportsValueImpl#getName <em>Name</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class ModuleImportsValueImpl extends EObjectImpl implements ModuleImportsValue { |
| /** |
| * The default value of the '{@link #getStartPosition() <em>Start Position</em>}' attribute. <!-- |
| * begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @see #getStartPosition() |
| * @generated |
| * @ordered |
| */ |
| protected static final int START_POSITION_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getStartPosition() <em>Start Position</em>}' attribute. <!-- |
| * begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @see #getStartPosition() |
| * @generated |
| * @ordered |
| */ |
| protected int startPosition = START_POSITION_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getEndPosition() <em>End Position</em>}' attribute. <!-- |
| * begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @see #getEndPosition() |
| * @generated |
| * @ordered |
| */ |
| protected static final int END_POSITION_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getEndPosition() <em>End Position</em>}' attribute. <!-- |
| * begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @see #getEndPosition() |
| * @generated |
| * @ordered |
| */ |
| protected int endPosition = END_POSITION_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getName() <em>Name</em>}' attribute. <!-- begin-user-doc --> <!-- |
| * end-user-doc --> |
| * |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected static final String NAME_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getName() <em>Name</em>}' attribute. <!-- begin-user-doc --> <!-- |
| * end-user-doc --> |
| * |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected String name = NAME_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| protected ModuleImportsValueImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return CstPackage.Literals.MODULE_IMPORTS_VALUE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public int getStartPosition() { |
| return startPosition; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setStartPosition(int newStartPosition) { |
| int oldStartPosition = startPosition; |
| startPosition = newStartPosition; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, |
| CstPackage.MODULE_IMPORTS_VALUE__START_POSITION, oldStartPosition, startPosition)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public int getEndPosition() { |
| return endPosition; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setEndPosition(int newEndPosition) { |
| int oldEndPosition = endPosition; |
| endPosition = newEndPosition; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, |
| CstPackage.MODULE_IMPORTS_VALUE__END_POSITION, oldEndPosition, endPosition)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public String getName() { |
| return name; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setName(String newName) { |
| String oldName = name; |
| name = newName; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, CstPackage.MODULE_IMPORTS_VALUE__NAME, |
| oldName, name)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case CstPackage.MODULE_IMPORTS_VALUE__START_POSITION: |
| return new Integer(getStartPosition()); |
| case CstPackage.MODULE_IMPORTS_VALUE__END_POSITION: |
| return new Integer(getEndPosition()); |
| case CstPackage.MODULE_IMPORTS_VALUE__NAME: |
| return getName(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case CstPackage.MODULE_IMPORTS_VALUE__START_POSITION: |
| setStartPosition(((Integer)newValue).intValue()); |
| return; |
| case CstPackage.MODULE_IMPORTS_VALUE__END_POSITION: |
| setEndPosition(((Integer)newValue).intValue()); |
| return; |
| case CstPackage.MODULE_IMPORTS_VALUE__NAME: |
| setName((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case CstPackage.MODULE_IMPORTS_VALUE__START_POSITION: |
| setStartPosition(START_POSITION_EDEFAULT); |
| return; |
| case CstPackage.MODULE_IMPORTS_VALUE__END_POSITION: |
| setEndPosition(END_POSITION_EDEFAULT); |
| return; |
| case CstPackage.MODULE_IMPORTS_VALUE__NAME: |
| setName(NAME_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case CstPackage.MODULE_IMPORTS_VALUE__START_POSITION: |
| return startPosition != START_POSITION_EDEFAULT; |
| case CstPackage.MODULE_IMPORTS_VALUE__END_POSITION: |
| return endPosition != END_POSITION_EDEFAULT; |
| case CstPackage.MODULE_IMPORTS_VALUE__NAME: |
| return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
| } |
| 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(" (startPosition: "); //$NON-NLS-1$ |
| result.append(startPosition); |
| result.append(", endPosition: "); //$NON-NLS-1$ |
| result.append(endPosition); |
| result.append(", name: "); //$NON-NLS-1$ |
| result.append(name); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } // ModuleImportsValueImpl |