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