| /** |
| * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Florian Pirchner - Initial implementation |
| */ |
| package org.eclipse.osbp.ecview.core.extension.model.datatypes.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.osbp.ecview.core.extension.model.datatypes.ExtDatatypesPackage; |
| import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDecimalDatatype; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>YDecimal Datatype</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.osbp.ecview.core.extension.model.datatypes.impl.YDecimalDatatypeImpl#getPrecision <em>Precision</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class YDecimalDatatypeImpl extends YNumericDatatypeImpl implements YDecimalDatatype { |
| /** |
| * The default value of the '{@link #getPrecision() <em>Precision</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPrecision() |
| * @generated |
| * @ordered |
| */ |
| protected static final int PRECISION_EDEFAULT = 2; |
| |
| /** |
| * The cached value of the '{@link #getPrecision() <em>Precision</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPrecision() |
| * @generated |
| * @ordered |
| */ |
| protected int precision = PRECISION_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected YDecimalDatatypeImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ExtDatatypesPackage.Literals.YDECIMAL_DATATYPE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public int getPrecision() { |
| return precision; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setPrecision(int newPrecision) { |
| int oldPrecision = precision; |
| precision = newPrecision; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ExtDatatypesPackage.YDECIMAL_DATATYPE__PRECISION, oldPrecision, precision)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case ExtDatatypesPackage.YDECIMAL_DATATYPE__PRECISION: |
| return getPrecision(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case ExtDatatypesPackage.YDECIMAL_DATATYPE__PRECISION: |
| setPrecision((Integer)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ExtDatatypesPackage.YDECIMAL_DATATYPE__PRECISION: |
| setPrecision(PRECISION_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ExtDatatypesPackage.YDECIMAL_DATATYPE__PRECISION: |
| return precision != PRECISION_EDEFAULT; |
| } |
| 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(" (precision: "); |
| result.append(precision); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //YDecimalDatatypeImpl |