| /** |
| * 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.Notification; |
| 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.ENotificationImpl; |
| 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.EnumerationType1; |
| import org.eclipse.papyrus.moka.fmi.modeldescription.FmiPackage; |
| import org.eclipse.papyrus.moka.fmi.modeldescription.ItemType; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Enumeration Type1</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.papyrus.moka.fmi.modeldescription.impl.EnumerationType1Impl#getGroup <em>Group</em>}</li> |
| * <li>{@link org.eclipse.papyrus.moka.fmi.modeldescription.impl.EnumerationType1Impl#getItem <em>Item</em>}</li> |
| * <li>{@link org.eclipse.papyrus.moka.fmi.modeldescription.impl.EnumerationType1Impl#getQuantity <em>Quantity</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class EnumerationType1Impl extends MinimalEObjectImpl.Container implements EnumerationType1 { |
| /** |
| * 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; |
| |
| /** |
| * The default value of the '{@link #getQuantity() <em>Quantity</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getQuantity() |
| * @generated |
| * @ordered |
| */ |
| protected static final String QUANTITY_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getQuantity() <em>Quantity</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getQuantity() |
| * @generated |
| * @ordered |
| */ |
| protected String quantity = QUANTITY_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected EnumerationType1Impl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FmiPackage.Literals.ENUMERATION_TYPE1; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public FeatureMap getGroup() { |
| if (group == null) { |
| group = new BasicFeatureMap(this, FmiPackage.ENUMERATION_TYPE1__GROUP); |
| } |
| return group; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<ItemType> getItem() { |
| return getGroup().list(FmiPackage.Literals.ENUMERATION_TYPE1__ITEM); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getQuantity() { |
| return quantity; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setQuantity(String newQuantity) { |
| String oldQuantity = quantity; |
| quantity = newQuantity; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FmiPackage.ENUMERATION_TYPE1__QUANTITY, oldQuantity, quantity)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FmiPackage.ENUMERATION_TYPE1__GROUP: |
| return ((InternalEList<?>)getGroup()).basicRemove(otherEnd, msgs); |
| case FmiPackage.ENUMERATION_TYPE1__ITEM: |
| return ((InternalEList<?>)getItem()).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.ENUMERATION_TYPE1__GROUP: |
| if (coreType) return getGroup(); |
| return ((FeatureMap.Internal)getGroup()).getWrapper(); |
| case FmiPackage.ENUMERATION_TYPE1__ITEM: |
| return getItem(); |
| case FmiPackage.ENUMERATION_TYPE1__QUANTITY: |
| return getQuantity(); |
| } |
| 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.ENUMERATION_TYPE1__GROUP: |
| ((FeatureMap.Internal)getGroup()).set(newValue); |
| return; |
| case FmiPackage.ENUMERATION_TYPE1__ITEM: |
| getItem().clear(); |
| getItem().addAll((Collection<? extends ItemType>)newValue); |
| return; |
| case FmiPackage.ENUMERATION_TYPE1__QUANTITY: |
| setQuantity((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FmiPackage.ENUMERATION_TYPE1__GROUP: |
| getGroup().clear(); |
| return; |
| case FmiPackage.ENUMERATION_TYPE1__ITEM: |
| getItem().clear(); |
| return; |
| case FmiPackage.ENUMERATION_TYPE1__QUANTITY: |
| setQuantity(QUANTITY_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FmiPackage.ENUMERATION_TYPE1__GROUP: |
| return group != null && !group.isEmpty(); |
| case FmiPackage.ENUMERATION_TYPE1__ITEM: |
| return !getItem().isEmpty(); |
| case FmiPackage.ENUMERATION_TYPE1__QUANTITY: |
| return QUANTITY_EDEFAULT == null ? quantity != null : !QUANTITY_EDEFAULT.equals(quantity); |
| } |
| 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(", quantity: "); |
| result.append(quantity); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //EnumerationType1Impl |