1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.spa.impl; |
8 | |
9 | import de.uka.ipd.sdq.spa.ProcessBehaviour; |
10 | import de.uka.ipd.sdq.spa.SpaPackage; |
11 | |
12 | import de.uka.ipd.sdq.spa.expression.Expression; |
13 | |
14 | import org.eclipse.emf.common.notify.Notification; |
15 | import org.eclipse.emf.common.notify.NotificationChain; |
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.EObjectImpl; |
22 | |
23 | /** |
24 | * <!-- begin-user-doc --> |
25 | * An implementation of the model object '<em><b>Process Behaviour</b></em>'. |
26 | * <!-- end-user-doc --> |
27 | * <p> |
28 | * The following features are implemented: |
29 | * <ul> |
30 | * <li>{@link de.uka.ipd.sdq.spa.impl.ProcessBehaviourImpl#getNumReplicas <em>Num Replicas</em>}</li> |
31 | * <li>{@link de.uka.ipd.sdq.spa.impl.ProcessBehaviourImpl#getName <em>Name</em>}</li> |
32 | * <li>{@link de.uka.ipd.sdq.spa.impl.ProcessBehaviourImpl#getBehaviour <em>Behaviour</em>}</li> |
33 | * </ul> |
34 | * </p> |
35 | * |
36 | * @generated |
37 | */ |
38 | public class ProcessBehaviourImpl extends EObjectImpl implements ProcessBehaviour { |
39 | /** |
40 | * The default value of the '{@link #getNumReplicas() <em>Num Replicas</em>}' attribute. |
41 | * <!-- begin-user-doc --> |
42 | * <!-- end-user-doc --> |
43 | * @see #getNumReplicas() |
44 | * @generated |
45 | * @ordered |
46 | */ |
47 | protected static final int NUM_REPLICAS_EDEFAULT = 0; |
48 | |
49 | /** |
50 | * The cached value of the '{@link #getNumReplicas() <em>Num Replicas</em>}' attribute. |
51 | * <!-- begin-user-doc --> |
52 | * <!-- end-user-doc --> |
53 | * @see #getNumReplicas() |
54 | * @generated |
55 | * @ordered |
56 | */ |
57 | protected int numReplicas = NUM_REPLICAS_EDEFAULT; |
58 | |
59 | /** |
60 | * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
61 | * <!-- begin-user-doc --> |
62 | * <!-- end-user-doc --> |
63 | * @see #getName() |
64 | * @generated |
65 | * @ordered |
66 | */ |
67 | protected static final String NAME_EDEFAULT = ""; |
68 | |
69 | /** |
70 | * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
71 | * <!-- begin-user-doc --> |
72 | * <!-- end-user-doc --> |
73 | * @see #getName() |
74 | * @generated |
75 | * @ordered |
76 | */ |
77 | protected String name = NAME_EDEFAULT; |
78 | |
79 | /** |
80 | * The cached value of the '{@link #getBehaviour() <em>Behaviour</em>}' containment reference. |
81 | * <!-- begin-user-doc --> |
82 | * <!-- end-user-doc --> |
83 | * @see #getBehaviour() |
84 | * @generated |
85 | * @ordered |
86 | */ |
87 | protected Expression behaviour = null; |
88 | |
89 | /** |
90 | * <!-- begin-user-doc --> |
91 | * <!-- end-user-doc --> |
92 | * @generated |
93 | */ |
94 | protected ProcessBehaviourImpl() { |
95 | super(); |
96 | } |
97 | |
98 | /** |
99 | * <!-- begin-user-doc --> |
100 | * <!-- end-user-doc --> |
101 | * @generated |
102 | */ |
103 | @Override |
104 | protected EClass eStaticClass() { |
105 | return SpaPackage.Literals.PROCESS_BEHAVIOUR; |
106 | } |
107 | |
108 | /** |
109 | * <!-- begin-user-doc --> |
110 | * <!-- end-user-doc --> |
111 | * @generated |
112 | */ |
113 | public int getNumReplicas() { |
114 | return numReplicas; |
115 | } |
116 | |
117 | /** |
118 | * <!-- begin-user-doc --> |
119 | * <!-- end-user-doc --> |
120 | * @generated |
121 | */ |
122 | public void setNumReplicas(int newNumReplicas) { |
123 | int oldNumReplicas = numReplicas; |
124 | numReplicas = newNumReplicas; |
125 | if (eNotificationRequired()) |
126 | eNotify(new ENotificationImpl(this, Notification.SET, SpaPackage.PROCESS_BEHAVIOUR__NUM_REPLICAS, oldNumReplicas, numReplicas)); |
127 | } |
128 | |
129 | /** |
130 | * <!-- begin-user-doc --> |
131 | * <!-- end-user-doc --> |
132 | * @generated |
133 | */ |
134 | public String getName() { |
135 | return name; |
136 | } |
137 | |
138 | /** |
139 | * <!-- begin-user-doc --> |
140 | * <!-- end-user-doc --> |
141 | * @generated |
142 | */ |
143 | public void setName(String newName) { |
144 | String oldName = name; |
145 | name = newName; |
146 | if (eNotificationRequired()) |
147 | eNotify(new ENotificationImpl(this, Notification.SET, SpaPackage.PROCESS_BEHAVIOUR__NAME, oldName, name)); |
148 | } |
149 | |
150 | /** |
151 | * <!-- begin-user-doc --> |
152 | * <!-- end-user-doc --> |
153 | * @generated |
154 | */ |
155 | public Expression getBehaviour() { |
156 | return behaviour; |
157 | } |
158 | |
159 | /** |
160 | * <!-- begin-user-doc --> |
161 | * <!-- end-user-doc --> |
162 | * @generated |
163 | */ |
164 | public NotificationChain basicSetBehaviour(Expression newBehaviour, NotificationChain msgs) { |
165 | Expression oldBehaviour = behaviour; |
166 | behaviour = newBehaviour; |
167 | if (eNotificationRequired()) { |
168 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SpaPackage.PROCESS_BEHAVIOUR__BEHAVIOUR, oldBehaviour, newBehaviour); |
169 | if (msgs == null) msgs = notification; else msgs.add(notification); |
170 | } |
171 | return msgs; |
172 | } |
173 | |
174 | /** |
175 | * <!-- begin-user-doc --> |
176 | * <!-- end-user-doc --> |
177 | * @generated |
178 | */ |
179 | public void setBehaviour(Expression newBehaviour) { |
180 | if (newBehaviour != behaviour) { |
181 | NotificationChain msgs = null; |
182 | if (behaviour != null) |
183 | msgs = ((InternalEObject)behaviour).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SpaPackage.PROCESS_BEHAVIOUR__BEHAVIOUR, null, msgs); |
184 | if (newBehaviour != null) |
185 | msgs = ((InternalEObject)newBehaviour).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SpaPackage.PROCESS_BEHAVIOUR__BEHAVIOUR, null, msgs); |
186 | msgs = basicSetBehaviour(newBehaviour, msgs); |
187 | if (msgs != null) msgs.dispatch(); |
188 | } |
189 | else if (eNotificationRequired()) |
190 | eNotify(new ENotificationImpl(this, Notification.SET, SpaPackage.PROCESS_BEHAVIOUR__BEHAVIOUR, newBehaviour, newBehaviour)); |
191 | } |
192 | |
193 | /** |
194 | * <!-- begin-user-doc --> |
195 | * <!-- end-user-doc --> |
196 | * @generated |
197 | */ |
198 | @Override |
199 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
200 | switch (featureID) { |
201 | case SpaPackage.PROCESS_BEHAVIOUR__BEHAVIOUR: |
202 | return basicSetBehaviour(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 | switch (featureID) { |
215 | case SpaPackage.PROCESS_BEHAVIOUR__NUM_REPLICAS: |
216 | return new Integer(getNumReplicas()); |
217 | case SpaPackage.PROCESS_BEHAVIOUR__NAME: |
218 | return getName(); |
219 | case SpaPackage.PROCESS_BEHAVIOUR__BEHAVIOUR: |
220 | return getBehaviour(); |
221 | } |
222 | return super.eGet(featureID, resolve, coreType); |
223 | } |
224 | |
225 | /** |
226 | * <!-- begin-user-doc --> |
227 | * <!-- end-user-doc --> |
228 | * @generated |
229 | */ |
230 | @Override |
231 | public void eSet(int featureID, Object newValue) { |
232 | switch (featureID) { |
233 | case SpaPackage.PROCESS_BEHAVIOUR__NUM_REPLICAS: |
234 | setNumReplicas(((Integer)newValue).intValue()); |
235 | return; |
236 | case SpaPackage.PROCESS_BEHAVIOUR__NAME: |
237 | setName((String)newValue); |
238 | return; |
239 | case SpaPackage.PROCESS_BEHAVIOUR__BEHAVIOUR: |
240 | setBehaviour((Expression)newValue); |
241 | return; |
242 | } |
243 | super.eSet(featureID, newValue); |
244 | } |
245 | |
246 | /** |
247 | * <!-- begin-user-doc --> |
248 | * <!-- end-user-doc --> |
249 | * @generated |
250 | */ |
251 | @Override |
252 | public void eUnset(int featureID) { |
253 | switch (featureID) { |
254 | case SpaPackage.PROCESS_BEHAVIOUR__NUM_REPLICAS: |
255 | setNumReplicas(NUM_REPLICAS_EDEFAULT); |
256 | return; |
257 | case SpaPackage.PROCESS_BEHAVIOUR__NAME: |
258 | setName(NAME_EDEFAULT); |
259 | return; |
260 | case SpaPackage.PROCESS_BEHAVIOUR__BEHAVIOUR: |
261 | setBehaviour((Expression)null); |
262 | return; |
263 | } |
264 | super.eUnset(featureID); |
265 | } |
266 | |
267 | /** |
268 | * <!-- begin-user-doc --> |
269 | * <!-- end-user-doc --> |
270 | * @generated |
271 | */ |
272 | @Override |
273 | public boolean eIsSet(int featureID) { |
274 | switch (featureID) { |
275 | case SpaPackage.PROCESS_BEHAVIOUR__NUM_REPLICAS: |
276 | return numReplicas != NUM_REPLICAS_EDEFAULT; |
277 | case SpaPackage.PROCESS_BEHAVIOUR__NAME: |
278 | return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
279 | case SpaPackage.PROCESS_BEHAVIOUR__BEHAVIOUR: |
280 | return behaviour != null; |
281 | } |
282 | return super.eIsSet(featureID); |
283 | } |
284 | |
285 | /** |
286 | * <!-- begin-user-doc --> |
287 | * <!-- end-user-doc --> |
288 | * @generated |
289 | */ |
290 | @Override |
291 | public String toString() { |
292 | if (eIsProxy()) return super.toString(); |
293 | |
294 | StringBuffer result = new StringBuffer(super.toString()); |
295 | result.append(" (numReplicas: "); |
296 | result.append(numReplicas); |
297 | result.append(", name: "); |
298 | result.append(name); |
299 | result.append(')'); |
300 | return result.toString(); |
301 | } |
302 | |
303 | } //ProcessBehaviourImpl |