Skip to content

Package: ErrorFactoryImpl

ErrorFactoryImpl

nameinstructionbranchcomplexitylinemethod
ErrorFactoryImpl()
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%
convertSeverityToString(EDataType, Object)
M: 7 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
convertToString(EDataType, Object)
M: 22 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
create(EClass)
M: 32 C: 6
16%
M: 7 C: 1
13%
M: 7 C: 1
13%
M: 7 C: 2
22%
M: 0 C: 1
100%
createDMRLocation()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
createDMRLocation(VDomainModelReference)
M: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
createEMFLocation()
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%
createEMFLocation(EObject)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
createEMFLocation(EObject, DMRLocation)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
createEMFLocation(EObject, SettingLocation)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
createEMFLocation(EObject, SettingLocation, DMRLocation)
M: 0 C: 14
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
createErrorReport()
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%
createFromString(EDataType, String)
M: 22 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
createInvalidSheetLocation(String)
M: 20 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
createSettingLocation()
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%
createSettingLocation(EObject, EStructuralFeature)
M: 0 C: 11
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
createSettingToSheetMapping()
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%
createSettingToSheetMapping(SettingLocation, SheetLocation)
M: 0 C: 11
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
createSeverityFromString(EDataType, String)
M: 25 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
createSheetLocation()
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%
createSheetLocation(String, int, int, String)
M: 0 C: 17
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
createSpreadsheetImportResult()
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%
getErrorPackage()
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-2015 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: * Johannes Faltermeier - initial API and implementation
13: */
14: package org.eclipse.emfforms.spi.spreadsheet.core.error.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.EStructuralFeature;
21: import org.eclipse.emf.ecore.impl.EFactoryImpl;
22: import org.eclipse.emf.ecore.plugin.EcorePlugin;
23: import org.eclipse.emf.ecp.view.spi.model.VDomainModelReference;
24: import org.eclipse.emfforms.spi.spreadsheet.core.error.model.DMRLocation;
25: import org.eclipse.emfforms.spi.spreadsheet.core.error.model.EMFLocation;
26: import org.eclipse.emfforms.spi.spreadsheet.core.error.model.ErrorFactory;
27: import org.eclipse.emfforms.spi.spreadsheet.core.error.model.ErrorPackage;
28: import org.eclipse.emfforms.spi.spreadsheet.core.error.model.ErrorReport;
29: import org.eclipse.emfforms.spi.spreadsheet.core.error.model.SettingLocation;
30: import org.eclipse.emfforms.spi.spreadsheet.core.error.model.SettingToSheetMapping;
31: import org.eclipse.emfforms.spi.spreadsheet.core.error.model.Severity;
32: import org.eclipse.emfforms.spi.spreadsheet.core.error.model.SheetLocation;
33: import org.eclipse.emfforms.spi.spreadsheet.core.error.model.SpreadsheetImportResult;
34:
35: /**
36: * <!-- begin-user-doc -->
37: * An implementation of the model <b>Factory</b>.
38: * <!-- end-user-doc -->
39: *
40: * @generated
41: */
42: public class ErrorFactoryImpl extends EFactoryImpl implements ErrorFactory {
43:         /**
44:          * Creates the default factory implementation.
45:          * <!-- begin-user-doc -->
46:          * <!-- end-user-doc -->
47:          *
48:          * @generated
49:          */
50:         public static ErrorFactory init() {
51:                 try {
52:                         final ErrorFactory theErrorFactory = (ErrorFactory) EPackage.Registry.INSTANCE
53:                                 .getEFactory(ErrorPackage.eNS_URI);
54:•                        if (theErrorFactory != null) {
55:                                 return theErrorFactory;
56:                         }
57:                 } catch (final Exception exception) {
58:                         EcorePlugin.INSTANCE.log(exception);
59:                 }
60:                 return new ErrorFactoryImpl();
61:         }
62:
63:         /**
64:          * Creates an instance of the factory.
65:          * <!-- begin-user-doc -->
66:          * <!-- end-user-doc -->
67:          *
68:          * @generated
69:          */
70:         public ErrorFactoryImpl() {
71:                 super();
72:         }
73:
74:         /**
75:          * <!-- begin-user-doc -->
76:          * <!-- end-user-doc -->
77:          *
78:          * @generated
79:          */
80:         @Override
81:         public EObject create(EClass eClass) {
82:•                switch (eClass.getClassifierID()) {
83:                 case ErrorPackage.SPREADSHEET_IMPORT_RESULT:
84:                         return createSpreadsheetImportResult();
85:                 case ErrorPackage.ERROR_REPORT:
86:                         return createErrorReport();
87:                 case ErrorPackage.SHEET_LOCATION:
88:                         return createSheetLocation();
89:                 case ErrorPackage.EMF_LOCATION:
90:                         return createEMFLocation();
91:                 case ErrorPackage.SETTING_LOCATION:
92:                         return createSettingLocation();
93:                 case ErrorPackage.DMR_LOCATION:
94:                         return createDMRLocation();
95:                 case ErrorPackage.SETTING_TO_SHEET_MAPPING:
96:                         return createSettingToSheetMapping();
97:                 default:
98:                         throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
99:                 }
100:         }
101:
102:         /**
103:          * <!-- begin-user-doc -->
104:          * <!-- end-user-doc -->
105:          *
106:          * @generated
107:          */
108:         @Override
109:         public Object createFromString(EDataType eDataType, String initialValue) {
110:•                switch (eDataType.getClassifierID()) {
111:                 case ErrorPackage.SEVERITY:
112:                         return createSeverityFromString(eDataType, initialValue);
113:                 default:
114:                         throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
115:                 }
116:         }
117:
118:         /**
119:          * <!-- begin-user-doc -->
120:          * <!-- end-user-doc -->
121:          *
122:          * @generated
123:          */
124:         @Override
125:         public String convertToString(EDataType eDataType, Object instanceValue) {
126:•                switch (eDataType.getClassifierID()) {
127:                 case ErrorPackage.SEVERITY:
128:                         return convertSeverityToString(eDataType, instanceValue);
129:                 default:
130:                         throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
131:                 }
132:         }
133:
134:         /**
135:          * <!-- begin-user-doc -->
136:          * <!-- end-user-doc -->
137:          *
138:          * @generated
139:          */
140:         @Override
141:         public SpreadsheetImportResult createSpreadsheetImportResult() {
142:                 final SpreadsheetImportResultImpl spreadsheetImportResult = new SpreadsheetImportResultImpl();
143:                 return spreadsheetImportResult;
144:         }
145:
146:         /**
147:          * <!-- begin-user-doc -->
148:          * <!-- end-user-doc -->
149:          *
150:          * @generated
151:          */
152:         @Override
153:         public ErrorReport createErrorReport() {
154:                 final ErrorReportImpl errorReport = new ErrorReportImpl();
155:                 return errorReport;
156:         }
157:
158:         /**
159:          * <!-- begin-user-doc -->
160:          * <!-- end-user-doc -->
161:          *
162:          * @generated
163:          */
164:         @Override
165:         public EMFLocation createEMFLocation() {
166:                 final EMFLocationImpl emfLocation = new EMFLocationImpl();
167:                 return emfLocation;
168:         }
169:
170:         /**
171:          * <!-- begin-user-doc -->
172:          * <!-- end-user-doc -->
173:          *
174:          * @generated
175:          */
176:         @Override
177:         public SettingLocation createSettingLocation() {
178:                 final SettingLocationImpl settingLocation = new SettingLocationImpl();
179:                 return settingLocation;
180:         }
181:
182:         /**
183:          * <!-- begin-user-doc -->
184:          * <!-- end-user-doc -->
185:          *
186:          * @generated
187:          */
188:         @Override
189:         public DMRLocation createDMRLocation() {
190:                 final DMRLocationImpl dmrLocation = new DMRLocationImpl();
191:                 return dmrLocation;
192:         }
193:
194:         /**
195:          * <!-- begin-user-doc -->
196:          * <!-- end-user-doc -->
197:          *
198:          * @generated
199:          */
200:         @Override
201:         public SettingToSheetMapping createSettingToSheetMapping() {
202:                 final SettingToSheetMappingImpl settingToSheetMapping = new SettingToSheetMappingImpl();
203:                 return settingToSheetMapping;
204:         }
205:
206:         /**
207:          * <!-- begin-user-doc -->
208:          * <!-- end-user-doc -->
209:          *
210:          * @generated
211:          */
212:         @Override
213:         public SheetLocation createSheetLocation() {
214:                 final SheetLocationImpl sheetLocation = new SheetLocationImpl();
215:                 return sheetLocation;
216:         }
217:
218:         /**
219:          * <!-- begin-user-doc -->
220:          * <!-- end-user-doc -->
221:          *
222:          * @generated
223:          */
224:         public Severity createSeverityFromString(EDataType eDataType, String initialValue) {
225:                 final Severity result = Severity.get(initialValue);
226:•                if (result == null) {
227:                         throw new IllegalArgumentException(
228:                                 "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
229:                 }
230:                 return result;
231:         }
232:
233:         /**
234:          * <!-- begin-user-doc -->
235:          * <!-- end-user-doc -->
236:          *
237:          * @generated
238:          */
239:         public String convertSeverityToString(EDataType eDataType, Object instanceValue) {
240:•                return instanceValue == null ? null : instanceValue.toString();
241:         }
242:
243:         /**
244:          * <!-- begin-user-doc -->
245:          * <!-- end-user-doc -->
246:          *
247:          * @generated
248:          */
249:         @Override
250:         public ErrorPackage getErrorPackage() {
251:                 return (ErrorPackage) getEPackage();
252:         }
253:
254:         /**
255:          * <!-- begin-user-doc -->
256:          * <!-- end-user-doc -->
257:          *
258:          * @deprecated
259:          * @generated
260:          */
261:         @Deprecated
262:         public static ErrorPackage getPackage() {
263:                 return ErrorPackage.eINSTANCE;
264:         }
265:
266:         @Override
267:         public EMFLocation createEMFLocation(EObject root, SettingLocation settingLocation, DMRLocation dmrLocation) {
268:                 final EMFLocation location = createEMFLocation();
269:                 location.setRoot(root);
270:                 location.setSettingLocation(settingLocation);
271:                 location.setDmrLocation(dmrLocation);
272:                 return location;
273:         }
274:
275:         @Override
276:         public EMFLocation createEMFLocation(EObject root, DMRLocation dmrLocation) {
277:                 return createEMFLocation(root, null, dmrLocation);
278:         }
279:
280:         @Override
281:         public EMFLocation createEMFLocation(EObject root) {
282:                 return createEMFLocation(root, null, null);
283:         }
284:
285:         @Override
286:         public EMFLocation createEMFLocation(EObject root, SettingLocation settingLocation) {
287:                 return createEMFLocation(root, settingLocation, null);
288:         }
289:
290:         @Override
291:         public SettingLocation createSettingLocation(EObject eObject, EStructuralFeature feature) {
292:                 final SettingLocation location = createSettingLocation();
293:                 location.setEObject(eObject);
294:                 location.setFeature(feature);
295:                 return location;
296:         }
297:
298:         @Override
299:         public DMRLocation createDMRLocation(VDomainModelReference dmr) {
300:                 final DMRLocation location = createDMRLocation();
301:                 location.setDomainModelReference(dmr);
302:                 return location;
303:         }
304:
305:         @Override
306:         public SheetLocation createSheetLocation(String sheet, int column, int row, String columnName) {
307:                 final SheetLocation location = createSheetLocation();
308:                 location.setSheet(sheet);
309:                 location.setColumn(column);
310:                 location.setRow(row);
311:                 location.setColumnName(columnName);
312:                 return location;
313:         }
314:
315:         /**
316:          * {@inheritDoc}
317:          *
318:          * @see org.eclipse.emfforms.spi.spreadsheet.core.error.model.ErrorFactory#createSettingToSheetMapping(org.eclipse.emfforms.spi.spreadsheet.core.error.model.SettingLocation,
319:          * org.eclipse.emfforms.spi.spreadsheet.core.error.model.SheetLocation)
320:          */
321:         @Override
322:         public SettingToSheetMapping createSettingToSheetMapping(SettingLocation settingLocation,
323:                 SheetLocation sheetLocation) {
324:                 final SettingToSheetMapping mapping = createSettingToSheetMapping();
325:                 mapping.setSettingLocation(settingLocation);
326:                 mapping.setSheetLocation(sheetLocation);
327:                 return mapping;
328:         }
329:
330:         /**
331:          * {@inheritDoc}
332:          *
333:          * @see org.eclipse.emfforms.spi.spreadsheet.core.error.model.ErrorFactory#createInvalidSheetLocation(java.lang.String)
334:          */
335:         @Override
336:         public SheetLocation createInvalidSheetLocation(String columnName) {
337:                 final SheetLocation location = createSheetLocation();
338:                 location.setSheet(SheetLocation.INVALID_SHEET);
339:                 location.setColumn(SheetLocation.INVALID_COLUMN);
340:                 location.setRow(SheetLocation.INVALID_ROW);
341:                 location.setColumnName(columnName);
342:                 location.setValid(false);
343:                 return location;
344:         }
345:
346: } // ErrorFactoryImpl