| /** |
| * Copyright (c) 2013, 2017 CEA LIST & LIFL |
| * |
| * 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: |
| * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation |
| * Quentin Le Menez quentin.lemenez@cea.fr |
| * |
| */ |
| package org.eclipse.papyrus.internal.infra.gmfdiag.layers.model.layers.impl; |
| |
| import java.util.Map; |
| |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| import org.eclipse.emf.common.util.EMap; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EStructuralFeature; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.EObjectImpl; |
| |
| import org.eclipse.emf.ecore.util.EcoreEMap; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.eclipse.papyrus.internal.infra.gmfdiag.layers.model.layers.LayersPackage; |
| import org.eclipse.papyrus.internal.infra.gmfdiag.layers.model.layers.Type; |
| import org.eclipse.papyrus.internal.infra.gmfdiag.layers.model.layers.TypeRegistry; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Type Registry</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.papyrus.internal.infra.gmfdiag.layers.model.layers.impl.TypeRegistryImpl#getTypes <em>Types</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class TypeRegistryImpl extends EObjectImpl implements TypeRegistry { |
| /** |
| * The cached value of the '{@link #getTypes() <em>Types</em>}' map. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTypes() |
| * @generated |
| * @ordered |
| */ |
| protected EMap<String, Type> types; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected TypeRegistryImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return LayersPackage.Literals.TYPE_REGISTRY; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Map<String, Type> getTypes() { |
| if (types == null) { |
| types = new EcoreEMap<String,Type>(LayersPackage.Literals.STRING_TO_TYPE_MAP, StringToTypeMapImpl.class, this, LayersPackage.TYPE_REGISTRY__TYPES); |
| } |
| return types.map(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case LayersPackage.TYPE_REGISTRY__TYPES: |
| return ((InternalEList<?>)((EMap.InternalMapView<String, Type>)getTypes()).eMap()).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 LayersPackage.TYPE_REGISTRY__TYPES: |
| if (coreType) return ((EMap.InternalMapView<String, Type>)getTypes()).eMap(); |
| else return getTypes(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case LayersPackage.TYPE_REGISTRY__TYPES: |
| ((EStructuralFeature.Setting)((EMap.InternalMapView<String, Type>)getTypes()).eMap()).set(newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case LayersPackage.TYPE_REGISTRY__TYPES: |
| getTypes().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case LayersPackage.TYPE_REGISTRY__TYPES: |
| return types != null && !types.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //TypeRegistryImpl |