1 17 package org.eclipse.emf.ecore.impl; 18 19 20 import org.eclipse.emf.common.notify.Notification; 21 import org.eclipse.emf.common.util.BasicEMap; 22 import org.eclipse.emf.common.util.EMap; 23 import org.eclipse.emf.ecore.EClass; 24 import org.eclipse.emf.ecore.EObject; 25 import org.eclipse.emf.ecore.EStructuralFeature; 26 import org.eclipse.emf.ecore.EcorePackage; 27 28 29 43 public class EStringToStringMapEntryImpl extends EObjectImpl implements BasicEMap.Entry 44 { 45 53 protected static final String KEY_EDEFAULT = null; 54 55 63 protected String key = KEY_EDEFAULT; 64 65 73 protected static final String VALUE_EDEFAULT = null; 74 75 83 protected String value = VALUE_EDEFAULT; 84 85 90 protected EStringToStringMapEntryImpl() 91 { 92 super(); 93 } 94 95 100 protected EClass eStaticClass() 101 { 102 return EcorePackage.eINSTANCE.getEStringToStringMapEntry(); 103 } 104 105 110 public String getTypedKey() 111 { 112 return key; 113 } 114 115 120 public void setTypedKey(String newKey) 121 { 122 String oldKey = key; 123 key = newKey; 124 if (eNotificationRequired()) 125 eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.ESTRING_TO_STRING_MAP_ENTRY__KEY, oldKey, key)); 126 } 127 128 133 public String getTypedValue() 134 { 135 return value; 136 } 137 138 143 public void setTypedValue(String newValue) 144 { 145 String oldValue = value; 146 value = newValue; 147 if (eNotificationRequired()) 148 eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.ESTRING_TO_STRING_MAP_ENTRY__VALUE, oldValue, value)); 149 } 150 151 156 public Object eGet(EStructuralFeature eFeature, boolean resolve) 157 { 158 switch (eDerivedStructuralFeatureID(eFeature)) 159 { 160 case EcorePackage.ESTRING_TO_STRING_MAP_ENTRY__KEY: 161 return getTypedKey(); 162 case EcorePackage.ESTRING_TO_STRING_MAP_ENTRY__VALUE: 163 return getTypedValue(); 164 } 165 return eDynamicGet(eFeature, resolve); 166 } 167 168 173 public void eSet(EStructuralFeature eFeature, Object newValue) 174 { 175 switch (eDerivedStructuralFeatureID(eFeature)) 176 { 177 case EcorePackage.ESTRING_TO_STRING_MAP_ENTRY__KEY: 178 setTypedKey((String )newValue); 179 return; 180 case EcorePackage.ESTRING_TO_STRING_MAP_ENTRY__VALUE: 181 setTypedValue((String )newValue); 182 return; 183 } 184 eDynamicSet(eFeature, newValue); 185 } 186 187 192 public void eUnset(EStructuralFeature eFeature) 193 { 194 switch (eDerivedStructuralFeatureID(eFeature)) 195 { 196 case EcorePackage.ESTRING_TO_STRING_MAP_ENTRY__KEY: 197 setTypedKey(KEY_EDEFAULT); 198 return; 199 case EcorePackage.ESTRING_TO_STRING_MAP_ENTRY__VALUE: 200 setTypedValue(VALUE_EDEFAULT); 201 return; 202 } 203 eDynamicUnset(eFeature); 204 } 205 206 211 public boolean eIsSet(EStructuralFeature eFeature) 212 { 213 switch (eDerivedStructuralFeatureID(eFeature)) 214 { 215 case EcorePackage.ESTRING_TO_STRING_MAP_ENTRY__KEY: 216 return KEY_EDEFAULT == null ? key != null : !KEY_EDEFAULT.equals(key); 217 case EcorePackage.ESTRING_TO_STRING_MAP_ENTRY__VALUE: 218 return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value); 219 } 220 return eDynamicIsSet(eFeature); 221 } 222 223 228 public String toString() 229 { 230 if (eIsProxy()) return super.toString(); 231 232 StringBuffer result = new StringBuffer (super.toString()); 233 result.append(" (key: "); 234 result.append(key); 235 result.append(", value: "); 236 result.append(value); 237 result.append(')'); 238 return result.toString(); 239 } 240 241 246 protected int hash= -1; 247 248 253 public int getHash() 254 { 255 if (hash == -1) 256 { 257 Object theKey = getKey(); 258 hash = (theKey == null ? 0 : theKey.hashCode()); 259 } 260 return hash; 261 } 262 263 268 public void setHash(int hash) 269 { 270 this.hash = hash; 271 } 272 273 278 public Object getKey() 279 { 280 return getTypedKey(); 281 } 282 283 288 public void setKey(Object key) 289 { 290 setTypedKey((String )key); 291 } 292 293 298 public Object getValue() 299 { 300 return getTypedValue(); 301 } 302 303 308 public Object setValue(Object value) 309 { 310 Object oldValue = getValue(); 311 setTypedValue((String )value); 312 return oldValue; 313 } 314 315 320 public EMap getEMap() 321 { 322 EObject container = eContainer(); 323 return container == null ? null : (EMap)container.eGet(eContainmentFeature()); 324 } 325 326 } | Popular Tags |