blob: bf897023da0044a4b796cefa55012347edcfe191 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2013, 2019 CEA LIST 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:
* 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.impl.ENotificationImpl;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.examples.codegen.cgmodel.CGExecutorType;
import org.eclipse.ocl.examples.codegen.cgmodel.CGModelPackage;
import org.eclipse.ocl.examples.codegen.cgmodel.CGTypeExp;
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 Type Exp</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.ocl.examples.codegen.cgmodel.impl.CGTypeExpImpl#getExecutorType <em>Executor Type</em>}</li>
* </ul>
*
* @generated
*/
public class CGTypeExpImpl extends CGValuedElementImpl implements CGTypeExp {
/**
* The number of structural features of the '<em>CG Type Exp</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int CG_TYPE_EXP_FEATURE_COUNT = CGValuedElementImpl.CG_VALUED_ELEMENT_FEATURE_COUNT + 1;
/**
* The cached value of the '{@link #getExecutorType() <em>Executor Type</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getExecutorType()
* @generated
* @ordered
*/
protected CGExecutorType executorType;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected CGTypeExpImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return CGModelPackage.Literals.CG_TYPE_EXP;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public CGExecutorType getExecutorType() {
return executorType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setExecutorType(CGExecutorType newExecutorType) {
CGExecutorType oldExecutorType = executorType;
executorType = newExecutorType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, 6, oldExecutorType, executorType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case 6:
return getExecutorType();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case 6:
setExecutorType((CGExecutorType)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case 6:
setExecutorType((CGExecutorType)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case 6:
return executorType != null;
}
return super.eIsSet(featureID);
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public <R> R accept(@NonNull CGModelVisitor<R> visitor) {
return visitor.visitCGTypeExp(this);
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public @NonNull CGValuedElement getSourceValue() {
return executorType != null ? executorType.getSourceValue() : this;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public @NonNull CGValuedElement getNamedValue() {
return executorType != null ? executorType.getNamedValue() : this;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public @NonNull CGValuedElement getReferredValue() {
return executorType != null ? executorType : this;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public @NonNull CGValuedElement getTypedValue() {
return executorType != null ? executorType.getTypedValue() : this;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public @Nullable String getValueName() {
return executorType != null ? executorType.getValueName() : null;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isBoxed() {
return true;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isEcore() {
return false;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public @Nullable Boolean isEquivalentTo(@NonNull CGValuedElement thatValue) {
return executorType != null ? thatValue.isEquivalentTo(executorType) : super.isEquivalentTo(thatValue);
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public @Nullable Boolean isEquivalentToInternal(@NonNull CGValuedElement thatValue) {
return executorType != null ? thatValue.isEquivalentToInternal(executorType) : null;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean isUnboxed() {
return false;
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public boolean rewriteAs(@NonNull CGValuedElement oldValue, @NonNull CGValuedElement newValue) {
if (oldValue == executorType) {
setExecutorType((CGExecutorType)newValue);
return true;
}
return false;
}
} //CGTypeExpImpl