1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.probespec.impl; |
8 | |
9 | import de.uka.ipd.sdq.identifier.impl.IdentifierImpl; |
10 | |
11 | import de.uka.ipd.sdq.pipesandfilters.PipeElement; |
12 | |
13 | import de.uka.ipd.sdq.probespec.Calculator; |
14 | import de.uka.ipd.sdq.probespec.probespecPackage; |
15 | |
16 | import org.eclipse.emf.common.notify.Notification; |
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>Calculator</b></em>'. |
26 | * <!-- end-user-doc --> |
27 | * <p> |
28 | * The following features are implemented: |
29 | * <ul> |
30 | * <li>{@link de.uka.ipd.sdq.probespec.impl.CalculatorImpl#isActive <em>Active</em>}</li> |
31 | * <li>{@link de.uka.ipd.sdq.probespec.impl.CalculatorImpl#getPipeElement <em>Pipe Element</em>}</li> |
32 | * </ul> |
33 | * </p> |
34 | * |
35 | * @generated |
36 | */ |
37 | public abstract class CalculatorImpl extends IdentifierImpl implements Calculator { |
38 | /** |
39 | * The default value of the '{@link #isActive() <em>Active</em>}' attribute. |
40 | * <!-- begin-user-doc --> |
41 | * <!-- end-user-doc --> |
42 | * @see #isActive() |
43 | * @generated |
44 | * @ordered |
45 | */ |
46 | protected static final boolean ACTIVE_EDEFAULT = true; |
47 | |
48 | /** |
49 | * The cached value of the '{@link #isActive() <em>Active</em>}' attribute. |
50 | * <!-- begin-user-doc --> |
51 | * <!-- end-user-doc --> |
52 | * @see #isActive() |
53 | * @generated |
54 | * @ordered |
55 | */ |
56 | protected boolean active = ACTIVE_EDEFAULT; |
57 | |
58 | /** |
59 | * The cached value of the '{@link #getPipeElement() <em>Pipe Element</em>}' reference. |
60 | * <!-- begin-user-doc --> |
61 | * <!-- end-user-doc --> |
62 | * @see #getPipeElement() |
63 | * @generated |
64 | * @ordered |
65 | */ |
66 | protected PipeElement pipeElement; |
67 | |
68 | /** |
69 | * <!-- begin-user-doc --> |
70 | * <!-- end-user-doc --> |
71 | * @generated |
72 | */ |
73 | protected CalculatorImpl() { |
74 | super(); |
75 | } |
76 | |
77 | /** |
78 | * <!-- begin-user-doc --> |
79 | * <!-- end-user-doc --> |
80 | * @generated |
81 | */ |
82 | @Override |
83 | protected EClass eStaticClass() { |
84 | return probespecPackage.Literals.CALCULATOR; |
85 | } |
86 | |
87 | /** |
88 | * <!-- begin-user-doc --> |
89 | * <!-- end-user-doc --> |
90 | * @generated |
91 | */ |
92 | public boolean isActive() { |
93 | return active; |
94 | } |
95 | |
96 | /** |
97 | * <!-- begin-user-doc --> |
98 | * <!-- end-user-doc --> |
99 | * @generated |
100 | */ |
101 | public void setActive(boolean newActive) { |
102 | boolean oldActive = active; |
103 | active = newActive; |
104 | if (eNotificationRequired()) |
105 | eNotify(new ENotificationImpl(this, Notification.SET, probespecPackage.CALCULATOR__ACTIVE, oldActive, active)); |
106 | } |
107 | |
108 | /** |
109 | * <!-- begin-user-doc --> |
110 | * <!-- end-user-doc --> |
111 | * @generated |
112 | */ |
113 | public PipeElement getPipeElement() { |
114 | if (pipeElement != null && pipeElement.eIsProxy()) { |
115 | InternalEObject oldPipeElement = (InternalEObject)pipeElement; |
116 | pipeElement = (PipeElement)eResolveProxy(oldPipeElement); |
117 | if (pipeElement != oldPipeElement) { |
118 | if (eNotificationRequired()) |
119 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, probespecPackage.CALCULATOR__PIPE_ELEMENT, oldPipeElement, pipeElement)); |
120 | } |
121 | } |
122 | return pipeElement; |
123 | } |
124 | |
125 | /** |
126 | * <!-- begin-user-doc --> |
127 | * <!-- end-user-doc --> |
128 | * @generated |
129 | */ |
130 | public PipeElement basicGetPipeElement() { |
131 | return pipeElement; |
132 | } |
133 | |
134 | /** |
135 | * <!-- begin-user-doc --> |
136 | * <!-- end-user-doc --> |
137 | * @generated |
138 | */ |
139 | public void setPipeElement(PipeElement newPipeElement) { |
140 | PipeElement oldPipeElement = pipeElement; |
141 | pipeElement = newPipeElement; |
142 | if (eNotificationRequired()) |
143 | eNotify(new ENotificationImpl(this, Notification.SET, probespecPackage.CALCULATOR__PIPE_ELEMENT, oldPipeElement, pipeElement)); |
144 | } |
145 | |
146 | /** |
147 | * <!-- begin-user-doc --> |
148 | * <!-- end-user-doc --> |
149 | * @generated |
150 | */ |
151 | @Override |
152 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
153 | switch (featureID) { |
154 | case probespecPackage.CALCULATOR__ACTIVE: |
155 | return isActive() ? Boolean.TRUE : Boolean.FALSE; |
156 | case probespecPackage.CALCULATOR__PIPE_ELEMENT: |
157 | if (resolve) return getPipeElement(); |
158 | return basicGetPipeElement(); |
159 | } |
160 | return super.eGet(featureID, resolve, coreType); |
161 | } |
162 | |
163 | /** |
164 | * <!-- begin-user-doc --> |
165 | * <!-- end-user-doc --> |
166 | * @generated |
167 | */ |
168 | @Override |
169 | public void eSet(int featureID, Object newValue) { |
170 | switch (featureID) { |
171 | case probespecPackage.CALCULATOR__ACTIVE: |
172 | setActive(((Boolean)newValue).booleanValue()); |
173 | return; |
174 | case probespecPackage.CALCULATOR__PIPE_ELEMENT: |
175 | setPipeElement((PipeElement)newValue); |
176 | return; |
177 | } |
178 | super.eSet(featureID, newValue); |
179 | } |
180 | |
181 | /** |
182 | * <!-- begin-user-doc --> |
183 | * <!-- end-user-doc --> |
184 | * @generated |
185 | */ |
186 | @Override |
187 | public void eUnset(int featureID) { |
188 | switch (featureID) { |
189 | case probespecPackage.CALCULATOR__ACTIVE: |
190 | setActive(ACTIVE_EDEFAULT); |
191 | return; |
192 | case probespecPackage.CALCULATOR__PIPE_ELEMENT: |
193 | setPipeElement((PipeElement)null); |
194 | return; |
195 | } |
196 | super.eUnset(featureID); |
197 | } |
198 | |
199 | /** |
200 | * <!-- begin-user-doc --> |
201 | * <!-- end-user-doc --> |
202 | * @generated |
203 | */ |
204 | @Override |
205 | public boolean eIsSet(int featureID) { |
206 | switch (featureID) { |
207 | case probespecPackage.CALCULATOR__ACTIVE: |
208 | return active != ACTIVE_EDEFAULT; |
209 | case probespecPackage.CALCULATOR__PIPE_ELEMENT: |
210 | return pipeElement != null; |
211 | } |
212 | return super.eIsSet(featureID); |
213 | } |
214 | |
215 | /** |
216 | * <!-- begin-user-doc --> |
217 | * <!-- end-user-doc --> |
218 | * @generated |
219 | */ |
220 | @Override |
221 | public String toString() { |
222 | if (eIsProxy()) return super.toString(); |
223 | |
224 | StringBuffer result = new StringBuffer(super.toString()); |
225 | result.append(" (active: "); |
226 | result.append(active); |
227 | result.append(')'); |
228 | return result.toString(); |
229 | } |
230 | |
231 | } //CalculatorImpl |