/* * Copyright (c) 2003- michael lawley and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation * which accompanies this distribution, and is available by writing to * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * michael lawley * * * $Id$ */ package tefkat.data.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.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.ENotificationImpl; import org.eclipse.emf.ecore.impl.EObjectImpl; import org.eclipse.emf.ecore.util.EcoreEMap; import org.eclipse.emf.ecore.util.InternalEList; import tefkat.data.DataMap; import tefkat.data.DataPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Map</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link tefkat.data.impl.DataMapImpl#getKey <em>Key</em>}</li> * <li>{@link tefkat.data.impl.DataMapImpl#getValue <em>Value</em>}</li> * </ul> * </p> * * @generated */ public class DataMapImpl extends EObjectImpl implements DataMap { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final String copyright = "Copyright michael lawley 2005"; /** * The default value of the '{@link #getKey() <em>Key</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getKey() * @generated * @ordered */ protected static final String KEY_EDEFAULT = null; /** * The cached value of the '{@link #getKey() <em>Key</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getKey() * @generated * @ordered */ protected String key = KEY_EDEFAULT; /** * The cached value of the '{@link #getValue() <em>Value</em>}' map. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getValue() * @generated * @ordered */ protected EMap value = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected DataMapImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected EClass eStaticClass() { return DataPackage.eINSTANCE.getDataMap(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getKey() { return key; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setKey(String newKey) { String oldKey = key; key = newKey; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, DataPackage.DATA_MAP__KEY, oldKey, key)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EMap getValue() { if (value == null) { value = new EcoreEMap(DataPackage.eINSTANCE.getDataEntry(), DataEntryImpl.class, this, DataPackage.DATA_MAP__VALUE); } return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { if (featureID >= 0) { switch (eDerivedStructuralFeatureID(featureID, baseClass)) { case DataPackage.DATA_MAP__VALUE: return ((InternalEList)getValue()).basicRemove(otherEnd, msgs); default: return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); } } return eBasicSetContainer(null, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Object eGet(EStructuralFeature eFeature, boolean resolve) { switch (eDerivedStructuralFeatureID(eFeature)) { case DataPackage.DATA_MAP__KEY: return getKey(); case DataPackage.DATA_MAP__VALUE: return getValue(); } return eDynamicGet(eFeature, resolve); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eSet(EStructuralFeature eFeature, Object newValue) { switch (eDerivedStructuralFeatureID(eFeature)) { case DataPackage.DATA_MAP__KEY: setKey((String)newValue); return; case DataPackage.DATA_MAP__VALUE: getValue().clear(); getValue().addAll((Collection)newValue); return; } eDynamicSet(eFeature, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eUnset(EStructuralFeature eFeature) { switch (eDerivedStructuralFeatureID(eFeature)) { case DataPackage.DATA_MAP__KEY: setKey(KEY_EDEFAULT); return; case DataPackage.DATA_MAP__VALUE: getValue().clear(); return; } eDynamicUnset(eFeature); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean eIsSet(EStructuralFeature eFeature) { switch (eDerivedStructuralFeatureID(eFeature)) { case DataPackage.DATA_MAP__KEY: return KEY_EDEFAULT == null ? key != null : !KEY_EDEFAULT.equals(key); case DataPackage.DATA_MAP__VALUE: return value != null && !value.isEmpty(); } return eDynamicIsSet(eFeature); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (key: "); result.append(key); result.append(')'); return result.toString(); } } //DataMapImpl