| 1 | /** |
| 2 | * |
| 3 | */ |
| 4 | package de.fzi.se.accuracy.issues; |
| 5 | |
| 6 | import org.eclipse.emf.ecore.EObject; |
| 7 | |
| 8 | import de.fzi.se.quality.qualityannotation.CharacterisedPCMParameterPartition; |
| 9 | import de.uka.ipd.sdq.errorhandling.SeverityAndIssue; |
| 10 | import de.uka.ipd.sdq.errorhandling.SeverityEnum; |
| 11 | |
| 12 | /** |
| 13 | * Factory to create accuracy influence analysis issues. |
| 14 | * |
| 15 | * @author groenda |
| 16 | */ |
| 17 | public class AccuracyIssueFactory { |
| 18 | |
| 19 | /**Creates a new missing quality annotation issue for EObjects. |
| 20 | * @param object The object for which no quality annotation was found. |
| 21 | * @return the issue. |
| 22 | */ |
| 23 | public static SeverityAndIssue createMissingQualityAnnotationIssue( |
| 24 | EObject object) { |
| 25 | return new SeverityAndIssue( |
| 26 | SeverityEnum.WARNING, |
| 27 | "No information on the quality was provided for the RDSEFF. Assuming a quality of ExactlyAsSpecifiedPrecision. This assumption may lead to prediction errors.", |
| 28 | object); |
| 29 | } |
| 30 | |
| 31 | /**Creates a new missing quality annotation issue for Objects which are not EObjects. |
| 32 | * @param resourceName The location of the resource. |
| 33 | * @param rdseffId UUID of the RD-SEFF. |
| 34 | * @return the issue. |
| 35 | */ |
| 36 | public static SeverityAndIssue createMissingQualityAnnotationIssue( |
| 37 | String resourceName, String rdseffId) { |
| 38 | return new RDSEFFSourceCodeIssue( |
| 39 | SeverityEnum.WARNING, |
| 40 | "No information on the quality was provided for the RDSEFF. Assuming a quality of ExactlyAsSpecifiedPrecision. This assumption may lead to prediction errors.", |
| 41 | null, resourceName, rdseffId); |
| 42 | } |
| 43 | |
| 44 | /**Creates a new invalid quality annotation issue. |
| 45 | * @param object The object for which the quality annotation was invalid. |
| 46 | * @return the issue. |
| 47 | */ |
| 48 | public static SeverityAndIssue createInvalidQualityAnnotationIssue( |
| 49 | EObject object) { |
| 50 | return new SeverityAndIssue( |
| 51 | SeverityEnum.WARNING, |
| 52 | "The quality information provided for the RDSEFF was invalid. Assuming a quality of ExactlyAsSpecifiedPrecision. This assumption may lead to prediction errors.", |
| 53 | object); |
| 54 | } |
| 55 | |
| 56 | /**Create a new parameter extrapolation issue. |
| 57 | * @param variableReference Identifier of the variable (including the variable's namespace). |
| 58 | * @param characterization The characterization of the variable |
| 59 | * @param rdseffId ID of the RD-SEFF in which the variable was used. |
| 60 | * @param resourceName The location of the resource. |
| 61 | * @param actualValue The actual experienced value which lead to the issue. |
| 62 | * @return new issue. |
| 63 | */ |
| 64 | public static SeverityAndIssue createParameterExtrapolationIssue( |
| 65 | String variableReference, String rdseffId, String resourceName, |
| 66 | Object actualValue, String actionId) { |
| 67 | return new VariableSourceCodeIssue( |
| 68 | SeverityEnum.WARNING, |
| 69 | "The experienced parameter value was outside of the provided accuracy bounds. The experienced value is used nonetheless. This extrapolation may lead to prediction errors.", |
| 70 | actualValue, |
| 71 | resourceName, |
| 72 | rdseffId, |
| 73 | actionId, |
| 74 | variableReference); |
| 75 | } |
| 76 | |
| 77 | /**Creates a new type inference issue. |
| 78 | * @return new issue. |
| 79 | */ |
| 80 | public static SeverityAndIssue createTypeInferenceIssue(String msg) { |
| 81 | return new SeverityAndIssue(SeverityEnum.ERROR, msg, null); |
| 82 | } |
| 83 | |
| 84 | /**Creates a new issue for {@link CharacterisedPCMParameterPartition}. |
| 85 | * @param msg The message. |
| 86 | * @param objectResourceName The resource in which the message occurred. |
| 87 | * @param partitionId The UUID of the partition. |
| 88 | * @return new issue. |
| 89 | */ |
| 90 | public static SeverityAndIssue createCharacterisedPCMParameterPartition(String msg, String objectResourceName, String partitionId) { |
| 91 | return new CharacterisedPCMParameterPartitionSourceCodeIssue(SeverityEnum.ERROR, msg, null, objectResourceName, partitionId); |
| 92 | } |
| 93 | } |