1 | /** |
2 | * Copyright 2008, sdq.ipd.uka.de, U KA |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.simucomframework.simucomstatus.impl; |
7 | |
8 | import de.uka.ipd.sdq.simucomframework.simucomstatus.Action; |
9 | import de.uka.ipd.sdq.simucomframework.simucomstatus.SimucomstatusPackage; |
10 | |
11 | import org.eclipse.emf.common.notify.Notification; |
12 | import org.eclipse.emf.common.notify.NotificationChain; |
13 | |
14 | import org.eclipse.emf.ecore.EClass; |
15 | import org.eclipse.emf.ecore.InternalEObject; |
16 | |
17 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
18 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
19 | |
20 | /** |
21 | * <!-- begin-user-doc --> |
22 | * An implementation of the model object '<em><b>Process</b></em>'. |
23 | * <!-- end-user-doc --> |
24 | * <p> |
25 | * The following features are implemented: |
26 | * <ul> |
27 | * <li>{@link de.uka.ipd.sdq.simucomframework.simucomstatus.impl.ProcessImpl#getCurrentAction <em>Current Action</em>}</li> |
28 | * <li>{@link de.uka.ipd.sdq.simucomframework.simucomstatus.impl.ProcessImpl#getId <em>Id</em>}</li> |
29 | * <li>{@link de.uka.ipd.sdq.simucomframework.simucomstatus.impl.ProcessImpl#getProcessStartTime <em>Process Start Time</em>}</li> |
30 | * </ul> |
31 | * </p> |
32 | * |
33 | * @generated |
34 | */ |
35 | public class ProcessImpl extends EObjectImpl implements de.uka.ipd.sdq.simucomframework.simucomstatus.Process { |
36 | /** |
37 | * The cached value of the '{@link #getCurrentAction() <em>Current Action</em>}' containment reference. |
38 | * <!-- begin-user-doc --> |
39 | * <!-- end-user-doc --> |
40 | * @see #getCurrentAction() |
41 | * @generated |
42 | * @ordered |
43 | */ |
44 | protected Action currentAction; |
45 | |
46 | /** |
47 | * The default value of the '{@link #getId() <em>Id</em>}' attribute. |
48 | * <!-- begin-user-doc --> |
49 | * <!-- end-user-doc --> |
50 | * @see #getId() |
51 | * @generated |
52 | * @ordered |
53 | */ |
54 | protected static final String ID_EDEFAULT = null; |
55 | |
56 | /** |
57 | * The cached value of the '{@link #getId() <em>Id</em>}' attribute. |
58 | * <!-- begin-user-doc --> |
59 | * <!-- end-user-doc --> |
60 | * @see #getId() |
61 | * @generated |
62 | * @ordered |
63 | */ |
64 | protected String id = ID_EDEFAULT; |
65 | |
66 | /** |
67 | * The default value of the '{@link #getProcessStartTime() <em>Process Start Time</em>}' attribute. |
68 | * <!-- begin-user-doc --> |
69 | * <!-- end-user-doc --> |
70 | * @see #getProcessStartTime() |
71 | * @generated |
72 | * @ordered |
73 | */ |
74 | protected static final double PROCESS_START_TIME_EDEFAULT = 0.0; |
75 | |
76 | /** |
77 | * The cached value of the '{@link #getProcessStartTime() <em>Process Start Time</em>}' attribute. |
78 | * <!-- begin-user-doc --> |
79 | * <!-- end-user-doc --> |
80 | * @see #getProcessStartTime() |
81 | * @generated |
82 | * @ordered |
83 | */ |
84 | protected double processStartTime = PROCESS_START_TIME_EDEFAULT; |
85 | |
86 | /** |
87 | * <!-- begin-user-doc --> |
88 | * <!-- end-user-doc --> |
89 | * @generated |
90 | */ |
91 | protected ProcessImpl() { |
92 | super(); |
93 | } |
94 | |
95 | /** |
96 | * <!-- begin-user-doc --> |
97 | * <!-- end-user-doc --> |
98 | * @generated |
99 | */ |
100 | @Override |
101 | protected EClass eStaticClass() { |
102 | return SimucomstatusPackage.Literals.PROCESS; |
103 | } |
104 | |
105 | /** |
106 | * <!-- begin-user-doc --> |
107 | * <!-- end-user-doc --> |
108 | * @generated |
109 | */ |
110 | public Action getCurrentAction() { |
111 | return currentAction; |
112 | } |
113 | |
114 | /** |
115 | * <!-- begin-user-doc --> |
116 | * <!-- end-user-doc --> |
117 | * @generated |
118 | */ |
119 | public NotificationChain basicSetCurrentAction(Action newCurrentAction, NotificationChain msgs) { |
120 | Action oldCurrentAction = currentAction; |
121 | currentAction = newCurrentAction; |
122 | if (eNotificationRequired()) { |
123 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SimucomstatusPackage.PROCESS__CURRENT_ACTION, oldCurrentAction, newCurrentAction); |
124 | if (msgs == null) msgs = notification; else msgs.add(notification); |
125 | } |
126 | return msgs; |
127 | } |
128 | |
129 | /** |
130 | * <!-- begin-user-doc --> |
131 | * <!-- end-user-doc --> |
132 | * @generated |
133 | */ |
134 | public void setCurrentAction(Action newCurrentAction) { |
135 | if (newCurrentAction != currentAction) { |
136 | NotificationChain msgs = null; |
137 | if (currentAction != null) |
138 | msgs = ((InternalEObject)currentAction).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SimucomstatusPackage.PROCESS__CURRENT_ACTION, null, msgs); |
139 | if (newCurrentAction != null) |
140 | msgs = ((InternalEObject)newCurrentAction).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SimucomstatusPackage.PROCESS__CURRENT_ACTION, null, msgs); |
141 | msgs = basicSetCurrentAction(newCurrentAction, msgs); |
142 | if (msgs != null) msgs.dispatch(); |
143 | } |
144 | else if (eNotificationRequired()) |
145 | eNotify(new ENotificationImpl(this, Notification.SET, SimucomstatusPackage.PROCESS__CURRENT_ACTION, newCurrentAction, newCurrentAction)); |
146 | } |
147 | |
148 | /** |
149 | * <!-- begin-user-doc --> |
150 | * <!-- end-user-doc --> |
151 | * @generated |
152 | */ |
153 | public String getId() { |
154 | return id; |
155 | } |
156 | |
157 | /** |
158 | * <!-- begin-user-doc --> |
159 | * <!-- end-user-doc --> |
160 | * @generated |
161 | */ |
162 | public void setId(String newId) { |
163 | String oldId = id; |
164 | id = newId; |
165 | if (eNotificationRequired()) |
166 | eNotify(new ENotificationImpl(this, Notification.SET, SimucomstatusPackage.PROCESS__ID, oldId, id)); |
167 | } |
168 | |
169 | /** |
170 | * <!-- begin-user-doc --> |
171 | * <!-- end-user-doc --> |
172 | * @generated |
173 | */ |
174 | public double getProcessStartTime() { |
175 | return processStartTime; |
176 | } |
177 | |
178 | /** |
179 | * <!-- begin-user-doc --> |
180 | * <!-- end-user-doc --> |
181 | * @generated |
182 | */ |
183 | public void setProcessStartTime(double newProcessStartTime) { |
184 | double oldProcessStartTime = processStartTime; |
185 | processStartTime = newProcessStartTime; |
186 | if (eNotificationRequired()) |
187 | eNotify(new ENotificationImpl(this, Notification.SET, SimucomstatusPackage.PROCESS__PROCESS_START_TIME, oldProcessStartTime, processStartTime)); |
188 | } |
189 | |
190 | /** |
191 | * <!-- begin-user-doc --> |
192 | * <!-- end-user-doc --> |
193 | * @generated |
194 | */ |
195 | @Override |
196 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
197 | switch (featureID) { |
198 | case SimucomstatusPackage.PROCESS__CURRENT_ACTION: |
199 | return basicSetCurrentAction(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 SimucomstatusPackage.PROCESS__CURRENT_ACTION: |
213 | return getCurrentAction(); |
214 | case SimucomstatusPackage.PROCESS__ID: |
215 | return getId(); |
216 | case SimucomstatusPackage.PROCESS__PROCESS_START_TIME: |
217 | return new Double(getProcessStartTime()); |
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 SimucomstatusPackage.PROCESS__CURRENT_ACTION: |
231 | setCurrentAction((Action)newValue); |
232 | return; |
233 | case SimucomstatusPackage.PROCESS__ID: |
234 | setId((String)newValue); |
235 | return; |
236 | case SimucomstatusPackage.PROCESS__PROCESS_START_TIME: |
237 | setProcessStartTime(((Double)newValue).doubleValue()); |
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 SimucomstatusPackage.PROCESS__CURRENT_ACTION: |
252 | setCurrentAction((Action)null); |
253 | return; |
254 | case SimucomstatusPackage.PROCESS__ID: |
255 | setId(ID_EDEFAULT); |
256 | return; |
257 | case SimucomstatusPackage.PROCESS__PROCESS_START_TIME: |
258 | setProcessStartTime(PROCESS_START_TIME_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 SimucomstatusPackage.PROCESS__CURRENT_ACTION: |
273 | return currentAction != null; |
274 | case SimucomstatusPackage.PROCESS__ID: |
275 | return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); |
276 | case SimucomstatusPackage.PROCESS__PROCESS_START_TIME: |
277 | return processStartTime != PROCESS_START_TIME_EDEFAULT; |
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(" (id: "); |
293 | result.append(id); |
294 | result.append(", processStartTime: "); |
295 | result.append(processStartTime); |
296 | result.append(')'); |
297 | return result.toString(); |
298 | } |
299 | |
300 | } //ProcessImpl |