Skip to content

Package: LeafConditionImpl

LeafConditionImpl

nameinstructionbranchcomplexitylinemethod
LeafConditionImpl()
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
basicSetDomainModelReference(VDomainModelReference, NotificationChain)
M: 4 C: 25
86%
M: 1 C: 3
75%
M: 1 C: 2
67%
M: 1 C: 9
90%
M: 0 C: 1
100%
basicSetValueDomainModelReference(VDomainModelReference, NotificationChain)
M: 18 C: 11
38%
M: 3 C: 1
25%
M: 2 C: 1
33%
M: 7 C: 4
36%
M: 0 C: 1
100%
doEvaluate(EObject, EStructuralFeature, Object, boolean, Object, CompareType)
M: 15 C: 60
80%
M: 6 C: 12
67%
M: 4 C: 6
60%
M: 4 C: 18
82%
M: 0 C: 1
100%
eGet(int, boolean, boolean)
M: 6 C: 14
70%
M: 1 C: 4
80%
M: 1 C: 4
80%
M: 1 C: 5
83%
M: 0 C: 1
100%
eInverseRemove(InternalEObject, int, NotificationChain)
M: 18 C: 0
0%
M: 3 C: 0
0%
M: 3 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
eIsSet(int)
M: 14 C: 32
70%
M: 5 C: 12
71%
M: 4 C: 7
64%
M: 2 C: 5
71%
M: 0 C: 1
100%
eSet(int, Object)
M: 10 C: 16
62%
M: 2 C: 3
60%
M: 2 C: 3
60%
M: 4 C: 7
64%
M: 0 C: 1
100%
eStaticClass()
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
eUnset(int)
M: 22 C: 0
0%
M: 5 C: 0
0%
M: 5 C: 0
0%
M: 11 C: 0
0%
M: 1 C: 0
0%
evaluate(EObject)
M: 1 C: 37
97%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 10
100%
M: 0 C: 1
100%
evaluateChangedValues(EObject, Map)
M: 19 C: 105
85%
M: 2 C: 8
80%
M: 2 C: 4
67%
M: 4 C: 24
86%
M: 0 C: 1
100%
getCompareType()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getDomainModelReference()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getExpectedValue()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getValueDomainModelReference()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
setCompareType(CompareType)
M: 13 C: 12
48%
M: 2 C: 2
50%
M: 2 C: 1
33%
M: 2 C: 4
67%
M: 0 C: 1
100%
setDomainModelReference(VDomainModelReference)
M: 13 C: 39
75%
M: 4 C: 6
60%
M: 3 C: 3
50%
M: 2 C: 13
87%
M: 0 C: 1
100%
setExpectedValue(Object)
M: 0 C: 21
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
setValueDomainModelReference(VDomainModelReference)
M: 16 C: 36
69%
M: 4 C: 6
60%
M: 3 C: 3
50%
M: 5 C: 11
69%
M: 0 C: 1
100%
static {...}
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
toString()
M: 3 C: 34
92%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 1 C: 8
89%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2013 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * EclipseSource Munich GmbH - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.view.spi.rule.model.impl;
15:
16: import java.util.ArrayList;
17: import java.util.Collection;
18: import java.util.List;
19: import java.util.Map;
20:
21: import org.eclipse.core.databinding.observable.IObserving;
22: import org.eclipse.core.databinding.observable.value.IObservableValue;
23: import org.eclipse.emf.common.notify.Notification;
24: import org.eclipse.emf.common.notify.NotificationChain;
25: import org.eclipse.emf.common.util.Enumerator;
26: import org.eclipse.emf.ecore.EClass;
27: import org.eclipse.emf.ecore.EObject;
28: import org.eclipse.emf.ecore.EReference;
29: import org.eclipse.emf.ecore.EStructuralFeature;
30: import org.eclipse.emf.ecore.EStructuralFeature.Setting;
31: import org.eclipse.emf.ecore.EcorePackage;
32: import org.eclipse.emf.ecore.InternalEObject;
33: import org.eclipse.emf.ecore.impl.ENotificationImpl;
34: import org.eclipse.emf.ecp.view.spi.model.VDomainModelReference;
35: import org.eclipse.emf.ecp.view.spi.rule.model.Activator;
36: import org.eclipse.emf.ecp.view.spi.rule.model.CompareType;
37: import org.eclipse.emf.ecp.view.spi.rule.model.LeafCondition;
38: import org.eclipse.emf.ecp.view.spi.rule.model.NotApplicableForEvaluationException;
39: import org.eclipse.emf.ecp.view.spi.rule.model.RulePackage;
40: import org.eclipse.emfforms.spi.core.services.databinding.DatabindingFailedException;
41: import org.eclipse.emfforms.spi.core.services.databinding.DatabindingFailedReport;
42:
43: /**
44: * <!-- begin-user-doc -->
45: * An implementation of the model object '<em><b>Leaf Condition</b></em>'.
46: *
47: * @since 1.2
48: * <!-- end-user-doc -->
49: * <p>
50: * The following features are implemented:
51: * </p>
52: * <ul>
53: * <li>{@link org.eclipse.emf.ecp.view.spi.rule.model.impl.LeafConditionImpl#getExpectedValue <em>Expected
54: * Value</em>}</li>
55: * <li>{@link org.eclipse.emf.ecp.view.spi.rule.model.impl.LeafConditionImpl#getDomainModelReference <em>Domain
56: * Model Reference</em>}</li>
57: * <li>{@link org.eclipse.emf.ecp.view.spi.rule.model.impl.LeafConditionImpl#getValueDomainModelReference
58: * <em>Value Domain Model Reference</em>}</li>
59: * <li>{@link org.eclipse.emf.ecp.view.spi.rule.model.impl.LeafConditionImpl#getCompareType <em>Compare
60: * Type</em>}</li>
61: * </ul>
62: *
63: * @generated
64: */
65: public class LeafConditionImpl extends ConditionImpl implements LeafCondition {
66:         /**
67:          * The default value of the '{@link #getExpectedValue() <em>Expected Value</em>}' attribute.
68:          * <!-- begin-user-doc -->
69:          * <!-- end-user-doc -->
70:          *
71:          * @see #getExpectedValue()
72:          * @generated
73:          * @ordered
74:          */
75:         protected static final Object EXPECTED_VALUE_EDEFAULT = null;
76:
77:         /**
78:          * The cached value of the '{@link #getExpectedValue() <em>Expected Value</em>}' attribute.
79:          * <!-- begin-user-doc -->
80:          * <!-- end-user-doc -->
81:          *
82:          * @see #getExpectedValue()
83:          * @generated
84:          * @ordered
85:          */
86:         protected Object expectedValue = EXPECTED_VALUE_EDEFAULT;
87:
88:         /**
89:          * The cached value of the '{@link #getDomainModelReference() <em>Domain Model Reference</em>}' containment
90:          * reference.
91:          * <!-- begin-user-doc -->
92:          * <!-- end-user-doc -->
93:          *
94:          * @see #getDomainModelReference()
95:          * @generated
96:          * @ordered
97:          */
98:         protected VDomainModelReference domainModelReference;
99:
100:         /**
101:          * The cached value of the '{@link #getValueDomainModelReference() <em>Value Domain Model Reference</em>}'
102:          * containment reference.
103:          * <!-- begin-user-doc -->
104:          *
105:          * @since 1.5
106:          * <!-- end-user-doc -->
107:          * @see #getValueDomainModelReference()
108:          * @generated
109:          * @ordered
110:          */
111:         protected VDomainModelReference valueDomainModelReference;
112:
113:         /**
114:          * The default value of the '{@link #getCompareType() <em>Compare Type</em>}' attribute.
115:          * <!-- begin-user-doc -->
116:          *
117:          * @since 1.11
118:          * <!-- end-user-doc -->
119:          * @see #getCompareType()
120:          * @generated
121:          * @ordered
122:          */
123:         protected static final CompareType COMPARE_TYPE_EDEFAULT = CompareType.EQUALS;
124:
125:         /**
126:          * The cached value of the '{@link #getCompareType() <em>Compare Type</em>}' attribute.
127:          * <!-- begin-user-doc -->
128:          *
129:          * @since 1.11
130:          * <!-- end-user-doc -->
131:          * @see #getCompareType()
132:          * @generated
133:          * @ordered
134:          */
135:         protected CompareType compareType = COMPARE_TYPE_EDEFAULT;
136:
137:         /**
138:          * <!-- begin-user-doc -->
139:          * <!-- end-user-doc -->
140:          *
141:          * @generated
142:          */
143:         protected LeafConditionImpl() {
144:                 super();
145:         }
146:
147:         /**
148:          * <!-- begin-user-doc -->
149:          * <!-- end-user-doc -->
150:          *
151:          * @generated
152:          */
153:         @Override
154:         protected EClass eStaticClass() {
155:                 return RulePackage.Literals.LEAF_CONDITION;
156:         }
157:
158:         /**
159:          * <!-- begin-user-doc -->
160:          * <!-- end-user-doc -->
161:          *
162:          * @generated
163:          */
164:         @Override
165:         public Object getExpectedValue() {
166:                 return expectedValue;
167:         }
168:
169:         /**
170:          * <!-- begin-user-doc -->
171:          * <!-- end-user-doc -->
172:          *
173:          * @generated
174:          */
175:         @Override
176:         public void setExpectedValue(Object newExpectedValue) {
177:                 final Object oldExpectedValue = expectedValue;
178:                 expectedValue = newExpectedValue;
179:•                if (eNotificationRequired()) {
180:                         eNotify(new ENotificationImpl(this, Notification.SET, RulePackage.LEAF_CONDITION__EXPECTED_VALUE,
181:                                 oldExpectedValue, expectedValue));
182:                 }
183:         }
184:
185:         /**
186:          * <!-- begin-user-doc -->
187:          * <!-- end-user-doc -->
188:          *
189:          * @generated
190:          */
191:         @Override
192:         public VDomainModelReference getDomainModelReference() {
193:                 return domainModelReference;
194:         }
195:
196:         /**
197:          * <!-- begin-user-doc -->
198:          * <!-- end-user-doc -->
199:          *
200:          * @generated
201:          */
202:         public NotificationChain basicSetDomainModelReference(VDomainModelReference newDomainModelReference,
203:                 NotificationChain msgs) {
204:                 final VDomainModelReference oldDomainModelReference = domainModelReference;
205:                 domainModelReference = newDomainModelReference;
206:•                if (eNotificationRequired()) {
207:                         final ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
208:                                 RulePackage.LEAF_CONDITION__DOMAIN_MODEL_REFERENCE, oldDomainModelReference, newDomainModelReference);
209:•                        if (msgs == null) {
210:                                 msgs = notification;
211:                         } else {
212:                                 msgs.add(notification);
213:                         }
214:                 }
215:                 return msgs;
216:         }
217:
218:         /**
219:          * <!-- begin-user-doc -->
220:          * <!-- end-user-doc -->
221:          *
222:          * @generated
223:          */
224:         @Override
225:         public void setDomainModelReference(VDomainModelReference newDomainModelReference) {
226:•                if (newDomainModelReference != domainModelReference) {
227:                         NotificationChain msgs = null;
228:•                        if (domainModelReference != null) {
229:                                 msgs = ((InternalEObject) domainModelReference).eInverseRemove(this,
230:                                         EOPPOSITE_FEATURE_BASE - RulePackage.LEAF_CONDITION__DOMAIN_MODEL_REFERENCE, null, msgs);
231:                         }
232:•                        if (newDomainModelReference != null) {
233:                                 msgs = ((InternalEObject) newDomainModelReference).eInverseAdd(this,
234:                                         EOPPOSITE_FEATURE_BASE - RulePackage.LEAF_CONDITION__DOMAIN_MODEL_REFERENCE, null, msgs);
235:                         }
236:                         msgs = basicSetDomainModelReference(newDomainModelReference, msgs);
237:•                        if (msgs != null) {
238:                                 msgs.dispatch();
239:                         }
240:•                } else if (eNotificationRequired()) {
241:                         eNotify(new ENotificationImpl(this, Notification.SET, RulePackage.LEAF_CONDITION__DOMAIN_MODEL_REFERENCE,
242:                                 newDomainModelReference, newDomainModelReference));
243:                 }
244:         }
245:
246:         /**
247:          * <!-- begin-user-doc -->
248:          *
249:          * @since 1.5
250:          * <!-- end-user-doc -->
251:          * @generated
252:          */
253:         @Override
254:         public VDomainModelReference getValueDomainModelReference() {
255:                 return valueDomainModelReference;
256:         }
257:
258:         /**
259:          * <!-- begin-user-doc -->
260:          *
261:          * @since 1.5
262:          * <!-- end-user-doc -->
263:          * @generated
264:          */
265:         public NotificationChain basicSetValueDomainModelReference(VDomainModelReference newValueDomainModelReference,
266:                 NotificationChain msgs) {
267:                 final VDomainModelReference oldValueDomainModelReference = valueDomainModelReference;
268:                 valueDomainModelReference = newValueDomainModelReference;
269:•                if (eNotificationRequired()) {
270:                         final ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
271:                                 RulePackage.LEAF_CONDITION__VALUE_DOMAIN_MODEL_REFERENCE, oldValueDomainModelReference,
272:                                 newValueDomainModelReference);
273:•                        if (msgs == null) {
274:                                 msgs = notification;
275:                         } else {
276:                                 msgs.add(notification);
277:                         }
278:                 }
279:                 return msgs;
280:         }
281:
282:         /**
283:          * <!-- begin-user-doc -->
284:          *
285:          * @since 1.5
286:          * <!-- end-user-doc -->
287:          * @generated
288:          */
289:         @Override
290:         public void setValueDomainModelReference(VDomainModelReference newValueDomainModelReference) {
291:•                if (newValueDomainModelReference != valueDomainModelReference) {
292:                         NotificationChain msgs = null;
293:•                        if (valueDomainModelReference != null) {
294:                                 msgs = ((InternalEObject) valueDomainModelReference).eInverseRemove(this,
295:                                         EOPPOSITE_FEATURE_BASE - RulePackage.LEAF_CONDITION__VALUE_DOMAIN_MODEL_REFERENCE, null, msgs);
296:                         }
297:•                        if (newValueDomainModelReference != null) {
298:                                 msgs = ((InternalEObject) newValueDomainModelReference).eInverseAdd(this,
299:                                         EOPPOSITE_FEATURE_BASE - RulePackage.LEAF_CONDITION__VALUE_DOMAIN_MODEL_REFERENCE, null, msgs);
300:                         }
301:                         msgs = basicSetValueDomainModelReference(newValueDomainModelReference, msgs);
302:•                        if (msgs != null) {
303:                                 msgs.dispatch();
304:                         }
305:•                } else if (eNotificationRequired()) {
306:                         eNotify(
307:                                 new ENotificationImpl(this, Notification.SET, RulePackage.LEAF_CONDITION__VALUE_DOMAIN_MODEL_REFERENCE,
308:                                         newValueDomainModelReference, newValueDomainModelReference));
309:                 }
310:         }
311:
312:         /**
313:          * <!-- begin-user-doc -->
314:          *
315:          * @since 1.11
316:          * <!-- end-user-doc -->
317:          * @generated
318:          */
319:         @Override
320:         public CompareType getCompareType() {
321:                 return compareType;
322:         }
323:
324:         /**
325:          * <!-- begin-user-doc -->
326:          *
327:          * @since 1.11
328:          * <!-- end-user-doc -->
329:          * @generated
330:          */
331:         @Override
332:         public void setCompareType(CompareType newCompareType) {
333:                 final CompareType oldCompareType = compareType;
334:•                compareType = newCompareType == null ? COMPARE_TYPE_EDEFAULT : newCompareType;
335:•                if (eNotificationRequired()) {
336:                         eNotify(new ENotificationImpl(this, Notification.SET, RulePackage.LEAF_CONDITION__COMPARE_TYPE,
337:                                 oldCompareType, compareType));
338:                 }
339:         }
340:
341:         /**
342:          * <!-- begin-user-doc -->
343:          * <!-- end-user-doc -->
344:          *
345:          * @generated
346:          */
347:         @Override
348:         public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
349:•                switch (featureID) {
350:                 case RulePackage.LEAF_CONDITION__DOMAIN_MODEL_REFERENCE:
351:                         return basicSetDomainModelReference(null, msgs);
352:                 case RulePackage.LEAF_CONDITION__VALUE_DOMAIN_MODEL_REFERENCE:
353:                         return basicSetValueDomainModelReference(null, msgs);
354:                 }
355:                 return super.eInverseRemove(otherEnd, featureID, msgs);
356:         }
357:
358:         /**
359:          * <!-- begin-user-doc -->
360:          * <!-- end-user-doc -->
361:          *
362:          * @generated
363:          */
364:         @Override
365:         public Object eGet(int featureID, boolean resolve, boolean coreType) {
366:•                switch (featureID) {
367:                 case RulePackage.LEAF_CONDITION__EXPECTED_VALUE:
368:                         return getExpectedValue();
369:                 case RulePackage.LEAF_CONDITION__DOMAIN_MODEL_REFERENCE:
370:                         return getDomainModelReference();
371:                 case RulePackage.LEAF_CONDITION__VALUE_DOMAIN_MODEL_REFERENCE:
372:                         return getValueDomainModelReference();
373:                 case RulePackage.LEAF_CONDITION__COMPARE_TYPE:
374:                         return getCompareType();
375:                 }
376:                 return super.eGet(featureID, resolve, coreType);
377:         }
378:
379:         /**
380:          * <!-- begin-user-doc -->
381:          * <!-- end-user-doc -->
382:          *
383:          * @generated
384:          */
385:         @Override
386:         public void eSet(int featureID, Object newValue) {
387:•                switch (featureID) {
388:                 case RulePackage.LEAF_CONDITION__EXPECTED_VALUE:
389:                         setExpectedValue(newValue);
390:                         return;
391:                 case RulePackage.LEAF_CONDITION__DOMAIN_MODEL_REFERENCE:
392:                         setDomainModelReference((VDomainModelReference) newValue);
393:                         return;
394:                 case RulePackage.LEAF_CONDITION__VALUE_DOMAIN_MODEL_REFERENCE:
395:                         setValueDomainModelReference((VDomainModelReference) newValue);
396:                         return;
397:                 case RulePackage.LEAF_CONDITION__COMPARE_TYPE:
398:                         setCompareType((CompareType) newValue);
399:                         return;
400:                 }
401:                 super.eSet(featureID, newValue);
402:         }
403:
404:         /**
405:          * <!-- begin-user-doc -->
406:          * <!-- end-user-doc -->
407:          *
408:          * @generated
409:          */
410:         @Override
411:         public void eUnset(int featureID) {
412:•                switch (featureID) {
413:                 case RulePackage.LEAF_CONDITION__EXPECTED_VALUE:
414:                         setExpectedValue(EXPECTED_VALUE_EDEFAULT);
415:                         return;
416:                 case RulePackage.LEAF_CONDITION__DOMAIN_MODEL_REFERENCE:
417:                         setDomainModelReference((VDomainModelReference) null);
418:                         return;
419:                 case RulePackage.LEAF_CONDITION__VALUE_DOMAIN_MODEL_REFERENCE:
420:                         setValueDomainModelReference((VDomainModelReference) null);
421:                         return;
422:                 case RulePackage.LEAF_CONDITION__COMPARE_TYPE:
423:                         setCompareType(COMPARE_TYPE_EDEFAULT);
424:                         return;
425:                 }
426:                 super.eUnset(featureID);
427:         }
428:
429:         /**
430:          * <!-- begin-user-doc -->
431:          * <!-- end-user-doc -->
432:          *
433:          * @generated
434:          */
435:         @Override
436:         public boolean eIsSet(int featureID) {
437:•                switch (featureID) {
438:                 case RulePackage.LEAF_CONDITION__EXPECTED_VALUE:
439:•                        return EXPECTED_VALUE_EDEFAULT == null ? expectedValue != null
440:•                                : !EXPECTED_VALUE_EDEFAULT.equals(expectedValue);
441:                 case RulePackage.LEAF_CONDITION__DOMAIN_MODEL_REFERENCE:
442:•                        return domainModelReference != null;
443:                 case RulePackage.LEAF_CONDITION__VALUE_DOMAIN_MODEL_REFERENCE:
444:•                        return valueDomainModelReference != null;
445:                 case RulePackage.LEAF_CONDITION__COMPARE_TYPE:
446:•                        return compareType != COMPARE_TYPE_EDEFAULT;
447:                 }
448:                 return super.eIsSet(featureID);
449:         }
450:
451:         /**
452:          * <!-- begin-user-doc -->
453:          * <!-- end-user-doc -->
454:          *
455:          * @generated
456:          */
457:         @Override
458:         public String toString() {
459:•                if (eIsProxy()) {
460:                         return super.toString();
461:                 }
462:
463:                 final StringBuffer result = new StringBuffer(super.toString());
464:                 result.append(" (expectedValue: "); //$NON-NLS-1$
465:                 result.append(expectedValue);
466:                 result.append(", compareType: "); //$NON-NLS-1$
467:                 result.append(compareType);
468:                 result.append(')');
469:                 return result.toString();
470:         }
471:
472:         /**
473:          * {@inheritDoc}
474:          *
475:          * @see org.eclipse.emf.ecp.view.spi.rule.model.Condition#evaluate(org.eclipse.emf.ecore.EObject)
476:          * @since 1.9
477:          */
478:         @Override
479:         public boolean evaluate(EObject domainModel) {
480:                 final LeafConditionSettingIterator settingIterator = new LeafConditionSettingIterator(this, domainModel, false);
481:                 boolean result = false;
482:                 final Object expectedValue = getExpectedValue();
483:•                while (settingIterator.hasNext()) {
484:                         try {
485:                                 final Setting setting = settingIterator.next();
486:                                 result |= doEvaluate(setting.getEObject(), setting.getEStructuralFeature(), expectedValue, false, null,
487:                                         getCompareType());
488:                         } catch (final NotApplicableForEvaluationException e) {
489:                                 continue;
490:                         }
491:                 }
492:                 settingIterator.dispose();
493:
494:                 return result;
495:         }
496:
497:         private static boolean doEvaluate(EObject parent, EStructuralFeature feature, Object expectedValue,
498:                 boolean useNewValue, Object newValue, CompareType compareType) throws NotApplicableForEvaluationException {
499:
500:                 final EClass attributeClass = feature.getEContainingClass();
501:•                if (!attributeClass.isInstance(parent)) {
502:                         throw new NotApplicableForEvaluationException();
503:                 }
504:                 Object value;
505:•                if (!useNewValue) {
506:                         value = parent.eGet(feature);
507:                 } else {
508:                         value = newValue;
509:                 }
510:                 boolean result;
511:•                if (!feature.isMany()) {
512:•                        if (expectedValue == null) {
513:•                                result = value == null;
514:•                        } else if (EcorePackage.eINSTANCE.getEEnum().isInstance(feature.getEType())) {
515:                                 result = expectedValue.equals(Enumerator.class.cast(value).getLiteral());
516:                         } else {
517:                                 result = expectedValue.equals(value);
518:                         }
519:
520:                 } else {
521:                         // EMF API
522:                         @SuppressWarnings("unchecked")
523:                         final List<Object> objects = (List<Object>) value;
524:                         result = objects.contains(expectedValue);
525:                 }
526:
527:•                if (compareType == CompareType.EQUALS) {
528:                         return result;
529:•                } else if (compareType == CompareType.NOT_EQUALS) {
530:•                        return !result;
531:                 }
532:                 return false;
533:         }
534:
535:         /**
536:          * {@inheritDoc}
537:          *
538:          * @see org.eclipse.emf.ecp.view.spi.rule.model.Condition#evaluateChangedValues(org.eclipse.emf.ecore.EObject,
539:          * java.util.Map)
540:          * @since 1.9
541:          */
542:         @SuppressWarnings("unchecked")
543:         @Override
544:         public boolean evaluateChangedValues(EObject domainModel, Map<Setting, Object> possibleNewValues) {
545:                 boolean result = false;
546:                 final Object expectedValue = getExpectedValue();
547:
548:•                for (final Setting setting : possibleNewValues.keySet()) {
549:•                        if (EReference.class.isInstance(setting.getEStructuralFeature())) {
550:                                 final List<EObject> newEObjects = new ArrayList<EObject>();
551:•                                if (setting.getEStructuralFeature().isMany()) {
552:                                         newEObjects.addAll((Collection<? extends EObject>) possibleNewValues.get(setting));
553:                                 } else {
554:                                         newEObjects.add((EObject) possibleNewValues.get(setting));
555:                                 }
556:•                                for (final EObject domain : newEObjects) {
557:•                                        if (getValueDomainModelReference() == null) {
558:                                                 continue;
559:                                         }
560:                                         IObservableValue observableValue;
561:                                         try {
562:                                                 observableValue = Activator.getDefault().getEMFFormsDatabinding()
563:                                                         .getObservableValue(getValueDomainModelReference(), domain);
564:                                         } catch (final DatabindingFailedException ex) {
565:                                                 Activator.getDefault().getReportService().report(new DatabindingFailedReport(ex));
566:                                                 continue;
567:                                         }
568:                                         final EObject eObject = (EObject) ((IObserving) observableValue).getObserved();
569:                                         final EStructuralFeature structuralFeature = (EStructuralFeature) observableValue.getValueType();
570:                                         observableValue.dispose();
571:
572:                                         try {
573:                                                 result |= doEvaluate(eObject, structuralFeature, expectedValue, true,
574:                                                         eObject.eGet(structuralFeature, true), getCompareType());
575:                                         } catch (final NotApplicableForEvaluationException ex) {
576:                                                 continue;
577:                                         }
578:                                 }
579:                         } else {
580:                                 try {
581:                                         result |= doEvaluate(setting.getEObject(), setting.getEStructuralFeature(), expectedValue, true,
582:                                                 possibleNewValues.get(setting), getCompareType());
583:                                 } catch (final NotApplicableForEvaluationException e) {
584:                                         continue;
585:                                 }
586:                         }
587:                 }
588:
589:                 return result;
590:         }
591:
592: } // LeafConditionImpl