| /** |
| * Copyright (c) 2016 CEA LIST. |
| * |
| * 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: |
| * CEA LIST - Initial API and implementation |
| */ |
| package org.eclipse.papyrus.moka.fmi.modeldescription.impl; |
| |
| import java.util.Collection; |
| |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| import org.eclipse.emf.common.util.EList; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; |
| |
| import org.eclipse.emf.ecore.util.BasicFeatureMap; |
| import org.eclipse.emf.ecore.util.FeatureMap; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.eclipse.papyrus.moka.fmi.modeldescription.Fmi2Annotation; |
| import org.eclipse.papyrus.moka.fmi.modeldescription.FmiPackage; |
| import org.eclipse.papyrus.moka.fmi.modeldescription.ToolType; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Fmi2 Annotation</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.papyrus.moka.fmi.modeldescription.impl.Fmi2AnnotationImpl#getGroup <em>Group</em>}</li> |
| * <li>{@link org.eclipse.papyrus.moka.fmi.modeldescription.impl.Fmi2AnnotationImpl#getTool <em>Tool</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class Fmi2AnnotationImpl extends MinimalEObjectImpl.Container implements Fmi2Annotation { |
| /** |
| * The cached value of the '{@link #getGroup() <em>Group</em>}' attribute list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getGroup() |
| * @generated |
| * @ordered |
| */ |
| protected FeatureMap group; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected Fmi2AnnotationImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FmiPackage.Literals.FMI2_ANNOTATION; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public FeatureMap getGroup() { |
| if (group == null) { |
| group = new BasicFeatureMap(this, FmiPackage.FMI2_ANNOTATION__GROUP); |
| } |
| return group; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<ToolType> getTool() { |
| return getGroup().list(FmiPackage.Literals.FMI2_ANNOTATION__TOOL); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FmiPackage.FMI2_ANNOTATION__GROUP: |
| return ((InternalEList<?>)getGroup()).basicRemove(otherEnd, msgs); |
| case FmiPackage.FMI2_ANNOTATION__TOOL: |
| return ((InternalEList<?>)getTool()).basicRemove(otherEnd, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case FmiPackage.FMI2_ANNOTATION__GROUP: |
| if (coreType) return getGroup(); |
| return ((FeatureMap.Internal)getGroup()).getWrapper(); |
| case FmiPackage.FMI2_ANNOTATION__TOOL: |
| return getTool(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case FmiPackage.FMI2_ANNOTATION__GROUP: |
| ((FeatureMap.Internal)getGroup()).set(newValue); |
| return; |
| case FmiPackage.FMI2_ANNOTATION__TOOL: |
| getTool().clear(); |
| getTool().addAll((Collection<? extends ToolType>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FmiPackage.FMI2_ANNOTATION__GROUP: |
| getGroup().clear(); |
| return; |
| case FmiPackage.FMI2_ANNOTATION__TOOL: |
| getTool().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FmiPackage.FMI2_ANNOTATION__GROUP: |
| return group != null && !group.isEmpty(); |
| case FmiPackage.FMI2_ANNOTATION__TOOL: |
| return !getTool().isEmpty(); |
| } |
| 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(" (group: "); |
| result.append(group); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //Fmi2AnnotationImpl |