| /******************************************************************************* |
| * Copyright (c) 2013, 2015 CEA LIST 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: |
| * E.D.Willink(CEA LIST) - Initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.ocl.examples.codegen.cgmodel.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EClassifier; |
| import org.eclipse.emf.ecore.EDataType; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.jdt.annotation.NonNull; |
| import org.eclipse.jdt.annotation.Nullable; |
| import org.eclipse.ocl.examples.codegen.cgmodel.CGEcoreDataTypeShadowExp; |
| import org.eclipse.ocl.examples.codegen.cgmodel.CGModelPackage; |
| import org.eclipse.ocl.examples.codegen.cgmodel.CGValuedElement; |
| import org.eclipse.ocl.examples.codegen.cgmodel.util.CGModelVisitor; |
| import org.eclipse.ocl.examples.codegen.utilities.EquivalenceUtil; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>CG Ecore Data Type Constructor Exp</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.ocl.examples.codegen.cgmodel.impl.CGEcoreDataTypeShadowExpImpl#getEDataType <em>EData Type</em>}</li> |
| * <li>{@link org.eclipse.ocl.examples.codegen.cgmodel.impl.CGEcoreDataTypeShadowExpImpl#getString <em>String</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class CGEcoreDataTypeShadowExpImpl extends CGShadowExpImpl implements CGEcoreDataTypeShadowExp { |
| /** |
| * The cached value of the '{@link #getEDataType() <em>EData Type</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getEDataType() |
| * @generated |
| * @ordered |
| */ |
| protected EDataType eDataType; |
| |
| /** |
| * The default value of the '{@link #getString() <em>String</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getString() |
| * @generated |
| * @ordered |
| */ |
| protected static final String STRING_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getString() <em>String</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getString() |
| * @generated |
| * @ordered |
| */ |
| protected String string = STRING_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected CGEcoreDataTypeShadowExpImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return CGModelPackage.Literals.CG_ECORE_DATA_TYPE_SHADOW_EXP; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EDataType getEDataType() { |
| return eDataType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setEDataType(EDataType newEDataType) { |
| EDataType oldEDataType = eDataType; |
| eDataType = newEDataType; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, CGModelPackage.CG_ECORE_DATA_TYPE_SHADOW_EXP__EDATA_TYPE, oldEDataType, eDataType)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String getString() { |
| return string; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setString(String newString) { |
| String oldString = string; |
| string = newString; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, CGModelPackage.CG_ECORE_DATA_TYPE_SHADOW_EXP__STRING, oldString, string)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| return super.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case CGModelPackage.CG_ECORE_DATA_TYPE_SHADOW_EXP__EDATA_TYPE: |
| return getEDataType(); |
| case CGModelPackage.CG_ECORE_DATA_TYPE_SHADOW_EXP__STRING: |
| return getString(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case CGModelPackage.CG_ECORE_DATA_TYPE_SHADOW_EXP__EDATA_TYPE: |
| setEDataType((EDataType)newValue); |
| return; |
| case CGModelPackage.CG_ECORE_DATA_TYPE_SHADOW_EXP__STRING: |
| setString((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case CGModelPackage.CG_ECORE_DATA_TYPE_SHADOW_EXP__EDATA_TYPE: |
| setEDataType((EDataType)null); |
| return; |
| case CGModelPackage.CG_ECORE_DATA_TYPE_SHADOW_EXP__STRING: |
| setString(STRING_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case CGModelPackage.CG_ECORE_DATA_TYPE_SHADOW_EXP__EDATA_TYPE: |
| return eDataType != null; |
| case CGModelPackage.CG_ECORE_DATA_TYPE_SHADOW_EXP__STRING: |
| return STRING_EDEFAULT == null ? string != null : !STRING_EDEFAULT.equals(string); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public @Nullable <R> R accept(@NonNull CGModelVisitor<R> visitor) { |
| return visitor.visitCGEcoreDataTypeShadowExp(this); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public @Nullable EClassifier getEcoreClassifier() { |
| return eDataType; |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public boolean isBoxed() { |
| return false; |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public boolean isEcore() { |
| return true; |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public @Nullable Boolean isEquivalentToInternal(@NonNull CGValuedElement thatValue) { |
| return (getClass() == thatValue.getClass()) ? EquivalenceUtil.isEquivalent(this, (CGEcoreDataTypeShadowExp)thatValue) : null; |
| } |
| } //CGEcoreDataTypeConstructorExpImpl |