| /******************************************************************************* |
| * Copyright (c) 2007, 2018 IBM Corporation, Zeligsoft Inc., and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v2.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v20.html |
| * |
| * Contributors: |
| * IBM - Initial API and implementation |
| * Zeligsoft - Bugs 241426, 207365 |
| *******************************************************************************/ |
| package org.eclipse.ocl.ecore.impl; |
| |
| import java.util.Map; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.util.DiagnosticChain; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EClassifier; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.ocl.ecore.EcorePackage; |
| import org.eclipse.ocl.ecore.RealLiteralExp; |
| import org.eclipse.ocl.expressions.ExpressionsPackage; |
| import org.eclipse.ocl.expressions.operations.RealLiteralExpOperations; |
| import org.eclipse.ocl.utilities.Visitor; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Real Literal Exp</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.ocl.ecore.impl.RealLiteralExpImpl#getRealSymbol <em>Real Symbol</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class RealLiteralExpImpl |
| extends NumericLiteralExpImpl |
| implements RealLiteralExp { |
| |
| /** |
| * The default value of the '{@link #getRealSymbol() <em>Real Symbol</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRealSymbol() |
| * @generated |
| * @ordered |
| */ |
| protected static final Double REAL_SYMBOL_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getRealSymbol() <em>Real Symbol</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRealSymbol() |
| * @generated |
| * @ordered |
| */ |
| protected Double realSymbol = REAL_SYMBOL_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected RealLiteralExpImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return EcorePackage.Literals.REAL_LITERAL_EXP; |
| } |
| |
| /** |
| * @generated NOT |
| */ |
| @Override |
| @SuppressWarnings("unchecked") |
| public <T, U extends Visitor<T, ?, ?, ?, ?, ?, ?, ?, ?, ?>> T accept(U v) { |
| return ((Visitor<T, EClassifier, ?, ?, ?, ?, ?, ?, ?, ?>) v) |
| .visitRealLiteralExp(this); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Double getRealSymbol() { |
| return realSymbol; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setRealSymbol(Double newRealSymbol) { |
| Double oldRealSymbol = realSymbol; |
| realSymbol = newRealSymbol; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, |
| EcorePackage.REAL_LITERAL_EXP__REAL_SYMBOL, oldRealSymbol, |
| realSymbol)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated NOT |
| */ |
| public boolean checkRealType(DiagnosticChain diagnostics, |
| Map<Object, Object> context) { |
| return RealLiteralExpOperations.checkRealType(this, diagnostics, |
| context); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case EcorePackage.REAL_LITERAL_EXP__REAL_SYMBOL : |
| return getRealSymbol(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case EcorePackage.REAL_LITERAL_EXP__REAL_SYMBOL : |
| setRealSymbol((Double) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case EcorePackage.REAL_LITERAL_EXP__REAL_SYMBOL : |
| setRealSymbol(REAL_SYMBOL_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case EcorePackage.REAL_LITERAL_EXP__REAL_SYMBOL : |
| return REAL_SYMBOL_EDEFAULT == null |
| ? realSymbol != null |
| : !REAL_SYMBOL_EDEFAULT.equals(realSymbol); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public int eBaseStructuralFeatureID(int derivedFeatureID, |
| Class<?> baseClass) { |
| if (baseClass == org.eclipse.ocl.expressions.RealLiteralExp.class) { |
| switch (derivedFeatureID) { |
| case EcorePackage.REAL_LITERAL_EXP__REAL_SYMBOL : |
| return ExpressionsPackage.REAL_LITERAL_EXP__REAL_SYMBOL; |
| default : |
| return -1; |
| } |
| } |
| return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public int eDerivedStructuralFeatureID(int baseFeatureID, |
| Class<?> baseClass) { |
| if (baseClass == org.eclipse.ocl.expressions.RealLiteralExp.class) { |
| switch (baseFeatureID) { |
| case ExpressionsPackage.REAL_LITERAL_EXP__REAL_SYMBOL : |
| return EcorePackage.REAL_LITERAL_EXP__REAL_SYMBOL; |
| default : |
| return -1; |
| } |
| } |
| return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated NOT |
| */ |
| @Override |
| public String toString() { |
| return super.toString(); |
| } |
| |
| } //RealLiteralExpImpl |