| /** |
| * Copyright (c) 2016 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: |
| * CEA LIST - Initial API and implementation |
| * |
| */ |
| package org.omg.smm.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.omg.smm.DimensionalMeasure; |
| import org.omg.smm.SmmPackage; |
| import org.omg.smm.UnitOfMeasure; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Dimensional Measure</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.omg.smm.impl.DimensionalMeasureImpl#getUnit <em>Unit</em>}</li> |
| * <li>{@link org.omg.smm.impl.DimensionalMeasureImpl#getFormula <em>Formula</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public abstract class DimensionalMeasureImpl extends MeasureImpl implements DimensionalMeasure { |
| /** |
| * The cached value of the '{@link #getUnit() <em>Unit</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getUnit() |
| * @generated |
| * @ordered |
| */ |
| protected UnitOfMeasure unit; |
| |
| /** |
| * The default value of the '{@link #getFormula() <em>Formula</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFormula() |
| * @generated |
| * @ordered |
| */ |
| protected static final String FORMULA_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getFormula() <em>Formula</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFormula() |
| * @generated |
| * @ordered |
| */ |
| protected String formula = FORMULA_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected DimensionalMeasureImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return SmmPackage.Literals.DIMENSIONAL_MEASURE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public UnitOfMeasure getUnit() { |
| if (unit != null && unit.eIsProxy()) { |
| InternalEObject oldUnit = (InternalEObject)unit; |
| unit = (UnitOfMeasure)eResolveProxy(oldUnit); |
| if (unit != oldUnit) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, SmmPackage.DIMENSIONAL_MEASURE__UNIT, oldUnit, unit)); |
| } |
| } |
| return unit; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public UnitOfMeasure basicGetUnit() { |
| return unit; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setUnit(UnitOfMeasure newUnit) { |
| UnitOfMeasure oldUnit = unit; |
| unit = newUnit; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, SmmPackage.DIMENSIONAL_MEASURE__UNIT, oldUnit, unit)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getFormula() { |
| return formula; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setFormula(String newFormula) { |
| String oldFormula = formula; |
| formula = newFormula; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, SmmPackage.DIMENSIONAL_MEASURE__FORMULA, oldFormula, formula)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case SmmPackage.DIMENSIONAL_MEASURE__UNIT: |
| if (resolve) return getUnit(); |
| return basicGetUnit(); |
| case SmmPackage.DIMENSIONAL_MEASURE__FORMULA: |
| return getFormula(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case SmmPackage.DIMENSIONAL_MEASURE__UNIT: |
| setUnit((UnitOfMeasure)newValue); |
| return; |
| case SmmPackage.DIMENSIONAL_MEASURE__FORMULA: |
| setFormula((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case SmmPackage.DIMENSIONAL_MEASURE__UNIT: |
| setUnit((UnitOfMeasure)null); |
| return; |
| case SmmPackage.DIMENSIONAL_MEASURE__FORMULA: |
| setFormula(FORMULA_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case SmmPackage.DIMENSIONAL_MEASURE__UNIT: |
| return unit != null; |
| case SmmPackage.DIMENSIONAL_MEASURE__FORMULA: |
| return FORMULA_EDEFAULT == null ? formula != null : !FORMULA_EDEFAULT.equals(formula); |
| } |
| 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(" (formula: "); |
| result.append(formula); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //DimensionalMeasureImpl |