1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.spa.expression.impl; |
8 | |
9 | import de.uka.ipd.sdq.probfunction.ProbabilityMassFunction; |
10 | |
11 | import de.uka.ipd.sdq.spa.expression.Expression; |
12 | import de.uka.ipd.sdq.spa.expression.ExpressionPackage; |
13 | import de.uka.ipd.sdq.spa.expression.Loop; |
14 | |
15 | import org.eclipse.emf.common.notify.Notification; |
16 | import org.eclipse.emf.common.notify.NotificationChain; |
17 | |
18 | import org.eclipse.emf.ecore.EClass; |
19 | import org.eclipse.emf.ecore.InternalEObject; |
20 | |
21 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
22 | |
23 | /** |
24 | * <!-- begin-user-doc --> |
25 | * An implementation of the model object '<em><b>Loop</b></em>'. |
26 | * <!-- end-user-doc --> |
27 | * <p> |
28 | * The following features are implemented: |
29 | * <ul> |
30 | * <li>{@link de.uka.ipd.sdq.spa.expression.impl.LoopImpl#getRegExp <em>Reg Exp</em>}</li> |
31 | * <li>{@link de.uka.ipd.sdq.spa.expression.impl.LoopImpl#getIterationsPMF <em>Iterations PMF</em>}</li> |
32 | * <li>{@link de.uka.ipd.sdq.spa.expression.impl.LoopImpl#getIterationsString <em>Iterations String</em>}</li> |
33 | * </ul> |
34 | * </p> |
35 | * |
36 | * @generated |
37 | */ |
38 | public class LoopImpl extends OperationImpl implements Loop { |
39 | /** |
40 | * The cached value of the '{@link #getRegExp() <em>Reg Exp</em>}' containment reference. |
41 | * <!-- begin-user-doc --> |
42 | * <!-- end-user-doc --> |
43 | * @see #getRegExp() |
44 | * @generated |
45 | * @ordered |
46 | */ |
47 | protected Expression regExp = null; |
48 | |
49 | protected ProbabilityMassFunction iterationsPMF; |
50 | |
51 | /** |
52 | * The default value of the '{@link #getIterationsString() <em>Iterations String</em>}' attribute. |
53 | * <!-- begin-user-doc --> |
54 | * <!-- end-user-doc --> |
55 | * @see #getIterationsString() |
56 | * @generated |
57 | * @ordered |
58 | */ |
59 | protected static final String ITERATIONS_STRING_EDEFAULT = ""; |
60 | |
61 | /** |
62 | * The cached value of the '{@link #getIterationsString() <em>Iterations String</em>}' attribute. |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @see #getIterationsString() |
66 | * @generated |
67 | * @ordered |
68 | */ |
69 | protected String iterationsString = ITERATIONS_STRING_EDEFAULT; |
70 | |
71 | /** |
72 | * <!-- begin-user-doc --> |
73 | * <!-- end-user-doc --> |
74 | * @generated |
75 | */ |
76 | protected LoopImpl() { |
77 | super(); |
78 | } |
79 | |
80 | /** |
81 | * <!-- begin-user-doc --> |
82 | * <!-- end-user-doc --> |
83 | * @generated |
84 | */ |
85 | @Override |
86 | protected EClass eStaticClass() { |
87 | return ExpressionPackage.Literals.LOOP; |
88 | } |
89 | |
90 | /** |
91 | * <!-- begin-user-doc --> |
92 | * <!-- end-user-doc --> |
93 | * @generated |
94 | */ |
95 | public Expression getRegExp() { |
96 | return regExp; |
97 | } |
98 | |
99 | /** |
100 | * <!-- begin-user-doc --> |
101 | * <!-- end-user-doc --> |
102 | * @generated |
103 | */ |
104 | public NotificationChain basicSetRegExp(Expression newRegExp, NotificationChain msgs) { |
105 | Expression oldRegExp = regExp; |
106 | regExp = newRegExp; |
107 | if (eNotificationRequired()) { |
108 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ExpressionPackage.LOOP__REG_EXP, oldRegExp, newRegExp); |
109 | if (msgs == null) msgs = notification; else msgs.add(notification); |
110 | } |
111 | return msgs; |
112 | } |
113 | |
114 | /** |
115 | * <!-- begin-user-doc --> |
116 | * <!-- end-user-doc --> |
117 | * @generated |
118 | */ |
119 | public void setRegExp(Expression newRegExp) { |
120 | if (newRegExp != regExp) { |
121 | NotificationChain msgs = null; |
122 | if (regExp != null) |
123 | msgs = ((InternalEObject)regExp).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ExpressionPackage.LOOP__REG_EXP, null, msgs); |
124 | if (newRegExp != null) |
125 | msgs = ((InternalEObject)newRegExp).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ExpressionPackage.LOOP__REG_EXP, null, msgs); |
126 | msgs = basicSetRegExp(newRegExp, msgs); |
127 | if (msgs != null) msgs.dispatch(); |
128 | } |
129 | else if (eNotificationRequired()) |
130 | eNotify(new ENotificationImpl(this, Notification.SET, ExpressionPackage.LOOP__REG_EXP, newRegExp, newRegExp)); |
131 | } |
132 | |
133 | /** |
134 | * <!-- begin-user-doc --> |
135 | * <!-- end-user-doc --> |
136 | * @generated |
137 | */ |
138 | public ProbabilityMassFunction getIterationsPMF() { |
139 | // TODO: implement this method to return the 'Iterations PMF' containment reference |
140 | // Ensure that you remove @generated or mark it @generated NOT |
141 | return null; |
142 | } |
143 | |
144 | /** |
145 | * <!-- begin-user-doc --> |
146 | * <!-- end-user-doc --> |
147 | * @generated |
148 | */ |
149 | public NotificationChain basicSetIterationsPMF(ProbabilityMassFunction newIterationsPMF, NotificationChain msgs) { |
150 | // TODO: implement this method to set the contained 'Iterations PMF' containment reference |
151 | // -> this method is automatically invoked to keep the containment relationship in synch |
152 | // -> do not modify other features |
153 | // -> return msgs, after adding any generated Notification to it (if it is null, a NotificationChain object must be created first) |
154 | // Ensure that you remove @generated or mark it @generated NOT |
155 | throw new UnsupportedOperationException(); |
156 | } |
157 | |
158 | /** |
159 | * <!-- begin-user-doc --> |
160 | * <!-- end-user-doc --> |
161 | */ |
162 | public void setIterationsPMF(ProbabilityMassFunction newIterationsPMF) { |
163 | // TODO: implement this method to set the 'Iterations PMF' containment reference |
164 | // Ensure that you remove @generated or mark it @generated NOT |
165 | } |
166 | |
167 | /** |
168 | * <!-- begin-user-doc --> |
169 | * <!-- end-user-doc --> |
170 | * @generated |
171 | */ |
172 | public String getIterationsString() { |
173 | return iterationsString; |
174 | } |
175 | |
176 | /** |
177 | * <!-- begin-user-doc --> |
178 | * <!-- end-user-doc --> |
179 | * @generated |
180 | */ |
181 | public void setIterationsString(String newIterationsString) { |
182 | String oldIterationsString = iterationsString; |
183 | iterationsString = newIterationsString; |
184 | if (eNotificationRequired()) |
185 | eNotify(new ENotificationImpl(this, Notification.SET, ExpressionPackage.LOOP__ITERATIONS_STRING, oldIterationsString, iterationsString)); |
186 | } |
187 | |
188 | /** |
189 | * <!-- begin-user-doc --> |
190 | * <!-- end-user-doc --> |
191 | * @generated |
192 | */ |
193 | @Override |
194 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
195 | switch (featureID) { |
196 | case ExpressionPackage.LOOP__REG_EXP: |
197 | return basicSetRegExp(null, msgs); |
198 | case ExpressionPackage.LOOP__ITERATIONS_PMF: |
199 | return basicSetIterationsPMF(null, msgs); |
200 | } |
201 | return super.eInverseRemove(otherEnd, featureID, msgs); |
202 | } |
203 | |
204 | /** |
205 | * <!-- begin-user-doc --> |
206 | * <!-- end-user-doc --> |
207 | * @generated |
208 | */ |
209 | @Override |
210 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
211 | switch (featureID) { |
212 | case ExpressionPackage.LOOP__REG_EXP: |
213 | return getRegExp(); |
214 | case ExpressionPackage.LOOP__ITERATIONS_PMF: |
215 | return getIterationsPMF(); |
216 | case ExpressionPackage.LOOP__ITERATIONS_STRING: |
217 | return getIterationsString(); |
218 | } |
219 | return super.eGet(featureID, resolve, coreType); |
220 | } |
221 | |
222 | /** |
223 | * <!-- begin-user-doc --> |
224 | * <!-- end-user-doc --> |
225 | * @generated |
226 | */ |
227 | @Override |
228 | public void eSet(int featureID, Object newValue) { |
229 | switch (featureID) { |
230 | case ExpressionPackage.LOOP__REG_EXP: |
231 | setRegExp((Expression)newValue); |
232 | return; |
233 | case ExpressionPackage.LOOP__ITERATIONS_PMF: |
234 | setIterationsPMF((ProbabilityMassFunction)newValue); |
235 | return; |
236 | case ExpressionPackage.LOOP__ITERATIONS_STRING: |
237 | setIterationsString((String)newValue); |
238 | return; |
239 | } |
240 | super.eSet(featureID, newValue); |
241 | } |
242 | |
243 | /** |
244 | * <!-- begin-user-doc --> |
245 | * <!-- end-user-doc --> |
246 | * @generated |
247 | */ |
248 | @Override |
249 | public void eUnset(int featureID) { |
250 | switch (featureID) { |
251 | case ExpressionPackage.LOOP__REG_EXP: |
252 | setRegExp((Expression)null); |
253 | return; |
254 | case ExpressionPackage.LOOP__ITERATIONS_PMF: |
255 | setIterationsPMF((ProbabilityMassFunction)null); |
256 | return; |
257 | case ExpressionPackage.LOOP__ITERATIONS_STRING: |
258 | setIterationsString(ITERATIONS_STRING_EDEFAULT); |
259 | return; |
260 | } |
261 | super.eUnset(featureID); |
262 | } |
263 | |
264 | /** |
265 | * <!-- begin-user-doc --> |
266 | * <!-- end-user-doc --> |
267 | * @generated |
268 | */ |
269 | @Override |
270 | public boolean eIsSet(int featureID) { |
271 | switch (featureID) { |
272 | case ExpressionPackage.LOOP__REG_EXP: |
273 | return regExp != null; |
274 | case ExpressionPackage.LOOP__ITERATIONS_PMF: |
275 | return getIterationsPMF() != null; |
276 | case ExpressionPackage.LOOP__ITERATIONS_STRING: |
277 | return ITERATIONS_STRING_EDEFAULT == null ? iterationsString != null : !ITERATIONS_STRING_EDEFAULT.equals(iterationsString); |
278 | } |
279 | return super.eIsSet(featureID); |
280 | } |
281 | |
282 | /** |
283 | * <!-- begin-user-doc --> |
284 | * <!-- end-user-doc --> |
285 | * @generated |
286 | */ |
287 | @Override |
288 | public String toString() { |
289 | if (eIsProxy()) return super.toString(); |
290 | |
291 | StringBuffer result = new StringBuffer(super.toString()); |
292 | result.append(" (iterationsString: "); |
293 | result.append(iterationsString); |
294 | result.append(')'); |
295 | return result.toString(); |
296 | } |
297 | |
298 | } //LoopImpl |