|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 package com.nokia.s60tools.imaker.internal.iqrf.impl; |
|
18 |
|
19 |
|
20 import org.eclipse.emf.common.notify.Notification; |
|
21 import org.eclipse.emf.ecore.EClass; |
|
22 import org.eclipse.emf.ecore.impl.ENotificationImpl; |
|
23 import org.eclipse.emf.ecore.impl.EObjectImpl; |
|
24 |
|
25 import com.nokia.s60tools.imaker.internal.iqrf.ConfigurationElement; |
|
26 import com.nokia.s60tools.imaker.internal.iqrf.IQRFPackage; |
|
27 import com.nokia.s60tools.imaker.internal.iqrf.util.IQRFUtil; |
|
28 |
|
29 /** |
|
30 * <!-- begin-user-doc --> |
|
31 * An implementation of the model object '<em><b>Configuration Element</b></em>'. |
|
32 * <!-- end-user-doc --> |
|
33 * <p> |
|
34 * The following features are implemented: |
|
35 * <ul> |
|
36 * <li>{@link com.nokia.s60tools.imaker.internal.iqrf.impl.ConfigurationElementImpl#getName <em>Name</em>}</li> |
|
37 * <li>{@link com.nokia.s60tools.imaker.internal.iqrf.impl.ConfigurationElementImpl#getDescription <em>Description</em>}</li> |
|
38 * <li>{@link com.nokia.s60tools.imaker.internal.iqrf.impl.ConfigurationElementImpl#getValues <em>Values</em>}</li> |
|
39 * </ul> |
|
40 * </p> |
|
41 * |
|
42 * @generated |
|
43 */ |
|
44 public class ConfigurationElementImpl extends EObjectImpl implements ConfigurationElement { |
|
45 /** |
|
46 * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
|
47 * <!-- begin-user-doc --> |
|
48 * <!-- end-user-doc --> |
|
49 * @see #getName() |
|
50 * @generated |
|
51 * @ordered |
|
52 */ |
|
53 protected static final String NAME_EDEFAULT = null; |
|
54 |
|
55 /** |
|
56 * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
|
57 * <!-- begin-user-doc --> |
|
58 * <!-- end-user-doc --> |
|
59 * @see #getName() |
|
60 * @generated |
|
61 * @ordered |
|
62 */ |
|
63 protected String name = NAME_EDEFAULT; |
|
64 |
|
65 /** |
|
66 * The default value of the '{@link #getDescription() <em>Description</em>}' attribute. |
|
67 * <!-- begin-user-doc --> |
|
68 * <!-- end-user-doc --> |
|
69 * @see #getDescription() |
|
70 * @generated |
|
71 * @ordered |
|
72 */ |
|
73 protected static final String DESCRIPTION_EDEFAULT = null; |
|
74 |
|
75 /** |
|
76 * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute. |
|
77 * <!-- begin-user-doc --> |
|
78 * <!-- end-user-doc --> |
|
79 * @see #getDescription() |
|
80 * @generated |
|
81 * @ordered |
|
82 */ |
|
83 protected String description = DESCRIPTION_EDEFAULT; |
|
84 |
|
85 /** |
|
86 * The default value of the '{@link #getValues() <em>Values</em>}' attribute. |
|
87 * <!-- begin-user-doc --> |
|
88 * <!-- end-user-doc --> |
|
89 * @see #getValues() |
|
90 * @generated |
|
91 * @ordered |
|
92 */ |
|
93 protected static final String VALUES_EDEFAULT = ""; |
|
94 |
|
95 /** |
|
96 * The cached value of the '{@link #getValues() <em>Values</em>}' attribute. |
|
97 * <!-- begin-user-doc --> |
|
98 * <!-- end-user-doc --> |
|
99 * @see #getValues() |
|
100 * @generated |
|
101 * @ordered |
|
102 */ |
|
103 protected String values = VALUES_EDEFAULT; |
|
104 |
|
105 /** |
|
106 * <!-- begin-user-doc --> |
|
107 * <!-- end-user-doc --> |
|
108 * @generated |
|
109 */ |
|
110 protected ConfigurationElementImpl() { |
|
111 super(); |
|
112 } |
|
113 |
|
114 /** |
|
115 * <!-- begin-user-doc --> |
|
116 * <!-- end-user-doc --> |
|
117 * @generated |
|
118 */ |
|
119 protected EClass eStaticClass() { |
|
120 return IQRFPackage.Literals.CONFIGURATION_ELEMENT; |
|
121 } |
|
122 |
|
123 /** |
|
124 * <!-- begin-user-doc --> |
|
125 * <!-- end-user-doc --> |
|
126 * @generated |
|
127 */ |
|
128 public String getName() { |
|
129 return name; |
|
130 } |
|
131 |
|
132 /** |
|
133 * <!-- begin-user-doc --> |
|
134 * <!-- end-user-doc --> |
|
135 * @generated |
|
136 */ |
|
137 public void setName(String newName) { |
|
138 String oldName = name; |
|
139 name = newName; |
|
140 if (eNotificationRequired()) |
|
141 eNotify(new ENotificationImpl(this, Notification.SET, IQRFPackage.CONFIGURATION_ELEMENT__NAME, oldName, name)); |
|
142 } |
|
143 |
|
144 /** |
|
145 * <!-- begin-user-doc --> |
|
146 * <!-- end-user-doc --> |
|
147 * @generated |
|
148 */ |
|
149 public String getDescription() { |
|
150 return description; |
|
151 } |
|
152 |
|
153 /** |
|
154 * <!-- begin-user-doc --> |
|
155 * <!-- end-user-doc --> |
|
156 * @generated |
|
157 */ |
|
158 public void setDescription(String newDescription) { |
|
159 String oldDescription = description; |
|
160 description = newDescription; |
|
161 if (eNotificationRequired()) |
|
162 eNotify(new ENotificationImpl(this, Notification.SET, IQRFPackage.CONFIGURATION_ELEMENT__DESCRIPTION, oldDescription, description)); |
|
163 } |
|
164 |
|
165 /** |
|
166 * <!-- begin-user-doc --> |
|
167 * <!-- end-user-doc --> |
|
168 * @generated |
|
169 */ |
|
170 public String getValues() { |
|
171 return values; |
|
172 } |
|
173 |
|
174 /** |
|
175 * <!-- begin-user-doc --> |
|
176 * <!-- end-user-doc --> |
|
177 * @generated |
|
178 */ |
|
179 public void setValues(String newValues) { |
|
180 String oldValues = values; |
|
181 values = newValues; |
|
182 if (eNotificationRequired()) |
|
183 eNotify(new ENotificationImpl(this, Notification.SET, IQRFPackage.CONFIGURATION_ELEMENT__VALUES, oldValues, values)); |
|
184 } |
|
185 |
|
186 /** |
|
187 * <!-- begin-user-doc --> |
|
188 * <!-- end-user-doc --> |
|
189 * @generated |
|
190 */ |
|
191 public Object eGet(int featureID, boolean resolve, boolean coreType) { |
|
192 switch (featureID) { |
|
193 case IQRFPackage.CONFIGURATION_ELEMENT__NAME: |
|
194 return getName(); |
|
195 case IQRFPackage.CONFIGURATION_ELEMENT__DESCRIPTION: |
|
196 return getDescription(); |
|
197 case IQRFPackage.CONFIGURATION_ELEMENT__VALUES: |
|
198 return getValues(); |
|
199 } |
|
200 return super.eGet(featureID, resolve, coreType); |
|
201 } |
|
202 |
|
203 /** |
|
204 * <!-- begin-user-doc --> |
|
205 * <!-- end-user-doc --> |
|
206 * @generated |
|
207 */ |
|
208 public void eSet(int featureID, Object newValue) { |
|
209 switch (featureID) { |
|
210 case IQRFPackage.CONFIGURATION_ELEMENT__NAME: |
|
211 setName((String)newValue); |
|
212 return; |
|
213 case IQRFPackage.CONFIGURATION_ELEMENT__DESCRIPTION: |
|
214 setDescription((String)newValue); |
|
215 return; |
|
216 case IQRFPackage.CONFIGURATION_ELEMENT__VALUES: |
|
217 setValues((String)newValue); |
|
218 return; |
|
219 } |
|
220 super.eSet(featureID, newValue); |
|
221 } |
|
222 |
|
223 /** |
|
224 * <!-- begin-user-doc --> |
|
225 * <!-- end-user-doc --> |
|
226 * @generated |
|
227 */ |
|
228 public void eUnset(int featureID) { |
|
229 switch (featureID) { |
|
230 case IQRFPackage.CONFIGURATION_ELEMENT__NAME: |
|
231 setName(NAME_EDEFAULT); |
|
232 return; |
|
233 case IQRFPackage.CONFIGURATION_ELEMENT__DESCRIPTION: |
|
234 setDescription(DESCRIPTION_EDEFAULT); |
|
235 return; |
|
236 case IQRFPackage.CONFIGURATION_ELEMENT__VALUES: |
|
237 setValues(VALUES_EDEFAULT); |
|
238 return; |
|
239 } |
|
240 super.eUnset(featureID); |
|
241 } |
|
242 |
|
243 /** |
|
244 * <!-- begin-user-doc --> |
|
245 * <!-- end-user-doc --> |
|
246 * @generated |
|
247 */ |
|
248 public boolean eIsSet(int featureID) { |
|
249 switch (featureID) { |
|
250 case IQRFPackage.CONFIGURATION_ELEMENT__NAME: |
|
251 return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
|
252 case IQRFPackage.CONFIGURATION_ELEMENT__DESCRIPTION: |
|
253 return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description); |
|
254 case IQRFPackage.CONFIGURATION_ELEMENT__VALUES: |
|
255 return VALUES_EDEFAULT == null ? values != null : !VALUES_EDEFAULT.equals(values); |
|
256 } |
|
257 return super.eIsSet(featureID); |
|
258 } |
|
259 |
|
260 /** |
|
261 * <!-- begin-user-doc --> |
|
262 * <!-- end-user-doc --> |
|
263 * @generated |
|
264 */ |
|
265 public String toString() { |
|
266 if (eIsProxy()) return super.toString(); |
|
267 |
|
268 StringBuffer result = new StringBuffer(super.toString()); |
|
269 result.append(" (name: "); |
|
270 result.append(name); |
|
271 result.append(", description: "); |
|
272 result.append(description); |
|
273 result.append(", values: "); |
|
274 result.append(values); |
|
275 result.append(')'); |
|
276 return result.toString(); |
|
277 } |
|
278 |
|
279 public boolean equals(Object object) { |
|
280 if(object==null || !(object instanceof ConfigurationElement)) return false; |
|
281 ConfigurationElement other = (ConfigurationElement)object; |
|
282 return IQRFUtil.equals(getName(),other.getName()) && |
|
283 IQRFUtil.equals(getDescription(),other.getDescription()) && |
|
284 IQRFUtil.equals(getValues(),other.getValues()); |
|
285 } |
|
286 |
|
287 @Override |
|
288 public int hashCode() { |
|
289 final int hashMultiplier = 41; |
|
290 int result = 7; |
|
291 result=result*hashMultiplier + getName().hashCode(); |
|
292 result=result*hashMultiplier + getDescription().hashCode(); |
|
293 result=result*hashMultiplier + getValues().hashCode(); |
|
294 return result; |
|
295 } |
|
296 } //ConfigurationElementImpl |