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.featuremodel.FeatureGroup; |
10 | |
11 | import de.uka.ipd.sdq.pcm.designdecision.FeatureGroupDegree; |
12 | import de.uka.ipd.sdq.pcm.designdecision.FeatureSubset; |
13 | import de.uka.ipd.sdq.pcm.designdecision.designdecisionPackage; |
14 | |
15 | import java.util.Collection; |
16 | |
17 | import org.eclipse.emf.common.notify.Notification; |
18 | import org.eclipse.emf.common.notify.NotificationChain; |
19 | |
20 | import org.eclipse.emf.common.util.EList; |
21 | |
22 | import org.eclipse.emf.ecore.EClass; |
23 | import org.eclipse.emf.ecore.InternalEObject; |
24 | |
25 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
26 | |
27 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
28 | import org.eclipse.emf.ecore.util.InternalEList; |
29 | |
30 | /** |
31 | * <!-- begin-user-doc --> |
32 | * An implementation of the model object '<em><b>Feature Group Degree</b></em>'. |
33 | * <!-- end-user-doc --> |
34 | * <p> |
35 | * The following features are implemented: |
36 | * <ul> |
37 | * <li>{@link de.uka.ipd.sdq.pcm.designdecision.impl.FeatureGroupDegreeImpl#getFeaturegroup <em>Featuregroup</em>}</li> |
38 | * <li>{@link de.uka.ipd.sdq.pcm.designdecision.impl.FeatureGroupDegreeImpl#getDomainOfFeatureConfigCombinations <em>Domain Of Feature Config Combinations</em>}</li> |
39 | * </ul> |
40 | * </p> |
41 | * |
42 | * @generated |
43 | */ |
44 | public class FeatureGroupDegreeImpl extends FeatureConfigDegreeImpl implements FeatureGroupDegree { |
45 | /** |
46 | * The cached value of the '{@link #getFeaturegroup() <em>Featuregroup</em>}' reference. |
47 | * <!-- begin-user-doc --> |
48 | * <!-- end-user-doc --> |
49 | * @see #getFeaturegroup() |
50 | * @generated |
51 | * @ordered |
52 | */ |
53 | protected FeatureGroup featuregroup; |
54 | |
55 | /** |
56 | * The cached value of the '{@link #getDomainOfFeatureConfigCombinations() <em>Domain Of Feature Config Combinations</em>}' containment reference list. |
57 | * <!-- begin-user-doc --> |
58 | * <!-- end-user-doc --> |
59 | * @see #getDomainOfFeatureConfigCombinations() |
60 | * @generated |
61 | * @ordered |
62 | */ |
63 | protected EList<FeatureSubset> domainOfFeatureConfigCombinations; |
64 | |
65 | /** |
66 | * <!-- begin-user-doc --> |
67 | * <!-- end-user-doc --> |
68 | * @generated |
69 | */ |
70 | protected FeatureGroupDegreeImpl() { |
71 | super(); |
72 | } |
73 | |
74 | /** |
75 | * <!-- begin-user-doc --> |
76 | * <!-- end-user-doc --> |
77 | * @generated |
78 | */ |
79 | @Override |
80 | protected EClass eStaticClass() { |
81 | return designdecisionPackage.Literals.FEATURE_GROUP_DEGREE; |
82 | } |
83 | |
84 | /** |
85 | * <!-- begin-user-doc --> |
86 | * <!-- end-user-doc --> |
87 | * @generated |
88 | */ |
89 | public FeatureGroup getFeaturegroup() { |
90 | if (featuregroup != null && featuregroup.eIsProxy()) { |
91 | InternalEObject oldFeaturegroup = (InternalEObject)featuregroup; |
92 | featuregroup = (FeatureGroup)eResolveProxy(oldFeaturegroup); |
93 | if (featuregroup != oldFeaturegroup) { |
94 | if (eNotificationRequired()) |
95 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, designdecisionPackage.FEATURE_GROUP_DEGREE__FEATUREGROUP, oldFeaturegroup, featuregroup)); |
96 | } |
97 | } |
98 | return featuregroup; |
99 | } |
100 | |
101 | /** |
102 | * <!-- begin-user-doc --> |
103 | * <!-- end-user-doc --> |
104 | * @generated |
105 | */ |
106 | public FeatureGroup basicGetFeaturegroup() { |
107 | return featuregroup; |
108 | } |
109 | |
110 | /** |
111 | * <!-- begin-user-doc --> |
112 | * <!-- end-user-doc --> |
113 | * @generated |
114 | */ |
115 | public void setFeaturegroup(FeatureGroup newFeaturegroup) { |
116 | FeatureGroup oldFeaturegroup = featuregroup; |
117 | featuregroup = newFeaturegroup; |
118 | if (eNotificationRequired()) |
119 | eNotify(new ENotificationImpl(this, Notification.SET, designdecisionPackage.FEATURE_GROUP_DEGREE__FEATUREGROUP, oldFeaturegroup, featuregroup)); |
120 | } |
121 | |
122 | /** |
123 | * <!-- begin-user-doc --> |
124 | * <!-- end-user-doc --> |
125 | * @generated |
126 | */ |
127 | public EList<FeatureSubset> getDomainOfFeatureConfigCombinations() { |
128 | if (domainOfFeatureConfigCombinations == null) { |
129 | domainOfFeatureConfigCombinations = new EObjectContainmentEList<FeatureSubset>(FeatureSubset.class, this, designdecisionPackage.FEATURE_GROUP_DEGREE__DOMAIN_OF_FEATURE_CONFIG_COMBINATIONS); |
130 | } |
131 | return domainOfFeatureConfigCombinations; |
132 | } |
133 | |
134 | /** |
135 | * <!-- begin-user-doc --> |
136 | * <!-- end-user-doc --> |
137 | * @generated |
138 | */ |
139 | @Override |
140 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
141 | switch (featureID) { |
142 | case designdecisionPackage.FEATURE_GROUP_DEGREE__DOMAIN_OF_FEATURE_CONFIG_COMBINATIONS: |
143 | return ((InternalEList<?>)getDomainOfFeatureConfigCombinations()).basicRemove(otherEnd, msgs); |
144 | } |
145 | return super.eInverseRemove(otherEnd, featureID, msgs); |
146 | } |
147 | |
148 | /** |
149 | * <!-- begin-user-doc --> |
150 | * <!-- end-user-doc --> |
151 | * @generated |
152 | */ |
153 | @Override |
154 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
155 | switch (featureID) { |
156 | case designdecisionPackage.FEATURE_GROUP_DEGREE__FEATUREGROUP: |
157 | if (resolve) return getFeaturegroup(); |
158 | return basicGetFeaturegroup(); |
159 | case designdecisionPackage.FEATURE_GROUP_DEGREE__DOMAIN_OF_FEATURE_CONFIG_COMBINATIONS: |
160 | return getDomainOfFeatureConfigCombinations(); |
161 | } |
162 | return super.eGet(featureID, resolve, coreType); |
163 | } |
164 | |
165 | /** |
166 | * <!-- begin-user-doc --> |
167 | * <!-- end-user-doc --> |
168 | * @generated |
169 | */ |
170 | @SuppressWarnings("unchecked") |
171 | @Override |
172 | public void eSet(int featureID, Object newValue) { |
173 | switch (featureID) { |
174 | case designdecisionPackage.FEATURE_GROUP_DEGREE__FEATUREGROUP: |
175 | setFeaturegroup((FeatureGroup)newValue); |
176 | return; |
177 | case designdecisionPackage.FEATURE_GROUP_DEGREE__DOMAIN_OF_FEATURE_CONFIG_COMBINATIONS: |
178 | getDomainOfFeatureConfigCombinations().clear(); |
179 | getDomainOfFeatureConfigCombinations().addAll((Collection<? extends FeatureSubset>)newValue); |
180 | return; |
181 | } |
182 | super.eSet(featureID, newValue); |
183 | } |
184 | |
185 | /** |
186 | * <!-- begin-user-doc --> |
187 | * <!-- end-user-doc --> |
188 | * @generated |
189 | */ |
190 | @Override |
191 | public void eUnset(int featureID) { |
192 | switch (featureID) { |
193 | case designdecisionPackage.FEATURE_GROUP_DEGREE__FEATUREGROUP: |
194 | setFeaturegroup((FeatureGroup)null); |
195 | return; |
196 | case designdecisionPackage.FEATURE_GROUP_DEGREE__DOMAIN_OF_FEATURE_CONFIG_COMBINATIONS: |
197 | getDomainOfFeatureConfigCombinations().clear(); |
198 | return; |
199 | } |
200 | super.eUnset(featureID); |
201 | } |
202 | |
203 | /** |
204 | * <!-- begin-user-doc --> |
205 | * <!-- end-user-doc --> |
206 | * @generated |
207 | */ |
208 | @Override |
209 | public boolean eIsSet(int featureID) { |
210 | switch (featureID) { |
211 | case designdecisionPackage.FEATURE_GROUP_DEGREE__FEATUREGROUP: |
212 | return featuregroup != null; |
213 | case designdecisionPackage.FEATURE_GROUP_DEGREE__DOMAIN_OF_FEATURE_CONFIG_COMBINATIONS: |
214 | return domainOfFeatureConfigCombinations != null && !domainOfFeatureConfigCombinations.isEmpty(); |
215 | } |
216 | return super.eIsSet(featureID); |
217 | } |
218 | |
219 | } //FeatureGroupDegreeImpl |