| /******************************************************************************* |
| *Copyright (c) 2008 Standards for Technology in Automotive Retail 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: |
| * David Carver (STAR) - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.wst.xml.vex.core.internal.provisional.dom.impl; |
| |
| 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; |
| |
| import org.eclipse.wst.xml.vex.core.internal.provisional.dom.DomEMFPackage; |
| |
| import org.eclipse.wst.xml.vex.core.internal.provisional.dom.I.Position; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Position</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.wst.xml.vex.core.internal.provisional.dom.impl.PositionImpl#getOffset <em>Offset</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class PositionImpl extends EObjectImpl implements Position { |
| /** |
| * The default value of the '{@link #getOffset() <em>Offset</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOffset() |
| * @generated |
| * @ordered |
| */ |
| protected static final int OFFSET_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getOffset() <em>Offset</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOffset() |
| * @generated |
| * @ordered |
| */ |
| protected int offset = OFFSET_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected PositionImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return DomEMFPackage.Literals.POSITION; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public int getOffset() { |
| return offset; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setOffset(int newOffset) { |
| int oldOffset = offset; |
| offset = newOffset; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DomEMFPackage.POSITION__OFFSET, oldOffset, offset)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case DomEMFPackage.POSITION__OFFSET: |
| return new Integer(getOffset()); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case DomEMFPackage.POSITION__OFFSET: |
| setOffset(((Integer)newValue).intValue()); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case DomEMFPackage.POSITION__OFFSET: |
| setOffset(OFFSET_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case DomEMFPackage.POSITION__OFFSET: |
| return offset != OFFSET_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(" (offset: "); |
| result.append(offset); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //PositionImpl |