EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.featureconfig.impl]

COVERAGE SUMMARY FOR SOURCE FILE [ConfigNodeImpl.java]

nameclass, %method, %block, %line, %
ConfigNodeImpl.java0%   (0/1)0%   (0/18)0%   (0/399)0%   (0/105)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ConfigNodeImpl0%   (0/1)0%   (0/18)0%   (0/399)0%   (0/105)
<static initializer> 0%   (0/1)0%   (0/5)0%   (0/3)
CheckMultiplicityOfFeatureGroup (DiagnosticChain, Map): boolean 0%   (0/1)0%   (0/62)0%   (0/17)
ConfigCardinalityInvalid (DiagnosticChain, Map): boolean 0%   (0/1)0%   (0/62)0%   (0/17)
ConfigNodeImpl (): void 0%   (0/1)0%   (0/6)0%   (0/3)
basicGetOrigin (): Feature 0%   (0/1)0%   (0/3)0%   (0/1)
eGet (int, boolean, boolean): Object 0%   (0/1)0%   (0/22)0%   (0/6)
eInverseAdd (InternalEObject, int, NotificationChain): NotificationChain 0%   (0/1)0%   (0/15)0%   (0/3)
eInverseRemove (InternalEObject, int, NotificationChain): NotificationChain 0%   (0/1)0%   (0/15)0%   (0/3)
eIsSet (int): boolean 0%   (0/1)0%   (0/32)0%   (0/5)
eSet (int, Object): void 0%   (0/1)0%   (0/27)0%   (0/10)
eStaticClass (): EClass 0%   (0/1)0%   (0/2)0%   (0/1)
eUnset (int): void 0%   (0/1)0%   (0/18)0%   (0/9)
getAttributevalue (): EList 0%   (0/1)0%   (0/15)0%   (0/3)
getConfigState (): ConfigState 0%   (0/1)0%   (0/3)0%   (0/1)
getOrigin (): Feature 0%   (0/1)0%   (0/38)0%   (0/7)
setConfigState (ConfigState): void 0%   (0/1)0%   (0/25)0%   (0/5)
setOrigin (Feature): void 0%   (0/1)0%   (0/21)0%   (0/5)
toString (): String 0%   (0/1)0%   (0/28)0%   (0/6)

