| /***************************************************************************** |
| * Copyright (c) 2009 CEA LIST. |
| * |
| * |
| * 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: |
| * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation |
| * |
| *****************************************************************************/ |
| package org.eclipse.papyrus.sysml.blocks.internal.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; |
| import org.eclipse.papyrus.sysml.blocks.BlocksPackage; |
| import org.eclipse.papyrus.sysml.blocks.Dimension; |
| import org.eclipse.papyrus.sysml.blocks.Unit; |
| import org.eclipse.papyrus.sysml.blocks.ValueType; |
| import org.eclipse.uml2.uml.DataType; |
| |
| /** |
| * <!-- begin-user-doc --> An implementation of the model object ' <em><b>Value Type</b></em>'. <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.papyrus.sysml.blocks.internal.impl.ValueTypeImpl#getBase_DataType <em>Base Data Type</em>}</li> |
| * <li>{@link org.eclipse.papyrus.sysml.blocks.internal.impl.ValueTypeImpl#getUnit <em>Unit</em>}</li> |
| * <li>{@link org.eclipse.papyrus.sysml.blocks.internal.impl.ValueTypeImpl#getDimension <em>Dimension</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class ValueTypeImpl extends MinimalEObjectImpl.Container implements ValueType { |
| |
| /** |
| * The cached value of the '{@link #getBase_DataType() <em>Base Data Type</em>}' reference. |
| * <!-- begin-user-doc --> <!-- |
| * end-user-doc --> |
| * |
| * @see #getBase_DataType() |
| * @generated |
| * @ordered |
| */ |
| protected DataType base_DataType; |
| |
| /** |
| * The cached value of the '{@link #getUnit() <em>Unit</em>}' reference. |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @see #getUnit() |
| * @generated |
| * @ordered |
| */ |
| protected Unit unit; |
| |
| /** |
| * The cached value of the '{@link #getDimension() <em>Dimension</em>}' reference. |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @see #getDimension() |
| * @generated |
| * @ordered |
| */ |
| protected Dimension dimension; |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| protected ValueTypeImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public DataType basicGetBase_DataType() { |
| return base_DataType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public Dimension basicGetDimension() { |
| return dimension; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public Unit basicGetUnit() { |
| return unit; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case BlocksPackage.VALUE_TYPE__BASE_DATA_TYPE: |
| if (resolve) { |
| return getBase_DataType(); |
| } |
| return basicGetBase_DataType(); |
| case BlocksPackage.VALUE_TYPE__UNIT: |
| if (resolve) { |
| return getUnit(); |
| } |
| return basicGetUnit(); |
| case BlocksPackage.VALUE_TYPE__DIMENSION: |
| if (resolve) { |
| return getDimension(); |
| } |
| return basicGetDimension(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case BlocksPackage.VALUE_TYPE__BASE_DATA_TYPE: |
| return base_DataType != null; |
| case BlocksPackage.VALUE_TYPE__UNIT: |
| return unit != null; |
| case BlocksPackage.VALUE_TYPE__DIMENSION: |
| return dimension != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case BlocksPackage.VALUE_TYPE__BASE_DATA_TYPE: |
| setBase_DataType((DataType) newValue); |
| return; |
| case BlocksPackage.VALUE_TYPE__UNIT: |
| setUnit((Unit) newValue); |
| return; |
| case BlocksPackage.VALUE_TYPE__DIMENSION: |
| setDimension((Dimension) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return BlocksPackage.Literals.VALUE_TYPE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case BlocksPackage.VALUE_TYPE__BASE_DATA_TYPE: |
| setBase_DataType((DataType) null); |
| return; |
| case BlocksPackage.VALUE_TYPE__UNIT: |
| setUnit((Unit) null); |
| return; |
| case BlocksPackage.VALUE_TYPE__DIMENSION: |
| setDimension((Dimension) null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public DataType getBase_DataType() { |
| if (base_DataType != null && base_DataType.eIsProxy()) { |
| InternalEObject oldBase_DataType = (InternalEObject) base_DataType; |
| base_DataType = (DataType) eResolveProxy(oldBase_DataType); |
| if (base_DataType != oldBase_DataType) { |
| if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, BlocksPackage.VALUE_TYPE__BASE_DATA_TYPE, oldBase_DataType, base_DataType)); |
| } |
| } |
| } |
| return base_DataType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public Dimension getDimension() { |
| if (dimension != null && dimension.eIsProxy()) { |
| InternalEObject oldDimension = (InternalEObject) dimension; |
| dimension = (Dimension) eResolveProxy(oldDimension); |
| if (dimension != oldDimension) { |
| if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, BlocksPackage.VALUE_TYPE__DIMENSION, oldDimension, dimension)); |
| } |
| } |
| } |
| return dimension; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public Unit getUnit() { |
| if (unit != null && unit.eIsProxy()) { |
| InternalEObject oldUnit = (InternalEObject) unit; |
| unit = (Unit) eResolveProxy(oldUnit); |
| if (unit != oldUnit) { |
| if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, BlocksPackage.VALUE_TYPE__UNIT, oldUnit, unit)); |
| } |
| } |
| } |
| return unit; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setBase_DataType(DataType newBase_DataType) { |
| DataType oldBase_DataType = base_DataType; |
| base_DataType = newBase_DataType; |
| if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.SET, BlocksPackage.VALUE_TYPE__BASE_DATA_TYPE, oldBase_DataType, base_DataType)); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setDimension(Dimension newDimension) { |
| Dimension oldDimension = dimension; |
| dimension = newDimension; |
| if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.SET, BlocksPackage.VALUE_TYPE__DIMENSION, oldDimension, dimension)); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setUnit(Unit newUnit) { |
| Unit oldUnit = unit; |
| unit = newUnit; |
| if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.SET, BlocksPackage.VALUE_TYPE__UNIT, oldUnit, unit)); |
| } |
| } |
| |
| } // ValueTypeImpl |