Skip to content

Package: VGroupFactoryImpl

VGroupFactoryImpl

nameinstructionbranchcomplexitylinemethod
VGroupFactoryImpl()
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%
convertGroupLabelAlignmentToString(EDataType, Object)
M: 2 C: 5
71%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 0 C: 1
100%
M: 0 C: 1
100%
convertGroupTypeToString(EDataType, Object)
M: 2 C: 5
71%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 0 C: 1
100%
M: 0 C: 1
100%
convertToString(EDataType, Object)
M: 14 C: 13
48%
M: 1 C: 2
67%
M: 1 C: 2
67%
M: 1 C: 3
75%
M: 0 C: 1
100%
create(EClass)
M: 14 C: 6
30%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 1 C: 2
67%
M: 0 C: 1
100%
createFromString(EDataType, String)
M: 14 C: 13
48%
M: 1 C: 2
67%
M: 1 C: 2
67%
M: 1 C: 3
75%
M: 0 C: 1
100%
createGroup()
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
createGroupLabelAlignmentFromString(EDataType, String)
M: 18 C: 7
28%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 2 C: 3
60%
M: 0 C: 1
100%
createGroupTypeFromString(EDataType, String)
M: 18 C: 7
28%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 2 C: 3
60%
M: 0 C: 1
100%
getGroupPackage()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getPackage()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
init()
M: 6 C: 11
65%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 3 C: 4
57%
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: * Eugen Neufeld - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.view.spi.group.model.impl;
15:
16: import org.eclipse.emf.ecore.EClass;
17: import org.eclipse.emf.ecore.EDataType;
18: import org.eclipse.emf.ecore.EObject;
19: import org.eclipse.emf.ecore.EPackage;
20: import org.eclipse.emf.ecore.impl.EFactoryImpl;
21: import org.eclipse.emf.ecore.plugin.EcorePlugin;
22: import org.eclipse.emf.ecp.view.spi.group.model.GroupLabelAlignment;
23: import org.eclipse.emf.ecp.view.spi.group.model.GroupType;
24: import org.eclipse.emf.ecp.view.spi.group.model.VGroup;
25: import org.eclipse.emf.ecp.view.spi.group.model.VGroupFactory;
26: import org.eclipse.emf.ecp.view.spi.group.model.VGroupPackage;
27:
28: /**
29: * <!-- begin-user-doc -->
30: * An implementation of the model <b>Factory</b>.
31: * <!-- end-user-doc -->
32: *
33: * @generated
34: */
35: public class VGroupFactoryImpl extends EFactoryImpl implements VGroupFactory {
36:         /**
37:          * Creates the default factory implementation.
38:          * <!-- begin-user-doc -->
39:          * <!-- end-user-doc -->
40:          *
41:          * @generated
42:          */
43:         public static VGroupFactory init() {
44:                 try {
45:                         VGroupFactory theGroupFactory = (VGroupFactory) EPackage.Registry.INSTANCE
46:                                 .getEFactory(VGroupPackage.eNS_URI);
47:•                        if (theGroupFactory != null) {
48:                                 return theGroupFactory;
49:                         }
50:                 } catch (Exception exception) {
51:                         EcorePlugin.INSTANCE.log(exception);
52:                 }
53:                 return new VGroupFactoryImpl();
54:         }
55:
56:         /**
57:          * Creates an instance of the factory.
58:          * <!-- begin-user-doc -->
59:          * <!-- end-user-doc -->
60:          *
61:          * @generated
62:          */
63:         public VGroupFactoryImpl() {
64:                 super();
65:         }
66:
67:         /**
68:          * <!-- begin-user-doc -->
69:          * <!-- end-user-doc -->
70:          *
71:          * @generated
72:          */
73:         @Override
74:         public EObject create(EClass eClass) {
75:•                switch (eClass.getClassifierID()) {
76:                 case VGroupPackage.GROUP:
77:                         return createGroup();
78:                 default:
79:                         throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
80:                 }
81:         }
82:
83:         /**
84:          * <!-- begin-user-doc -->
85:          * <!-- end-user-doc -->
86:          *
87:          * @generated
88:          */
89:         @Override
90:         public Object createFromString(EDataType eDataType, String initialValue) {
91:•                switch (eDataType.getClassifierID()) {
92:                 case VGroupPackage.GROUP_TYPE:
93:                         return createGroupTypeFromString(eDataType, initialValue);
94:                 case VGroupPackage.GROUP_LABEL_ALIGNMENT:
95:                         return createGroupLabelAlignmentFromString(eDataType, initialValue);
96:                 default:
97:                         throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
98:                 }
99:         }
100:
101:         /**
102:          * <!-- begin-user-doc -->
103:          * <!-- end-user-doc -->
104:          *
105:          * @generated
106:          */
107:         @Override
108:         public String convertToString(EDataType eDataType, Object instanceValue) {
109:•                switch (eDataType.getClassifierID()) {
110:                 case VGroupPackage.GROUP_TYPE:
111:                         return convertGroupTypeToString(eDataType, instanceValue);
112:                 case VGroupPackage.GROUP_LABEL_ALIGNMENT:
113:                         return convertGroupLabelAlignmentToString(eDataType, instanceValue);
114:                 default:
115:                         throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
116:                 }
117:         }
118:
119:         /**
120:          * <!-- begin-user-doc -->
121:          * <!-- end-user-doc -->
122:          *
123:          * @generated
124:          */
125:         @Override
126:         public VGroup createGroup() {
127:                 VGroupImpl group = new VGroupImpl();
128:                 return group;
129:         }
130:
131:         /**
132:          * <!-- begin-user-doc -->
133:          *
134:          * @since 1.4
135:          * <!-- end-user-doc -->
136:          * @generated
137:          */
138:         public GroupType createGroupTypeFromString(EDataType eDataType, String initialValue) {
139:                 GroupType result = GroupType.get(initialValue);
140:•                if (result == null)
141:                         throw new IllegalArgumentException(
142:                                 "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
143:                 return result;
144:         }
145:
146:         /**
147:          * <!-- begin-user-doc -->
148:          *
149:          * @since 1.4
150:          * <!-- end-user-doc -->
151:          * @generated
152:          */
153:         public String convertGroupTypeToString(EDataType eDataType, Object instanceValue) {
154:•                return instanceValue == null ? null : instanceValue.toString();
155:         }
156:
157:         /**
158:          * <!-- begin-user-doc -->
159:          * <!-- end-user-doc -->
160:          *
161:          * @generated
162:          */
163:         public GroupLabelAlignment createGroupLabelAlignmentFromString(EDataType eDataType, String initialValue) {
164:                 GroupLabelAlignment result = GroupLabelAlignment.get(initialValue);
165:•                if (result == null)
166:                         throw new IllegalArgumentException(
167:                                 "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
168:                 return result;
169:         }
170:
171:         /**
172:          * <!-- begin-user-doc -->
173:          *
174:          * @since 1.3
175:          * <!-- end-user-doc -->
176:          * @generated
177:          */
178:         public String convertGroupLabelAlignmentToString(EDataType eDataType, Object instanceValue) {
179:•                return instanceValue == null ? null : instanceValue.toString();
180:         }
181:
182:         /**
183:          * <!-- begin-user-doc -->
184:          * <!-- end-user-doc -->
185:          *
186:          * @generated
187:          */
188:         @Override
189:         public VGroupPackage getGroupPackage() {
190:                 return (VGroupPackage) getEPackage();
191:         }
192:
193:         /**
194:          * <!-- begin-user-doc -->
195:          * <!-- end-user-doc -->
196:          *
197:          * @deprecated
198:          * @generated
199:          */
200:         @Deprecated
201:         public static VGroupPackage getPackage() {
202:                 return VGroupPackage.eINSTANCE;
203:         }
204:
205: } // VGroupFactoryImpl