1/**
2 * <copyright>
3 * </copyright>
4 *
5 * $Id$
6 */
7package de.uka.ipd.sdq.featureconfig.impl;
8 
9import java.util.Collection;
10import java.util.Map;
11 
12import org.eclipse.emf.common.notify.Notification;
13import org.eclipse.emf.common.notify.NotificationChain;
14import org.eclipse.emf.common.util.BasicDiagnostic;
15import org.eclipse.emf.common.util.Diagnostic;
16import org.eclipse.emf.common.util.DiagnosticChain;
17import org.eclipse.emf.common.util.EList;
18import org.eclipse.emf.ecore.EClass;
19import org.eclipse.emf.ecore.InternalEObject;
20import org.eclipse.emf.ecore.impl.ENotificationImpl;
21import org.eclipse.emf.ecore.impl.EObjectImpl;
22import org.eclipse.emf.ecore.plugin.EcorePlugin;
23import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
24import org.eclipse.emf.ecore.util.EObjectValidator;
25import org.eclipse.emf.ecore.util.InternalEList;
26import org.eclipse.ocl.ParserException;
27import org.eclipse.ocl.ecore.Constraint;
28import org.eclipse.ocl.ecore.OCL;
29 
30import de.uka.ipd.sdq.featureconfig.AttributeValue;
31import de.uka.ipd.sdq.featureconfig.ConfigNode;
32import de.uka.ipd.sdq.featureconfig.ConfigState;
33import de.uka.ipd.sdq.featureconfig.featureconfigPackage;
34import de.uka.ipd.sdq.featureconfig.util.featureconfigValidator;
35import de.uka.ipd.sdq.featuremodel.Feature;
36 
37/**
38 * <!-- begin-user-doc -->
39 * An implementation of the model object '<em><b>Config Node</b></em>'.
40 * <!-- end-user-doc -->
41 * <p>
42 * The following features are implemented:
43 * <ul>
44 *   <li>{@link de.uka.ipd.sdq.featureconfig.impl.ConfigNodeImpl#getOrigin <em>Origin</em>}</li>
45 *   <li>{@link de.uka.ipd.sdq.featureconfig.impl.ConfigNodeImpl#getConfigState <em>Config State</em>}</li>
46 *   <li>{@link de.uka.ipd.sdq.featureconfig.impl.ConfigNodeImpl#getAttributevalue <em>Attributevalue</em>}</li>
47 * </ul>
48 * </p>
49 *
50 * @generated
51 */
52public class ConfigNodeImpl extends EObjectImpl implements ConfigNode {
53        /**
54         * The cached value of the '{@link #getOrigin() <em>Origin</em>}' reference.
55         * <!-- begin-user-doc -->
56         * <!-- end-user-doc -->
57         * @see #getOrigin()
58         * @generated
59         * @ordered
60         */
61        protected Feature origin;
62 
63        /**
64         * The default value of the '{@link #getConfigState() <em>Config State</em>}' attribute.
65         * <!-- begin-user-doc -->
66         * <!-- end-user-doc -->
67         * @see #getConfigState()
68         * @generated
69         * @ordered
70         */
71        protected static final ConfigState CONFIG_STATE_EDEFAULT = ConfigState.DEFAULT;
72 
73        /**
74         * The cached value of the '{@link #getConfigState() <em>Config State</em>}' attribute.
75         * <!-- begin-user-doc -->
76         * <!-- end-user-doc -->
77         * @see #getConfigState()
78         * @generated
79         * @ordered
80         */
81        protected ConfigState configState = CONFIG_STATE_EDEFAULT;
82 
83        /**
84         * The cached value of the '{@link #getAttributevalue() <em>Attributevalue</em>}' containment reference list.
85         * <!-- begin-user-doc -->
86         * <!-- end-user-doc -->
87         * @see #getAttributevalue()
88         * @generated
89         * @ordered
90         */
91        protected EList<AttributeValue> attributevalue;
92 
93        /**
94         * <!-- begin-user-doc -->
95         * <!-- end-user-doc -->
96         * @generated
97         */
98        protected ConfigNodeImpl() {
99                super();
100        }
101 
102        /**
103         * <!-- begin-user-doc -->
104         * <!-- end-user-doc -->
105         * @generated
106         */
107        @Override
108        protected EClass eStaticClass() {
109                return featureconfigPackage.Literals.CONFIG_NODE;
110        }
111 
112        /**
113         * <!-- begin-user-doc -->
114         * <!-- end-user-doc -->
115         * @generated
116         */
117        public Feature getOrigin() {
118                if (origin != null && origin.eIsProxy()) {
119                        InternalEObject oldOrigin = (InternalEObject)origin;
120                        origin = (Feature)eResolveProxy(oldOrigin);
121                        if (origin != oldOrigin) {
122                                if (eNotificationRequired())
123                                        eNotify(new ENotificationImpl(this, Notification.RESOLVE, featureconfigPackage.CONFIG_NODE__ORIGIN, oldOrigin, origin));
124                        }
125                }
126                return origin;
127        }
128 
129        /**
130         * <!-- begin-user-doc -->
131         * <!-- end-user-doc -->
132         * @generated
133         */
134        public Feature basicGetOrigin() {
135                return origin;
136        }
137 
138        /**
139         * <!-- begin-user-doc -->
140         * <!-- end-user-doc -->
141         * @generated
142         */
143        public void setOrigin(Feature newOrigin) {
144                Feature oldOrigin = origin;
145                origin = newOrigin;
146                if (eNotificationRequired())
147                        eNotify(new ENotificationImpl(this, Notification.SET, featureconfigPackage.CONFIG_NODE__ORIGIN, oldOrigin, origin));
148        }
149 
150        /**
151         * <!-- begin-user-doc -->
152         * <!-- end-user-doc -->
153         * @generated
154         */
155        public ConfigState getConfigState() {
156                return configState;
157        }
158 
159        /**
160         * <!-- begin-user-doc -->
161         * <!-- end-user-doc -->
162         * @generated
163         */
164        public void setConfigState(ConfigState newConfigState) {
165                ConfigState oldConfigState = configState;
166                configState = newConfigState == null ? CONFIG_STATE_EDEFAULT : newConfigState;
167                if (eNotificationRequired())
168                        eNotify(new ENotificationImpl(this, Notification.SET, featureconfigPackage.CONFIG_NODE__CONFIG_STATE, oldConfigState, configState));
169        }
170 
171        /**
172         * <!-- begin-user-doc -->
173         * <!-- end-user-doc -->
174         * @generated
175         */
176        public EList<AttributeValue> getAttributevalue() {
177                if (attributevalue == null) {
178                        attributevalue = new EObjectContainmentWithInverseEList<AttributeValue>(AttributeValue.class, this, featureconfigPackage.CONFIG_NODE__ATTRIBUTEVALUE, featureconfigPackage.ATTRIBUTE_VALUE__CONFIGNODE);
179                }
180                return attributevalue;
181        }
182 
183        /**
184         * The cached OCL expression body for the '{@link #ConfigCardinalityInvalid(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Config Cardinality Invalid</em>}' operation.
185         * <!-- begin-user-doc -->
186         * <!-- end-user-doc -->
187         * @see #ConfigCardinalityInvalid(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
188         * @generated
189         * @ordered
190         */
191        protected static final String CONFIG_CARDINALITY_INVALID__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "true "+
192"--let childSelectedCount : Integer = self.children->select(c|c.configState = ConfigState::USER_SELECTED or c.configState = ConfigState::MASCHINE_SELECTED)->size() "+
193"--in "+
194"--         if self.origin.oclIsTypeOf(featuremodel::FeatureGroup) then"+
195"--                 childSelectedCount >= self.origin.min and (childSelectedCount <= self.origin.max or self.origin.max = -1)"+
196"--         else"+
197"--                 self.origin.min  >= 1 implies (self.configState = ConfigState::USER_SELECTED or self.configState = ConfigState::MASCHINE_SELECTED)"+
198"--         endif";
199 
200        /**
201         * The cached OCL invariant for the '{@link #ConfigCardinalityInvalid(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Config Cardinality Invalid</em>}' invariant operation.
202         * <!-- begin-user-doc -->
203         * <!-- end-user-doc -->
204         * @see #ConfigCardinalityInvalid(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
205         * @generated
206         * @ordered
207         */
208        protected static Constraint CONFIG_CARDINALITY_INVALID__DIAGNOSTIC_CHAIN_MAP__EOCL_INV;
209 
210        /**
211         * <!-- begin-user-doc -->
212         * <!-- end-user-doc -->
213         * @generated
214         */
215        public boolean ConfigCardinalityInvalid(DiagnosticChain diagnostics, Map<Object, Object> context) {
216                if (CONFIG_CARDINALITY_INVALID__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
217                        OCL.Helper helper = EOCL_ENV.createOCLHelper();
218                        helper.setContext(featureconfigPackage.Literals.CONFIG_NODE);
219                        try {
220                                CONFIG_CARDINALITY_INVALID__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(CONFIG_CARDINALITY_INVALID__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP);
221                        }
222                        catch (ParserException pe) {
223                                throw new UnsupportedOperationException(pe.getLocalizedMessage());
224                        }
225                }
226                if (!EOCL_ENV.createQuery(CONFIG_CARDINALITY_INVALID__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(this)) {
227                        if (diagnostics != null) {
228                                diagnostics.add
229                                        (new BasicDiagnostic
230                                                (Diagnostic.ERROR,
231                                                 featureconfigValidator.DIAGNOSTIC_SOURCE,
232                                                 featureconfigValidator.CONFIG_NODE__CONFIG_CARDINALITY_INVALID,
233                                                 EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "ConfigCardinalityInvalid", EObjectValidator.getObjectLabel(this, context) }),
234                                                 new Object [] { this }));
235                        }
236                        return false;
237                }
238                return true;
239        }
240 
241        /**
242         * The cached OCL expression body for the '{@link #CheckMultiplicityOfFeatureGroup(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Check Multiplicity Of Feature Group</em>}' operation.
243         * <!-- begin-user-doc -->
244         * <!-- end-user-doc -->
245         * @see #CheckMultiplicityOfFeatureGroup(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
246         * @generated
247         * @ordered
248         */
249        protected static final String CHECK_MULTIPLICITY_OF_FEATURE_GROUP__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "true"+
250"--not self.origin.featuregroup->isEmpty() implies (self.origin.featuregroup.children->size() <=  self.origin.featuregroup.max and self.origin.featuregroup.children->size() >=  self.origin.featuregroup.min)";
251 
252        /**
253         * The cached OCL invariant for the '{@link #CheckMultiplicityOfFeatureGroup(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Check Multiplicity Of Feature Group</em>}' invariant operation.
254         * <!-- begin-user-doc -->
255         * <!-- end-user-doc -->
256         * @see #CheckMultiplicityOfFeatureGroup(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
257         * @generated
258         * @ordered
259         */
260        protected static Constraint CHECK_MULTIPLICITY_OF_FEATURE_GROUP__DIAGNOSTIC_CHAIN_MAP__EOCL_INV;
261 
262        /**
263         * <!-- begin-user-doc -->
264         * <!-- end-user-doc -->
265         * @generated
266         */
267        public boolean CheckMultiplicityOfFeatureGroup(DiagnosticChain diagnostics, Map<Object, Object> context) {
268                if (CHECK_MULTIPLICITY_OF_FEATURE_GROUP__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
269                        OCL.Helper helper = EOCL_ENV.createOCLHelper();
270                        helper.setContext(featureconfigPackage.Literals.CONFIG_NODE);
271                        try {
272                                CHECK_MULTIPLICITY_OF_FEATURE_GROUP__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(CHECK_MULTIPLICITY_OF_FEATURE_GROUP__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP);
273                        }
274                        catch (ParserException pe) {
275                                throw new UnsupportedOperationException(pe.getLocalizedMessage());
276                        }
277                }
278                if (!EOCL_ENV.createQuery(CHECK_MULTIPLICITY_OF_FEATURE_GROUP__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(this)) {
279                        if (diagnostics != null) {
280                                diagnostics.add
281                                        (new BasicDiagnostic
282                                                (Diagnostic.ERROR,
283                                                 featureconfigValidator.DIAGNOSTIC_SOURCE,
284                                                 featureconfigValidator.CONFIG_NODE__CHECK_MULTIPLICITY_OF_FEATURE_GROUP,
285                                                 EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "CheckMultiplicityOfFeatureGroup", EObjectValidator.getObjectLabel(this, context) }),
286                                                 new Object [] { this }));
287                        }
288                        return false;
289                }
290                return true;
291        }
292 
293        /**
294         * <!-- begin-user-doc -->
295         * <!-- end-user-doc -->
296         * @generated
297         */
298        @SuppressWarnings("unchecked")
299        @Override
300        public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
301                switch (featureID) {
302                        case featureconfigPackage.CONFIG_NODE__ATTRIBUTEVALUE:
303                                return ((InternalEList<InternalEObject>)(InternalEList<?>)getAttributevalue()).basicAdd(otherEnd, msgs);
304                }
305                return super.eInverseAdd(otherEnd, featureID, msgs);
306        }
307 
308        /**
309         * <!-- begin-user-doc -->
310         * <!-- end-user-doc -->
311         * @generated
312         */
313        @Override
314        public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
315                switch (featureID) {
316                        case featureconfigPackage.CONFIG_NODE__ATTRIBUTEVALUE:
317                                return ((InternalEList<?>)getAttributevalue()).basicRemove(otherEnd, msgs);
318                }
319                return super.eInverseRemove(otherEnd, featureID, msgs);
320        }
321 
322        /**
323         * <!-- begin-user-doc -->
324         * <!-- end-user-doc -->
325         * @generated
326         */
327        @Override
328        public Object eGet(int featureID, boolean resolve, boolean coreType) {
329                switch (featureID) {
330                        case featureconfigPackage.CONFIG_NODE__ORIGIN:
331                                if (resolve) return getOrigin();
332                                return basicGetOrigin();
333                        case featureconfigPackage.CONFIG_NODE__CONFIG_STATE:
334                                return getConfigState();
335                        case featureconfigPackage.CONFIG_NODE__ATTRIBUTEVALUE:
336                                return getAttributevalue();
337                }
338                return super.eGet(featureID, resolve, coreType);
339        }
340 
341        /**
342         * <!-- begin-user-doc -->
343         * <!-- end-user-doc -->
344         * @generated
345         */
346        @SuppressWarnings("unchecked")
347        @Override
348        public void eSet(int featureID, Object newValue) {
349                switch (featureID) {
350                        case featureconfigPackage.CONFIG_NODE__ORIGIN:
351                                setOrigin((Feature)newValue);
352                                return;
353                        case featureconfigPackage.CONFIG_NODE__CONFIG_STATE:
354                                setConfigState((ConfigState)newValue);
355                                return;
356                        case featureconfigPackage.CONFIG_NODE__ATTRIBUTEVALUE:
357                                getAttributevalue().clear();
358                                getAttributevalue().addAll((Collection<? extends AttributeValue>)newValue);
359                                return;
360                }
361                super.eSet(featureID, newValue);
362        }
363 
364        /**
365         * <!-- begin-user-doc -->
366         * <!-- end-user-doc -->
367         * @generated
368         */
369        @Override
370        public void eUnset(int featureID) {
371                switch (featureID) {
372                        case featureconfigPackage.CONFIG_NODE__ORIGIN:
373                                setOrigin((Feature)null);
374                                return;
375                        case featureconfigPackage.CONFIG_NODE__CONFIG_STATE:
376                                setConfigState(CONFIG_STATE_EDEFAULT);
377                                return;
378                        case featureconfigPackage.CONFIG_NODE__ATTRIBUTEVALUE:
379                                getAttributevalue().clear();
380                                return;
381                }
382                super.eUnset(featureID);
383        }
384 
385        /**
386         * <!-- begin-user-doc -->
387         * <!-- end-user-doc -->
388         * @generated
389         */
390        @Override
391        public boolean eIsSet(int featureID) {
392                switch (featureID) {
393                        case featureconfigPackage.CONFIG_NODE__ORIGIN:
394                                return origin != null;
395                        case featureconfigPackage.CONFIG_NODE__CONFIG_STATE:
396                                return configState != CONFIG_STATE_EDEFAULT;
397                        case featureconfigPackage.CONFIG_NODE__ATTRIBUTEVALUE:
398                                return attributevalue != null && !attributevalue.isEmpty();
399                }
400                return super.eIsSet(featureID);
401        }
402 
403        /**
404         * <!-- begin-user-doc -->
405         * <!-- end-user-doc -->
406         * @generated
407         */
408        @Override
409        public String toString() {
410                if (eIsProxy()) return super.toString();
411 
412                StringBuffer result = new StringBuffer(super.toString());
413                result.append(" (configState: ");
414                result.append(configState);
415                result.append(')');
416                return result.toString();
417        }
418 
419        /**
420         * The cached environment for evaluating OCL expressions.
421         * <!-- begin-user-doc -->
422         * <!-- end-user-doc -->
423         * @generated
424         * @ordered
425         */
426        protected static final OCL EOCL_ENV = OCL.newInstance();
427 
428} //ConfigNodeImpl

[all classes][de.uka.ipd.sdq.featureconfig.impl]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov