//------------------------------------------------------------------------------ // Copyright (c) 2005, 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 implementation //------------------------------------------------------------------------------ package org.eclipse.epf.uma.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.epf.uma.Dimension; import org.eclipse.epf.uma.UmaPackage; import org.eclipse.epf.uma.ecore.impl.MultiResourceEObject; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Dimension</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.epf.uma.impl.DimensionImpl#getWidth <em>Width</em>}</li> * <li>{@link org.eclipse.epf.uma.impl.DimensionImpl#getHeight <em>Height</em>}</li> * </ul> * </p> * * @generated */ public class DimensionImpl extends MultiResourceEObject implements Dimension { /** * The default value of the '{@link #getWidth() <em>Width</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getWidth() * @generated * @ordered */ protected static final Double WIDTH_EDEFAULT = null; /** * The cached value of the '{@link #getWidth() <em>Width</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getWidth() * @generated * @ordered */ protected Double width = WIDTH_EDEFAULT; /** * The default value of the '{@link #getHeight() <em>Height</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getHeight() * @generated * @ordered */ protected static final Double HEIGHT_EDEFAULT = null; /** * The cached value of the '{@link #getHeight() <em>Height</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getHeight() * @generated * @ordered */ protected Double height = HEIGHT_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected DimensionImpl() { super(); //UMA--> reassignDefaultValues(); //UMA<-- } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return UmaPackage.Literals.DIMENSION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Double getWidth() { return width; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setWidth(Double newWidth) { Double oldWidth = width; width = newWidth; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, UmaPackage.DIMENSION__WIDTH, oldWidth, width)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Double getHeight() { return height; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setHeight(Double newHeight) { Double oldHeight = height; height = newHeight; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, UmaPackage.DIMENSION__HEIGHT, oldHeight, height)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case UmaPackage.DIMENSION__WIDTH: return getWidth(); case UmaPackage.DIMENSION__HEIGHT: return getHeight(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case UmaPackage.DIMENSION__WIDTH: setWidth((Double) newValue); return; case UmaPackage.DIMENSION__HEIGHT: setHeight((Double) newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case UmaPackage.DIMENSION__WIDTH: setWidth(WIDTH_EDEFAULT); return; case UmaPackage.DIMENSION__HEIGHT: setHeight(HEIGHT_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { //UMA--> EStructuralFeature feature = getFeatureWithOverridenDefaultValue(featureID); if (feature != null) { return isFeatureWithOverridenDefaultValueSet(feature); } //UMA<-- switch (featureID) { case UmaPackage.DIMENSION__WIDTH: return WIDTH_EDEFAULT == null ? width != null : !WIDTH_EDEFAULT .equals(width); case UmaPackage.DIMENSION__HEIGHT: return HEIGHT_EDEFAULT == null ? height != null : !HEIGHT_EDEFAULT .equals(height); } 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(" (width: "); //$NON-NLS-1$ result.append(width); result.append(", height: "); //$NON-NLS-1$ result.append(height); result.append(')'); return result.toString(); } } //DimensionImpl