Skip to content

Package: VCategorizationElementImpl

VCategorizationElementImpl

nameinstructionbranchcomplexitylinemethod
VCategorizationElementImpl()
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
basicGetCurrentSelection()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
eGet(int, boolean, boolean)
M: 8 C: 15
65%
M: 3 C: 3
50%
M: 2 C: 3
60%
M: 3 C: 4
57%
M: 0 C: 1
100%
eInverseRemove(InternalEObject, int, NotificationChain)
M: 6 C: 9
60%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 1 C: 2
67%
M: 0 C: 1
100%
eIsSet(int)
M: 4 C: 27
87%
M: 2 C: 10
83%
M: 2 C: 6
75%
M: 0 C: 5
100%
M: 0 C: 1
100%
eSet(int, Object)
M: 21 C: 7
25%
M: 3 C: 1
25%
M: 3 C: 1
25%
M: 7 C: 3
30%
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: 18 C: 0
0%
M: 4 C: 0
0%
M: 4 C: 0
0%
M: 9 C: 0
0%
M: 1 C: 0
0%
getCategorizations()
M: 0 C: 14
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
getCurrentSelection()
M: 28 C: 10
26%
M: 5 C: 3
38%
M: 3 C: 2
40%
M: 7 C: 2
22%
M: 0 C: 1
100%
getMainCategoryDepth()
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%
setCurrentSelection(VCategorizableElement)
M: 0 C: 21
100%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 0 C: 7
100%
M: 0 C: 1
100%
setMainCategoryDepth(int)
M: 11 C: 10
48%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 3 C: 4
57%
M: 0 C: 1
100%
toString()
M: 28 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%

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 - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.view.spi.categorization.model.impl;
15:
16: import java.util.Collection;
17:
18: import org.eclipse.emf.common.notify.Notification;
19: import org.eclipse.emf.common.notify.NotificationChain;
20: import org.eclipse.emf.common.util.EList;
21: import org.eclipse.emf.ecore.EClass;
22: import org.eclipse.emf.ecore.InternalEObject;
23: import org.eclipse.emf.ecore.impl.ENotificationImpl;
24: import org.eclipse.emf.ecore.util.EObjectContainmentEList;
25: import org.eclipse.emf.ecore.util.InternalEList;
26: import org.eclipse.emf.ecp.view.spi.categorization.model.VAbstractCategorization;
27: import org.eclipse.emf.ecp.view.spi.categorization.model.VCategorizableElement;
28: import org.eclipse.emf.ecp.view.spi.categorization.model.VCategorizationElement;
29: import org.eclipse.emf.ecp.view.spi.categorization.model.VCategorizationPackage;
30: import org.eclipse.emf.ecp.view.spi.model.impl.VContainedElementImpl;
31:
32: /**
33: * <!-- begin-user-doc -->
34: * An implementation of the model object '<em><b>Element</b></em>'.
35: * <!-- end-user-doc -->
36: * <p>
37: * The following features are implemented:
38: * </p>
39: * <ul>
40: * <li>{@link org.eclipse.emf.ecp.view.spi.categorization.model.impl.VCategorizationElementImpl#getCategorizations
41: * <em>Categorizations</em>}</li>
42: * <li>{@link org.eclipse.emf.ecp.view.spi.categorization.model.impl.VCategorizationElementImpl#getCurrentSelection
43: * <em>Current Selection</em>}</li>
44: * <li>{@link org.eclipse.emf.ecp.view.spi.categorization.model.impl.VCategorizationElementImpl#getMainCategoryDepth
45: * <em>Main Category Depth</em>}</li>
46: * </ul>
47: *
48: * @generated
49: */
50: public class VCategorizationElementImpl extends VContainedElementImpl implements VCategorizationElement {
51:         /**
52:          * The cached value of the '{@link #getCategorizations() <em>Categorizations</em>}' containment reference list.
53:          * <!-- begin-user-doc -->
54:          * <!-- end-user-doc -->
55:          *
56:          * @see #getCategorizations()
57:          * @generated
58:          * @ordered
59:          */
60:         protected EList<VAbstractCategorization> categorizations;
61:
62:         /**
63:          * The cached value of the '{@link #getCurrentSelection() <em>Current Selection</em>}' reference.
64:          * <!-- begin-user-doc -->
65:          * <!-- end-user-doc -->
66:          *
67:          * @see #getCurrentSelection()
68:          * @generated
69:          * @ordered
70:          */
71:         protected VCategorizableElement currentSelection;
72:
73:         /**
74:          * The default value of the '{@link #getMainCategoryDepth() <em>Main Category Depth</em>}' attribute.
75:          * <!-- begin-user-doc -->
76:          * <!-- end-user-doc -->
77:          *
78:          * @see #getMainCategoryDepth()
79:          * @generated
80:          * @ordered
81:          */
82:         protected static final int MAIN_CATEGORY_DEPTH_EDEFAULT = 0;
83:
84:         /**
85:          * The cached value of the '{@link #getMainCategoryDepth() <em>Main Category Depth</em>}' attribute.
86:          * <!-- begin-user-doc -->
87:          * <!-- end-user-doc -->
88:          *
89:          * @see #getMainCategoryDepth()
90:          * @generated
91:          * @ordered
92:          */
93:         protected int mainCategoryDepth = MAIN_CATEGORY_DEPTH_EDEFAULT;
94:
95:         /**
96:          * <!-- begin-user-doc -->
97:          * <!-- end-user-doc -->
98:          *
99:          * @generated
100:          */
101:         protected VCategorizationElementImpl() {
102:                 super();
103:         }
104:
105:         /**
106:          * <!-- begin-user-doc -->
107:          * <!-- end-user-doc -->
108:          *
109:          * @generated
110:          */
111:         @Override
112:         protected EClass eStaticClass() {
113:                 return VCategorizationPackage.Literals.CATEGORIZATION_ELEMENT;
114:         }
115:
116:         /**
117:          * <!-- begin-user-doc -->
118:          * <!-- end-user-doc -->
119:          *
120:          * @generated
121:          */
122:         @Override
123:         public EList<VAbstractCategorization> getCategorizations() {
124:•                if (categorizations == null) {
125:                         categorizations = new EObjectContainmentEList<VAbstractCategorization>(VAbstractCategorization.class, this,
126:                                 VCategorizationPackage.CATEGORIZATION_ELEMENT__CATEGORIZATIONS);
127:                 }
128:                 return categorizations;
129:         }
130:
131:         /**
132:          * <!-- begin-user-doc -->
133:          * <!-- end-user-doc -->
134:          *
135:          * @generated
136:          */
137:         @Override
138:         public VCategorizableElement getCurrentSelection() {
139:•                if (currentSelection != null && currentSelection.eIsProxy()) {
140:                         InternalEObject oldCurrentSelection = (InternalEObject) currentSelection;
141:                         currentSelection = (VCategorizableElement) eResolveProxy(oldCurrentSelection);
142:•                        if (currentSelection != oldCurrentSelection) {
143:•                                if (eNotificationRequired())
144:                                         eNotify(new ENotificationImpl(this, Notification.RESOLVE,
145:                                                 VCategorizationPackage.CATEGORIZATION_ELEMENT__CURRENT_SELECTION, oldCurrentSelection,
146:                                                 currentSelection));
147:                         }
148:                 }
149:                 return currentSelection;
150:         }
151:
152:         /**
153:          * <!-- begin-user-doc -->
154:          * <!-- end-user-doc -->
155:          *
156:          * @generated
157:          */
158:         public VCategorizableElement basicGetCurrentSelection() {
159:                 return currentSelection;
160:         }
161:
162:         /**
163:          * <!-- begin-user-doc -->
164:          * <!-- end-user-doc -->
165:          *
166:          * @generated
167:          */
168:         @Override
169:         public void setCurrentSelection(VCategorizableElement newCurrentSelection) {
170:                 VCategorizableElement oldCurrentSelection = currentSelection;
171:                 currentSelection = newCurrentSelection;
172:•                if (eNotificationRequired())
173:                         eNotify(new ENotificationImpl(this, Notification.SET,
174:                                 VCategorizationPackage.CATEGORIZATION_ELEMENT__CURRENT_SELECTION, oldCurrentSelection,
175:                                 currentSelection));
176:         }
177:
178:         /**
179:          * <!-- begin-user-doc -->
180:          * <!-- end-user-doc -->
181:          *
182:          * @generated
183:          */
184:         @Override
185:         public int getMainCategoryDepth() {
186:                 return mainCategoryDepth;
187:         }
188:
189:         /**
190:          * <!-- begin-user-doc -->
191:          * <!-- end-user-doc -->
192:          *
193:          * @generated
194:          */
195:         @Override
196:         public void setMainCategoryDepth(int newMainCategoryDepth) {
197:                 int oldMainCategoryDepth = mainCategoryDepth;
198:                 mainCategoryDepth = newMainCategoryDepth;
199:•                if (eNotificationRequired())
200:                         eNotify(new ENotificationImpl(this, Notification.SET,
201:                                 VCategorizationPackage.CATEGORIZATION_ELEMENT__MAIN_CATEGORY_DEPTH, oldMainCategoryDepth,
202:                                 mainCategoryDepth));
203:         }
204:
205:         /**
206:          * <!-- begin-user-doc -->
207:          * <!-- end-user-doc -->
208:          *
209:          * @generated
210:          */
211:         @Override
212:         public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
213:•                switch (featureID) {
214:                 case VCategorizationPackage.CATEGORIZATION_ELEMENT__CATEGORIZATIONS:
215:                         return ((InternalEList<?>) getCategorizations()).basicRemove(otherEnd, msgs);
216:                 }
217:                 return super.eInverseRemove(otherEnd, featureID, msgs);
218:         }
219:
220:         /**
221:          * <!-- begin-user-doc -->
222:          * <!-- end-user-doc -->
223:          *
224:          * @generated
225:          */
226:         @Override
227:         public Object eGet(int featureID, boolean resolve, boolean coreType) {
228:•                switch (featureID) {
229:                 case VCategorizationPackage.CATEGORIZATION_ELEMENT__CATEGORIZATIONS:
230:                         return getCategorizations();
231:                 case VCategorizationPackage.CATEGORIZATION_ELEMENT__CURRENT_SELECTION:
232:•                        if (resolve)
233:                                 return getCurrentSelection();
234:                         return basicGetCurrentSelection();
235:                 case VCategorizationPackage.CATEGORIZATION_ELEMENT__MAIN_CATEGORY_DEPTH:
236:                         return getMainCategoryDepth();
237:                 }
238:                 return super.eGet(featureID, resolve, coreType);
239:         }
240:
241:         /**
242:          * <!-- begin-user-doc -->
243:          * <!-- end-user-doc -->
244:          *
245:          * @generated
246:          */
247:         @SuppressWarnings("unchecked")
248:         @Override
249:         public void eSet(int featureID, Object newValue) {
250:•                switch (featureID) {
251:                 case VCategorizationPackage.CATEGORIZATION_ELEMENT__CATEGORIZATIONS:
252:                         getCategorizations().clear();
253:                         getCategorizations().addAll((Collection<? extends VAbstractCategorization>) newValue);
254:                         return;
255:                 case VCategorizationPackage.CATEGORIZATION_ELEMENT__CURRENT_SELECTION:
256:                         setCurrentSelection((VCategorizableElement) newValue);
257:                         return;
258:                 case VCategorizationPackage.CATEGORIZATION_ELEMENT__MAIN_CATEGORY_DEPTH:
259:                         setMainCategoryDepth((Integer) newValue);
260:                         return;
261:                 }
262:                 super.eSet(featureID, newValue);
263:         }
264:
265:         /**
266:          * <!-- begin-user-doc -->
267:          * <!-- end-user-doc -->
268:          *
269:          * @generated
270:          */
271:         @Override
272:         public void eUnset(int featureID) {
273:•                switch (featureID) {
274:                 case VCategorizationPackage.CATEGORIZATION_ELEMENT__CATEGORIZATIONS:
275:                         getCategorizations().clear();
276:                         return;
277:                 case VCategorizationPackage.CATEGORIZATION_ELEMENT__CURRENT_SELECTION:
278:                         setCurrentSelection((VCategorizableElement) null);
279:                         return;
280:                 case VCategorizationPackage.CATEGORIZATION_ELEMENT__MAIN_CATEGORY_DEPTH:
281:                         setMainCategoryDepth(MAIN_CATEGORY_DEPTH_EDEFAULT);
282:                         return;
283:                 }
284:                 super.eUnset(featureID);
285:         }
286:
287:         /**
288:          * <!-- begin-user-doc -->
289:          * <!-- end-user-doc -->
290:          *
291:          * @generated
292:          */
293:         @Override
294:         public boolean eIsSet(int featureID) {
295:•                switch (featureID) {
296:                 case VCategorizationPackage.CATEGORIZATION_ELEMENT__CATEGORIZATIONS:
297:•                        return categorizations != null && !categorizations.isEmpty();
298:                 case VCategorizationPackage.CATEGORIZATION_ELEMENT__CURRENT_SELECTION:
299:•                        return currentSelection != null;
300:                 case VCategorizationPackage.CATEGORIZATION_ELEMENT__MAIN_CATEGORY_DEPTH:
301:•                        return mainCategoryDepth != MAIN_CATEGORY_DEPTH_EDEFAULT;
302:                 }
303:                 return super.eIsSet(featureID);
304:         }
305:
306:         /**
307:          * <!-- begin-user-doc -->
308:          * <!-- end-user-doc -->
309:          *
310:          * @generated
311:          */
312:         @Override
313:         public String toString() {
314:•                if (eIsProxy())
315:                         return super.toString();
316:
317:                 StringBuffer result = new StringBuffer(super.toString());
318:                 result.append(" (mainCategoryDepth: "); //$NON-NLS-1$
319:                 result.append(mainCategoryDepth);
320:                 result.append(')');
321:                 return result.toString();
322:         }
323:
324: } // VCategorizationElementImpl