1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package EMOF.impl; |
8 | |
9 | import EMOF.EMOFPackage; |
10 | import EMOF.Element; |
11 | import EMOF.Tag; |
12 | |
13 | import java.util.Collection; |
14 | |
15 | import org.eclipse.emf.common.notify.Notification; |
16 | |
17 | import org.eclipse.emf.common.util.EList; |
18 | |
19 | import org.eclipse.emf.ecore.EClass; |
20 | |
21 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
22 | |
23 | import org.eclipse.emf.ecore.util.EObjectResolvingEList; |
24 | |
25 | /** |
26 | * <!-- begin-user-doc --> |
27 | * An implementation of the model object '<em><b>Tag</b></em>'. |
28 | * <!-- end-user-doc --> |
29 | * <p> |
30 | * The following features are implemented: |
31 | * <ul> |
32 | * <li>{@link EMOF.impl.TagImpl#getElement <em>Element</em>}</li> |
33 | * <li>{@link EMOF.impl.TagImpl#getName <em>Name</em>}</li> |
34 | * <li>{@link EMOF.impl.TagImpl#getValue <em>Value</em>}</li> |
35 | * </ul> |
36 | * </p> |
37 | * |
38 | * @generated |
39 | */ |
40 | public class TagImpl extends ElementImpl implements Tag { |
41 | /** |
42 | * The cached value of the '{@link #getElement() <em>Element</em>}' reference list. |
43 | * <!-- begin-user-doc --> |
44 | * <!-- end-user-doc --> |
45 | * @see #getElement() |
46 | * @generated |
47 | * @ordered |
48 | */ |
49 | protected EList<Element> element; |
50 | |
51 | /** |
52 | * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
53 | * <!-- begin-user-doc --> |
54 | * <!-- end-user-doc --> |
55 | * @see #getName() |
56 | * @generated |
57 | * @ordered |
58 | */ |
59 | protected static final String NAME_EDEFAULT = null; |
60 | |
61 | /** |
62 | * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @see #getName() |
66 | * @generated |
67 | * @ordered |
68 | */ |
69 | protected String name = NAME_EDEFAULT; |
70 | |
71 | /** |
72 | * The default value of the '{@link #getValue() <em>Value</em>}' attribute. |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @see #getValue() |
76 | * @generated |
77 | * @ordered |
78 | */ |
79 | protected static final String VALUE_EDEFAULT = null; |
80 | |
81 | /** |
82 | * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. |
83 | * <!-- begin-user-doc --> |
84 | * <!-- end-user-doc --> |
85 | * @see #getValue() |
86 | * @generated |
87 | * @ordered |
88 | */ |
89 | protected String value = VALUE_EDEFAULT; |
90 | |
91 | /** |
92 | * <!-- begin-user-doc --> |
93 | * <!-- end-user-doc --> |
94 | * @generated |
95 | */ |
96 | protected TagImpl() { |
97 | super(); |
98 | } |
99 | |
100 | /** |
101 | * <!-- begin-user-doc --> |
102 | * <!-- end-user-doc --> |
103 | * @generated |
104 | */ |
105 | @Override |
106 | protected EClass eStaticClass() { |
107 | return EMOFPackage.Literals.TAG; |
108 | } |
109 | |
110 | /** |
111 | * <!-- begin-user-doc --> |
112 | * <!-- end-user-doc --> |
113 | * @generated |
114 | */ |
115 | public EList<Element> getElement() { |
116 | if (element == null) { |
117 | element = new EObjectResolvingEList<Element>(Element.class, this, EMOFPackage.TAG__ELEMENT); |
118 | } |
119 | return element; |
120 | } |
121 | |
122 | /** |
123 | * <!-- begin-user-doc --> |
124 | * <!-- end-user-doc --> |
125 | * @generated |
126 | */ |
127 | public String getName() { |
128 | return name; |
129 | } |
130 | |
131 | /** |
132 | * <!-- begin-user-doc --> |
133 | * <!-- end-user-doc --> |
134 | * @generated |
135 | */ |
136 | public void setName(String newName) { |
137 | String oldName = name; |
138 | name = newName; |
139 | if (eNotificationRequired()) |
140 | eNotify(new ENotificationImpl(this, Notification.SET, EMOFPackage.TAG__NAME, oldName, name)); |
141 | } |
142 | |
143 | /** |
144 | * <!-- begin-user-doc --> |
145 | * <!-- end-user-doc --> |
146 | * @generated |
147 | */ |
148 | public String getValue() { |
149 | return value; |
150 | } |
151 | |
152 | /** |
153 | * <!-- begin-user-doc --> |
154 | * <!-- end-user-doc --> |
155 | * @generated |
156 | */ |
157 | public void setValue(String newValue) { |
158 | String oldValue = value; |
159 | value = newValue; |
160 | if (eNotificationRequired()) |
161 | eNotify(new ENotificationImpl(this, Notification.SET, EMOFPackage.TAG__VALUE, oldValue, value)); |
162 | } |
163 | |
164 | /** |
165 | * <!-- begin-user-doc --> |
166 | * <!-- end-user-doc --> |
167 | * @generated |
168 | */ |
169 | @Override |
170 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
171 | switch (featureID) { |
172 | case EMOFPackage.TAG__ELEMENT: |
173 | return getElement(); |
174 | case EMOFPackage.TAG__NAME: |
175 | return getName(); |
176 | case EMOFPackage.TAG__VALUE: |
177 | return getValue(); |
178 | } |
179 | return super.eGet(featureID, resolve, coreType); |
180 | } |
181 | |
182 | /** |
183 | * <!-- begin-user-doc --> |
184 | * <!-- end-user-doc --> |
185 | * @generated |
186 | */ |
187 | @SuppressWarnings("unchecked") |
188 | @Override |
189 | public void eSet(int featureID, Object newValue) { |
190 | switch (featureID) { |
191 | case EMOFPackage.TAG__ELEMENT: |
192 | getElement().clear(); |
193 | getElement().addAll((Collection<? extends Element>)newValue); |
194 | return; |
195 | case EMOFPackage.TAG__NAME: |
196 | setName((String)newValue); |
197 | return; |
198 | case EMOFPackage.TAG__VALUE: |
199 | setValue((String)newValue); |
200 | return; |
201 | } |
202 | super.eSet(featureID, newValue); |
203 | } |
204 | |
205 | /** |
206 | * <!-- begin-user-doc --> |
207 | * <!-- end-user-doc --> |
208 | * @generated |
209 | */ |
210 | @Override |
211 | public void eUnset(int featureID) { |
212 | switch (featureID) { |
213 | case EMOFPackage.TAG__ELEMENT: |
214 | getElement().clear(); |
215 | return; |
216 | case EMOFPackage.TAG__NAME: |
217 | setName(NAME_EDEFAULT); |
218 | return; |
219 | case EMOFPackage.TAG__VALUE: |
220 | setValue(VALUE_EDEFAULT); |
221 | return; |
222 | } |
223 | super.eUnset(featureID); |
224 | } |
225 | |
226 | /** |
227 | * <!-- begin-user-doc --> |
228 | * <!-- end-user-doc --> |
229 | * @generated |
230 | */ |
231 | @Override |
232 | public boolean eIsSet(int featureID) { |
233 | switch (featureID) { |
234 | case EMOFPackage.TAG__ELEMENT: |
235 | return element != null && !element.isEmpty(); |
236 | case EMOFPackage.TAG__NAME: |
237 | return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
238 | case EMOFPackage.TAG__VALUE: |
239 | return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value); |
240 | } |
241 | return super.eIsSet(featureID); |
242 | } |
243 | |
244 | /** |
245 | * <!-- begin-user-doc --> |
246 | * <!-- end-user-doc --> |
247 | * @generated |
248 | */ |
249 | @Override |
250 | public String toString() { |
251 | if (eIsProxy()) return super.toString(); |
252 | |
253 | StringBuffer result = new StringBuffer(super.toString()); |
254 | result.append(" (name: "); |
255 | result.append(name); |
256 | result.append(", value: "); |
257 | result.append(value); |
258 | result.append(')'); |
259 | return result.toString(); |
260 | } |
261 | |
262 | } //TagImpl |