KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > ecore > impl > EStringToStringMapEntryImpl


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2002-2004 IBM Corporation and others.
5  * All rights reserved. This program and the accompanying materials
6  * are made available under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution, and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  * IBM - Initial API and implementation
12  *
13  * </copyright>
14  *
15  * $Id: EStringToStringMapEntryImpl.java,v 1.3 2005/06/08 06:20:10 nickb Exp $
16  */

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 /**
30  * <!-- begin-user-doc -->
31  * An implementation of the model object '<em><b>EString To String Map Entry</b></em>'.
32  * <!-- end-user-doc -->
33  * <p>
34  * The following features are implemented:
35  * <ul>
36  * <li>{@link org.eclipse.emf.ecore.impl.EStringToStringMapEntryImpl#getTypedKey <em>Key</em>}</li>
37  * <li>{@link org.eclipse.emf.ecore.impl.EStringToStringMapEntryImpl#getTypedValue <em>Value</em>}</li>
38  * </ul>
39  * </p>
40  *
41  * @generated
42  */

43 public class EStringToStringMapEntryImpl extends EObjectImpl implements BasicEMap.Entry
44 {
45   /**
46    * The default value of the '{@link #getTypedKey() <em>Key</em>}' attribute.
47    * <!-- begin-user-doc -->
48    * <!-- end-user-doc -->
49    * @see #getTypedKey()
50    * @generated
51    * @ordered
52    */

53   protected static final String JavaDoc KEY_EDEFAULT = null;
54
55   /**
56    * The cached value of the '{@link #getTypedKey() <em>Key</em>}' attribute.
57    * <!-- begin-user-doc -->
58    * <!-- end-user-doc -->
59    * @see #getTypedKey()
60    * @generated
61    * @ordered
62    */

63   protected String JavaDoc key = KEY_EDEFAULT;
64
65   /**
66    * The default value of the '{@link #getTypedValue() <em>Value</em>}' attribute.
67    * <!-- begin-user-doc -->
68    * <!-- end-user-doc -->
69    * @see #getTypedValue()
70    * @generated
71    * @ordered
72    */

73   protected static final String JavaDoc VALUE_EDEFAULT = null;
74
75   /**
76    * The cached value of the '{@link #getTypedValue() <em>Value</em>}' attribute.
77    * <!-- begin-user-doc -->
78    * <!-- end-user-doc -->
79    * @see #getTypedValue()
80    * @generated
81    * @ordered
82    */

83   protected String JavaDoc value = VALUE_EDEFAULT;
84
85   /**
86    * <!-- begin-user-doc -->
87    * <!-- end-user-doc -->
88    * @generated
89    */

90   protected EStringToStringMapEntryImpl()
91   {
92     super();
93   }
94
95   /**
96    * <!-- begin-user-doc -->
97    * <!-- end-user-doc -->
98    * @generated
99    */

100   protected EClass eStaticClass()
101   {
102     return EcorePackage.eINSTANCE.getEStringToStringMapEntry();
103   }
104
105   /**
106    * <!-- begin-user-doc -->
107    * <!-- end-user-doc -->
108    * @generated
109    */

110   public String JavaDoc getTypedKey()
111   {
112     return key;
113   }
114
115   /**
116    * <!-- begin-user-doc -->
117    * <!-- end-user-doc -->
118    * @generated
119    */

120   public void setTypedKey(String JavaDoc newKey)
121   {
122     String JavaDoc 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   /**
129    * <!-- begin-user-doc -->
130    * <!-- end-user-doc -->
131    * @generated
132    */

133   public String JavaDoc getTypedValue()
134   {
135     return value;
136   }
137
138   /**
139    * <!-- begin-user-doc -->
140    * <!-- end-user-doc -->
141    * @generated
142    */

143   public void setTypedValue(String JavaDoc newValue)
144   {
145     String JavaDoc 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   /**
152    * <!-- begin-user-doc -->
153    * <!-- end-user-doc -->
154    * @generated
155    */

156   public Object JavaDoc 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   /**
169    * <!-- begin-user-doc -->
170    * <!-- end-user-doc -->
171    * @generated
172    */

173   public void eSet(EStructuralFeature eFeature, Object JavaDoc newValue)
174   {
175     switch (eDerivedStructuralFeatureID(eFeature))
176     {
177       case EcorePackage.ESTRING_TO_STRING_MAP_ENTRY__KEY:
178         setTypedKey((String JavaDoc)newValue);
179         return;
180       case EcorePackage.ESTRING_TO_STRING_MAP_ENTRY__VALUE:
181         setTypedValue((String JavaDoc)newValue);
182         return;
183     }
184     eDynamicSet(eFeature, newValue);
185   }
186
187   /**
188    * <!-- begin-user-doc -->
189    * <!-- end-user-doc -->
190    * @generated
191    */

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   /**
207    * <!-- begin-user-doc -->
208    * <!-- end-user-doc -->
209    * @generated
210    */

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   /**
224    * <!-- begin-user-doc -->
225    * <!-- end-user-doc -->
226    * @generated
227    */

228   public String JavaDoc toString()
229   {
230     if (eIsProxy()) return super.toString();
231
232     StringBuffer JavaDoc result = new StringBuffer JavaDoc(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   /**
242    * <!-- begin-user-doc -->
243    * <!-- end-user-doc -->
244    * @generated
245    */

246   protected int hash= -1;
247
248   /**
249    * <!-- begin-user-doc -->
250    * <!-- end-user-doc -->
251    * @generated
252    */

253   public int getHash()
254   {
255     if (hash == -1)
256     {
257       Object JavaDoc theKey = getKey();
258       hash = (theKey == null ? 0 : theKey.hashCode());
259     }
260     return hash;
261   }
262
263   /**
264    * <!-- begin-user-doc -->
265    * <!-- end-user-doc -->
266    * @generated
267    */

268   public void setHash(int hash)
269   {
270     this.hash = hash;
271   }
272
273   /**
274    * <!-- begin-user-doc -->
275    * <!-- end-user-doc -->
276    * @generated
277    */

278   public Object JavaDoc getKey()
279   {
280     return getTypedKey();
281   }
282
283   /**
284    * <!-- begin-user-doc -->
285    * <!-- end-user-doc -->
286    * @generated
287    */

288   public void setKey(Object JavaDoc key)
289   {
290     setTypedKey((String JavaDoc)key);
291   }
292
293   /**
294    * <!-- begin-user-doc -->
295    * <!-- end-user-doc -->
296    * @generated
297    */

298   public Object JavaDoc getValue()
299   {
300     return getTypedValue();
301   }
302
303   /**
304    * <!-- begin-user-doc -->
305    * <!-- end-user-doc -->
306    * @generated
307    */

308   public Object JavaDoc setValue(Object JavaDoc value)
309   {
310     Object JavaDoc oldValue = getValue();
311     setTypedValue((String JavaDoc)value);
312     return oldValue;
313   }
314
315   /**
316    * <!-- begin-user-doc -->
317    * <!-- end-user-doc -->
318    * @generated
319    */

320   public EMap getEMap()
321   {
322     EObject container = eContainer();
323     return container == null ? null : (EMap)container.eGet(eContainmentFeature());
324   }
325
326 } //EStringToStringMapEntryImpl
327
Popular Tags