/******************************************************************************* * 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.impl.ENotificationImpl; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.ocl.examples.codegen.cgmodel.CGConstantExp; 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; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>CG Constant Exp</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link org.eclipse.ocl.examples.codegen.cgmodel.impl.CGConstantExpImpl#getReferredConstant <em>Referred Constant</em>}</li> * </ul> * * @generated */ public class CGConstantExpImpl extends CGValuedElementImpl implements CGConstantExp { /** * The cached value of the '{@link #getReferredConstant() <em>Referred Constant</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getReferredConstant() * @generated * @ordered */ protected CGValuedElement referredConstant; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected CGConstantExpImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return CGModelPackage.Literals.CG_CONSTANT_EXP; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public CGValuedElement getReferredConstant() { return referredConstant; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setReferredConstant(CGValuedElement newReferredConstant) { CGValuedElement oldReferredConstant = referredConstant; referredConstant = newReferredConstant; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, CGModelPackage.CG_CONSTANT_EXP__REFERRED_CONSTANT, oldReferredConstant, referredConstant)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case CGModelPackage.CG_CONSTANT_EXP__REFERRED_CONSTANT: return getReferredConstant(); } 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_CONSTANT_EXP__REFERRED_CONSTANT: setReferredConstant((CGValuedElement)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case CGModelPackage.CG_CONSTANT_EXP__REFERRED_CONSTANT: setReferredConstant((CGValuedElement)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case CGModelPackage.CG_CONSTANT_EXP__REFERRED_CONSTANT: return referredConstant != null; } return super.eIsSet(featureID); } /** * {@inheritDoc} * @generated */ @Override public <R> R accept(@NonNull CGModelVisitor<R> visitor) { return visitor.visitCGConstantExp(this); } /** * {@inheritDoc} * @generated */ @Override public @Nullable EClassifier getEcoreClassifier() { return referredConstant != null ? referredConstant.getEcoreClassifier() : null; } /** * {@inheritDoc} * @generated */ @Override public @NonNull CGValuedElement getSourceValue() { return referredConstant != null ? referredConstant.getSourceValue() : this; } /** * {@inheritDoc} * @generated */ @Override public @NonNull CGValuedElement getThisValue() { return referredConstant != null ? referredConstant.getNamedValue() : this; } /** * {@inheritDoc} * @generated */ @Override public @NonNull CGValuedElement getNamedValue() { return referredConstant != null ? referredConstant.getNamedValue() : this; } /** * {@inheritDoc} * @generated */ @Override public @NonNull CGValuedElement getReferredValue() { return referredConstant != null ? referredConstant : this; } /** * {@inheritDoc} * @generated */ @Override public @NonNull CGValuedElement getTypedValue() { return referredConstant != null ? referredConstant.getTypedValue() : this; } /** * {@inheritDoc} * @generated */ @Override public @Nullable String getValueName() { return referredConstant != null ? referredConstant.getValueName() : null; } /** * {@inheritDoc} * @generated */ @Override public boolean isBoxed() { return (referredConstant != null) && referredConstant.isBoxed(); } /** * {@inheritDoc} * @generated */ @Override public boolean isCommonable() { return (referredConstant != null) && referredConstant.isCommonable(); } /** * {@inheritDoc} * @generated */ @Override public boolean isEcore() { return (referredConstant != null) && referredConstant.isEcore(); } /** * {@inheritDoc} * @generated */ @Override public boolean isGlobal() { return (referredConstant != null) && referredConstant.isGlobal(); } /** * {@inheritDoc} * @generated */ @Override public @Nullable Boolean isEquivalentTo(@NonNull CGValuedElement thatValue) { return referredConstant != null ? thatValue.isEquivalentTo(referredConstant) : super.isEquivalentTo(thatValue); } /** * {@inheritDoc} * @generated */ @Override public @Nullable Boolean isEquivalentToInternal(@NonNull CGValuedElement thatValue) { return referredConstant != null ? thatValue.isEquivalentToInternal(referredConstant) : null; } /** * {@inheritDoc} * @generated */ @Override public boolean isUnboxed() { return (referredConstant != null) && referredConstant.isUnboxed(); } /** * {@inheritDoc} * @generated */ @Override public boolean isUncommonable() { return (referredConstant != null) && referredConstant.isUncommonable(); } } //CGConstantExpImpl