| /****************************************************************************** |
| * Copyright (c) 2004, 2006 IBM Corporation 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: |
| * IBM Corporation - initial API and implementation |
| ****************************************************************************/ |
| |
| package org.eclipse.gmf.runtime.notation.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.MinimalEObjectImpl; |
| import org.eclipse.gmf.runtime.notation.Location; |
| import org.eclipse.gmf.runtime.notation.NotationPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Location</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.gmf.runtime.notation.impl.LocationImpl#getX <em>X</em>}</li> |
| * <li>{@link org.eclipse.gmf.runtime.notation.impl.LocationImpl#getY <em>Y</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| /* |
| * @canBeSeenBy %partners |
| */ |
| public class LocationImpl extends MinimalEObjectImpl.Container implements Location { |
| /** |
| * The default value of the '{@link #getX() <em>X</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getX() |
| * @generated |
| * @ordered |
| */ |
| protected static final int X_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getX() <em>X</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getX() |
| * @generated |
| * @ordered |
| */ |
| protected int x = X_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getY() <em>Y</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getY() |
| * @generated |
| * @ordered |
| */ |
| protected static final int Y_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getY() <em>Y</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getY() |
| * @generated |
| * @ordered |
| */ |
| protected int y = Y_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected LocationImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected EClass eStaticClass() { |
| return NotationPackage.Literals.LOCATION; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public int getX() { |
| return x; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setX(int newX) { |
| int oldX = x; |
| x = newX; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, NotationPackage.LOCATION__X, oldX, x)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public int getY() { |
| return y; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setY(int newY) { |
| int oldY = y; |
| y = newY; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, NotationPackage.LOCATION__Y, oldY, y)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case NotationPackage.LOCATION__X: |
| return new Integer(getX()); |
| case NotationPackage.LOCATION__Y: |
| return new Integer(getY()); |
| } |
| return eDynamicGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case NotationPackage.LOCATION__X: |
| setX(((Integer)newValue).intValue()); |
| return; |
| case NotationPackage.LOCATION__Y: |
| setY(((Integer)newValue).intValue()); |
| return; |
| } |
| eDynamicSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case NotationPackage.LOCATION__X: |
| setX(X_EDEFAULT); |
| return; |
| case NotationPackage.LOCATION__Y: |
| setY(Y_EDEFAULT); |
| return; |
| } |
| eDynamicUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case NotationPackage.LOCATION__X: |
| return x != X_EDEFAULT; |
| case NotationPackage.LOCATION__Y: |
| return y != Y_EDEFAULT; |
| } |
| return eDynamicIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (x: "); //$NON-NLS-1$ |
| result.append(x); |
| result.append(", y: "); //$NON-NLS-1$ |
| result.append(y); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //LocationImpl |