1 | /** |
---|
2 | */ |
---|
3 | package de.ugoe.cs.swe.bnftools.ebnf.impl; |
---|
4 | |
---|
5 | import de.ugoe.cs.swe.bnftools.ebnf.DefinitionList; |
---|
6 | import de.ugoe.cs.swe.bnftools.ebnf.EbnfPackage; |
---|
7 | import de.ugoe.cs.swe.bnftools.ebnf.RepeatRange; |
---|
8 | import de.ugoe.cs.swe.bnftools.ebnf.RepeatedSequence; |
---|
9 | |
---|
10 | import java.util.Collection; |
---|
11 | |
---|
12 | import org.eclipse.emf.common.notify.Notification; |
---|
13 | import org.eclipse.emf.common.notify.NotificationChain; |
---|
14 | |
---|
15 | import org.eclipse.emf.common.util.EList; |
---|
16 | |
---|
17 | import org.eclipse.emf.ecore.EClass; |
---|
18 | import org.eclipse.emf.ecore.InternalEObject; |
---|
19 | |
---|
20 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
---|
21 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; |
---|
22 | |
---|
23 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
---|
24 | import org.eclipse.emf.ecore.util.InternalEList; |
---|
25 | |
---|
26 | /** |
---|
27 | * <!-- begin-user-doc --> |
---|
28 | * An implementation of the model object '<em><b>Repeated Sequence</b></em>'. |
---|
29 | * <!-- end-user-doc --> |
---|
30 | * <p> |
---|
31 | * The following features are implemented: |
---|
32 | * <ul> |
---|
33 | * <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.RepeatedSequenceImpl#getDefinitions <em>Definitions</em>}</li> |
---|
34 | * <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.RepeatedSequenceImpl#isMorethanonce <em>Morethanonce</em>}</li> |
---|
35 | * <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.RepeatedSequenceImpl#getRange <em>Range</em>}</li> |
---|
36 | * </ul> |
---|
37 | * </p> |
---|
38 | * |
---|
39 | * @generated |
---|
40 | */ |
---|
41 | public class RepeatedSequenceImpl extends MinimalEObjectImpl.Container implements RepeatedSequence |
---|
42 | { |
---|
43 | /** |
---|
44 | * The cached value of the '{@link #getDefinitions() <em>Definitions</em>}' containment reference list. |
---|
45 | * <!-- begin-user-doc --> |
---|
46 | * <!-- end-user-doc --> |
---|
47 | * @see #getDefinitions() |
---|
48 | * @generated |
---|
49 | * @ordered |
---|
50 | */ |
---|
51 | protected EList<DefinitionList> definitions; |
---|
52 | |
---|
53 | /** |
---|
54 | * The default value of the '{@link #isMorethanonce() <em>Morethanonce</em>}' attribute. |
---|
55 | * <!-- begin-user-doc --> |
---|
56 | * <!-- end-user-doc --> |
---|
57 | * @see #isMorethanonce() |
---|
58 | * @generated |
---|
59 | * @ordered |
---|
60 | */ |
---|
61 | protected static final boolean MORETHANONCE_EDEFAULT = false; |
---|
62 | |
---|
63 | /** |
---|
64 | * The cached value of the '{@link #isMorethanonce() <em>Morethanonce</em>}' attribute. |
---|
65 | * <!-- begin-user-doc --> |
---|
66 | * <!-- end-user-doc --> |
---|
67 | * @see #isMorethanonce() |
---|
68 | * @generated |
---|
69 | * @ordered |
---|
70 | */ |
---|
71 | protected boolean morethanonce = MORETHANONCE_EDEFAULT; |
---|
72 | |
---|
73 | /** |
---|
74 | * The cached value of the '{@link #getRange() <em>Range</em>}' containment reference. |
---|
75 | * <!-- begin-user-doc --> |
---|
76 | * <!-- end-user-doc --> |
---|
77 | * @see #getRange() |
---|
78 | * @generated |
---|
79 | * @ordered |
---|
80 | */ |
---|
81 | protected RepeatRange range; |
---|
82 | |
---|
83 | /** |
---|
84 | * <!-- begin-user-doc --> |
---|
85 | * <!-- end-user-doc --> |
---|
86 | * @generated |
---|
87 | */ |
---|
88 | protected RepeatedSequenceImpl() |
---|
89 | { |
---|
90 | super(); |
---|
91 | } |
---|
92 | |
---|
93 | /** |
---|
94 | * <!-- begin-user-doc --> |
---|
95 | * <!-- end-user-doc --> |
---|
96 | * @generated |
---|
97 | */ |
---|
98 | @Override |
---|
99 | protected EClass eStaticClass() |
---|
100 | { |
---|
101 | return EbnfPackage.Literals.REPEATED_SEQUENCE; |
---|
102 | } |
---|
103 | |
---|
104 | /** |
---|
105 | * <!-- begin-user-doc --> |
---|
106 | * <!-- end-user-doc --> |
---|
107 | * @generated |
---|
108 | */ |
---|
109 | public EList<DefinitionList> getDefinitions() |
---|
110 | { |
---|
111 | if (definitions == null) |
---|
112 | { |
---|
113 | definitions = new EObjectContainmentEList<DefinitionList>(DefinitionList.class, this, EbnfPackage.REPEATED_SEQUENCE__DEFINITIONS); |
---|
114 | } |
---|
115 | return definitions; |
---|
116 | } |
---|
117 | |
---|
118 | /** |
---|
119 | * <!-- begin-user-doc --> |
---|
120 | * <!-- end-user-doc --> |
---|
121 | * @generated |
---|
122 | */ |
---|
123 | public boolean isMorethanonce() |
---|
124 | { |
---|
125 | return morethanonce; |
---|
126 | } |
---|
127 | |
---|
128 | /** |
---|
129 | * <!-- begin-user-doc --> |
---|
130 | * <!-- end-user-doc --> |
---|
131 | * @generated |
---|
132 | */ |
---|
133 | public void setMorethanonce(boolean newMorethanonce) |
---|
134 | { |
---|
135 | boolean oldMorethanonce = morethanonce; |
---|
136 | morethanonce = newMorethanonce; |
---|
137 | if (eNotificationRequired()) |
---|
138 | eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.REPEATED_SEQUENCE__MORETHANONCE, oldMorethanonce, morethanonce)); |
---|
139 | } |
---|
140 | |
---|
141 | /** |
---|
142 | * <!-- begin-user-doc --> |
---|
143 | * <!-- end-user-doc --> |
---|
144 | * @generated |
---|
145 | */ |
---|
146 | public RepeatRange getRange() |
---|
147 | { |
---|
148 | return range; |
---|
149 | } |
---|
150 | |
---|
151 | /** |
---|
152 | * <!-- begin-user-doc --> |
---|
153 | * <!-- end-user-doc --> |
---|
154 | * @generated |
---|
155 | */ |
---|
156 | public NotificationChain basicSetRange(RepeatRange newRange, NotificationChain msgs) |
---|
157 | { |
---|
158 | RepeatRange oldRange = range; |
---|
159 | range = newRange; |
---|
160 | if (eNotificationRequired()) |
---|
161 | { |
---|
162 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EbnfPackage.REPEATED_SEQUENCE__RANGE, oldRange, newRange); |
---|
163 | if (msgs == null) msgs = notification; else msgs.add(notification); |
---|
164 | } |
---|
165 | return msgs; |
---|
166 | } |
---|
167 | |
---|
168 | /** |
---|
169 | * <!-- begin-user-doc --> |
---|
170 | * <!-- end-user-doc --> |
---|
171 | * @generated |
---|
172 | */ |
---|
173 | public void setRange(RepeatRange newRange) |
---|
174 | { |
---|
175 | if (newRange != range) |
---|
176 | { |
---|
177 | NotificationChain msgs = null; |
---|
178 | if (range != null) |
---|
179 | msgs = ((InternalEObject)range).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EbnfPackage.REPEATED_SEQUENCE__RANGE, null, msgs); |
---|
180 | if (newRange != null) |
---|
181 | msgs = ((InternalEObject)newRange).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EbnfPackage.REPEATED_SEQUENCE__RANGE, null, msgs); |
---|
182 | msgs = basicSetRange(newRange, msgs); |
---|
183 | if (msgs != null) msgs.dispatch(); |
---|
184 | } |
---|
185 | else if (eNotificationRequired()) |
---|
186 | eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.REPEATED_SEQUENCE__RANGE, newRange, newRange)); |
---|
187 | } |
---|
188 | |
---|
189 | /** |
---|
190 | * <!-- begin-user-doc --> |
---|
191 | * <!-- end-user-doc --> |
---|
192 | * @generated |
---|
193 | */ |
---|
194 | @Override |
---|
195 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
---|
196 | { |
---|
197 | switch (featureID) |
---|
198 | { |
---|
199 | case EbnfPackage.REPEATED_SEQUENCE__DEFINITIONS: |
---|
200 | return ((InternalEList<?>)getDefinitions()).basicRemove(otherEnd, msgs); |
---|
201 | case EbnfPackage.REPEATED_SEQUENCE__RANGE: |
---|
202 | return basicSetRange(null, msgs); |
---|
203 | } |
---|
204 | return super.eInverseRemove(otherEnd, featureID, msgs); |
---|
205 | } |
---|
206 | |
---|
207 | /** |
---|
208 | * <!-- begin-user-doc --> |
---|
209 | * <!-- end-user-doc --> |
---|
210 | * @generated |
---|
211 | */ |
---|
212 | @Override |
---|
213 | public Object eGet(int featureID, boolean resolve, boolean coreType) |
---|
214 | { |
---|
215 | switch (featureID) |
---|
216 | { |
---|
217 | case EbnfPackage.REPEATED_SEQUENCE__DEFINITIONS: |
---|
218 | return getDefinitions(); |
---|
219 | case EbnfPackage.REPEATED_SEQUENCE__MORETHANONCE: |
---|
220 | return isMorethanonce(); |
---|
221 | case EbnfPackage.REPEATED_SEQUENCE__RANGE: |
---|
222 | return getRange(); |
---|
223 | } |
---|
224 | return super.eGet(featureID, resolve, coreType); |
---|
225 | } |
---|
226 | |
---|
227 | /** |
---|
228 | * <!-- begin-user-doc --> |
---|
229 | * <!-- end-user-doc --> |
---|
230 | * @generated |
---|
231 | */ |
---|
232 | @SuppressWarnings("unchecked") |
---|
233 | @Override |
---|
234 | public void eSet(int featureID, Object newValue) |
---|
235 | { |
---|
236 | switch (featureID) |
---|
237 | { |
---|
238 | case EbnfPackage.REPEATED_SEQUENCE__DEFINITIONS: |
---|
239 | getDefinitions().clear(); |
---|
240 | getDefinitions().addAll((Collection<? extends DefinitionList>)newValue); |
---|
241 | return; |
---|
242 | case EbnfPackage.REPEATED_SEQUENCE__MORETHANONCE: |
---|
243 | setMorethanonce((Boolean)newValue); |
---|
244 | return; |
---|
245 | case EbnfPackage.REPEATED_SEQUENCE__RANGE: |
---|
246 | setRange((RepeatRange)newValue); |
---|
247 | return; |
---|
248 | } |
---|
249 | super.eSet(featureID, newValue); |
---|
250 | } |
---|
251 | |
---|
252 | /** |
---|
253 | * <!-- begin-user-doc --> |
---|
254 | * <!-- end-user-doc --> |
---|
255 | * @generated |
---|
256 | */ |
---|
257 | @Override |
---|
258 | public void eUnset(int featureID) |
---|
259 | { |
---|
260 | switch (featureID) |
---|
261 | { |
---|
262 | case EbnfPackage.REPEATED_SEQUENCE__DEFINITIONS: |
---|
263 | getDefinitions().clear(); |
---|
264 | return; |
---|
265 | case EbnfPackage.REPEATED_SEQUENCE__MORETHANONCE: |
---|
266 | setMorethanonce(MORETHANONCE_EDEFAULT); |
---|
267 | return; |
---|
268 | case EbnfPackage.REPEATED_SEQUENCE__RANGE: |
---|
269 | setRange((RepeatRange)null); |
---|
270 | return; |
---|
271 | } |
---|
272 | super.eUnset(featureID); |
---|
273 | } |
---|
274 | |
---|
275 | /** |
---|
276 | * <!-- begin-user-doc --> |
---|
277 | * <!-- end-user-doc --> |
---|
278 | * @generated |
---|
279 | */ |
---|
280 | @Override |
---|
281 | public boolean eIsSet(int featureID) |
---|
282 | { |
---|
283 | switch (featureID) |
---|
284 | { |
---|
285 | case EbnfPackage.REPEATED_SEQUENCE__DEFINITIONS: |
---|
286 | return definitions != null && !definitions.isEmpty(); |
---|
287 | case EbnfPackage.REPEATED_SEQUENCE__MORETHANONCE: |
---|
288 | return morethanonce != MORETHANONCE_EDEFAULT; |
---|
289 | case EbnfPackage.REPEATED_SEQUENCE__RANGE: |
---|
290 | return range != null; |
---|
291 | } |
---|
292 | return super.eIsSet(featureID); |
---|
293 | } |
---|
294 | |
---|
295 | /** |
---|
296 | * <!-- begin-user-doc --> |
---|
297 | * <!-- end-user-doc --> |
---|
298 | * @generated |
---|
299 | */ |
---|
300 | @Override |
---|
301 | public String toString() |
---|
302 | { |
---|
303 | if (eIsProxy()) return super.toString(); |
---|
304 | |
---|
305 | StringBuffer result = new StringBuffer(super.toString()); |
---|
306 | result.append(" (morethanonce: "); |
---|
307 | result.append(morethanonce); |
---|
308 | result.append(')'); |
---|
309 | return result.toString(); |
---|
310 | } |
---|
311 | |
---|
312 | } //RepeatedSequenceImpl |
---|