Skip to content

Package: NotConditionImpl

NotConditionImpl

nameinstructionbranchcomplexitylinemethod
NotConditionImpl()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
basicSetCondition(Condition, NotificationChain)
M: 18 C: 11
38%
M: 3 C: 1
25%
M: 2 C: 1
33%
M: 6 C: 4
40%
M: 0 C: 1
100%
eGet(int, boolean, boolean)
M: 11 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
eInverseRemove(InternalEObject, int, NotificationChain)
M: 13 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
eIsSet(int)
M: 13 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
eSet(int, Object)
M: 12 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
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: 10 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
evaluate(EObject)
M: 0 C: 13
100%
M: 1 C: 3
75%
M: 1 C: 2
67%
M: 0 C: 2
100%
M: 0 C: 1
100%
evaluateChangedValues(EObject, Map)
M: 0 C: 14
100%
M: 1 C: 3
75%
M: 1 C: 2
67%
M: 0 C: 2
100%
M: 0 C: 1
100%
getCondition()
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%
setCondition(Condition)
M: 25 C: 27
52%
M: 6 C: 4
40%
M: 5 C: 1
17%
M: 6 C: 9
60%
M: 0 C: 1
100%

Coverage

1: /**
2: * Copyright (c) 2017 Christian W. Damus 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: * Christian W. Damus - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.view.spi.rule.model.impl;
15:
16: import java.util.Map;
17:
18: import org.eclipse.emf.common.notify.Notification;
19: import org.eclipse.emf.common.notify.NotificationChain;
20: import org.eclipse.emf.ecore.EClass;
21: import org.eclipse.emf.ecore.EObject;
22: import org.eclipse.emf.ecore.EStructuralFeature;
23: import org.eclipse.emf.ecore.InternalEObject;
24: import org.eclipse.emf.ecore.impl.ENotificationImpl;
25: import org.eclipse.emf.ecp.view.spi.rule.model.Condition;
26: import org.eclipse.emf.ecp.view.spi.rule.model.NotCondition;
27: import org.eclipse.emf.ecp.view.spi.rule.model.RulePackage;
28:
29: /**
30: * <!-- begin-user-doc -->
31: * An implementation of the model object '<em><b>Not Condition</b></em>'.
32: * <!-- end-user-doc -->
33: * <p>
34: * The following features are implemented:
35: * </p>
36: * <ul>
37: * <li>{@link org.eclipse.emf.ecp.view.spi.rule.model.impl.NotConditionImpl#getCondition <em>Condition</em>}</li>
38: * </ul>
39: *
40: * @generated
41: */
42: public class NotConditionImpl extends ConditionImpl implements NotCondition {
43:         /**
44:          * The cached value of the '{@link #getCondition() <em>Condition</em>}' containment reference.
45:          * <!-- begin-user-doc -->
46:          * <!-- end-user-doc -->
47:          *
48:          * @see #getCondition()
49:          * @generated
50:          * @ordered
51:          */
52:         protected Condition condition;
53:
54:         /**
55:          * <!-- begin-user-doc -->
56:          * <!-- end-user-doc -->
57:          *
58:          * @generated
59:          */
60:         protected NotConditionImpl() {
61:                 super();
62:         }
63:
64:         /**
65:          * <!-- begin-user-doc -->
66:          * <!-- end-user-doc -->
67:          *
68:          * @generated
69:          */
70:         @Override
71:         protected EClass eStaticClass() {
72:                 return RulePackage.Literals.NOT_CONDITION;
73:         }
74:
75:         /**
76:          * <!-- begin-user-doc -->
77:          * <!-- end-user-doc -->
78:          *
79:          * @generated
80:          */
81:         @Override
82:         public Condition getCondition() {
83:                 return condition;
84:         }
85:
86:         /**
87:          * <!-- begin-user-doc -->
88:          * <!-- end-user-doc -->
89:          *
90:          * @generated
91:          */
92:         public NotificationChain basicSetCondition(Condition newCondition, NotificationChain msgs) {
93:                 final Condition oldCondition = condition;
94:                 condition = newCondition;
95:•                if (eNotificationRequired()) {
96:                         final ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
97:                                 RulePackage.NOT_CONDITION__CONDITION, oldCondition, newCondition);
98:•                        if (msgs == null) {
99:                                 msgs = notification;
100:                         } else {
101:                                 msgs.add(notification);
102:                         }
103:                 }
104:                 return msgs;
105:         }
106:
107:         /**
108:          * <!-- begin-user-doc -->
109:          * <!-- end-user-doc -->
110:          *
111:          * @generated
112:          */
113:         @Override
114:         public void setCondition(Condition newCondition) {
115:•                if (newCondition != condition) {
116:                         NotificationChain msgs = null;
117:•                        if (condition != null) {
118:                                 msgs = ((InternalEObject) condition).eInverseRemove(this,
119:                                         EOPPOSITE_FEATURE_BASE - RulePackage.NOT_CONDITION__CONDITION, null, msgs);
120:                         }
121:•                        if (newCondition != null) {
122:                                 msgs = ((InternalEObject) newCondition).eInverseAdd(this,
123:                                         EOPPOSITE_FEATURE_BASE - RulePackage.NOT_CONDITION__CONDITION, null, msgs);
124:                         }
125:                         msgs = basicSetCondition(newCondition, msgs);
126:•                        if (msgs != null) {
127:                                 msgs.dispatch();
128:                         }
129:•                } else if (eNotificationRequired()) {
130:                         eNotify(new ENotificationImpl(this, Notification.SET, RulePackage.NOT_CONDITION__CONDITION, newCondition,
131:                                 newCondition));
132:                 }
133:         }
134:
135:         /**
136:          * <!-- begin-user-doc -->
137:          * <!-- end-user-doc -->
138:          *
139:          * @generated
140:          */
141:         @Override
142:         public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
143:•                switch (featureID) {
144:                 case RulePackage.NOT_CONDITION__CONDITION:
145:                         return basicSetCondition(null, msgs);
146:                 }
147:                 return super.eInverseRemove(otherEnd, featureID, msgs);
148:         }
149:
150:         /**
151:          * <!-- begin-user-doc -->
152:          * <!-- end-user-doc -->
153:          *
154:          * @generated
155:          */
156:         @Override
157:         public Object eGet(int featureID, boolean resolve, boolean coreType) {
158:•                switch (featureID) {
159:                 case RulePackage.NOT_CONDITION__CONDITION:
160:                         return getCondition();
161:                 }
162:                 return super.eGet(featureID, resolve, coreType);
163:         }
164:
165:         /**
166:          * <!-- begin-user-doc -->
167:          * <!-- end-user-doc -->
168:          *
169:          * @generated
170:          */
171:         @Override
172:         public void eSet(int featureID, Object newValue) {
173:•                switch (featureID) {
174:                 case RulePackage.NOT_CONDITION__CONDITION:
175:                         setCondition((Condition) newValue);
176:                         return;
177:                 }
178:                 super.eSet(featureID, newValue);
179:         }
180:
181:         /**
182:          * <!-- begin-user-doc -->
183:          * <!-- end-user-doc -->
184:          *
185:          * @generated
186:          */
187:         @Override
188:         public void eUnset(int featureID) {
189:•                switch (featureID) {
190:                 case RulePackage.NOT_CONDITION__CONDITION:
191:                         setCondition((Condition) null);
192:                         return;
193:                 }
194:                 super.eUnset(featureID);
195:         }
196:
197:         /**
198:          * <!-- begin-user-doc -->
199:          * <!-- end-user-doc -->
200:          *
201:          * @generated
202:          */
203:         @Override
204:         public boolean eIsSet(int featureID) {
205:•                switch (featureID) {
206:                 case RulePackage.NOT_CONDITION__CONDITION:
207:•                        return condition != null;
208:                 }
209:                 return super.eIsSet(featureID);
210:         }
211:
212:         @Override
213:         public boolean evaluate(EObject domainModel) {
214:                 final Condition condition = getCondition();
215:•                return condition != null && !condition.evaluate(domainModel);
216:         }
217:
218:         @Override
219:         public boolean evaluateChangedValues(EObject domainModel,
220:                 Map<EStructuralFeature.Setting, Object> possibleNewValues) {
221:
222:                 final Condition condition = getCondition();
223:•                return condition != null && !condition.evaluateChangedValues(domainModel, possibleNewValues);
224:         }
225:
226: } // NotConditionImpl