Changeset 1217 for trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/result/UsabilityProblemDescription.java
- Timestamp:
- 06/06/13 17:08:25 (11 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/result/UsabilityProblemDescription.java
r1216 r1217 25 25 import com.google.common.collect.Maps; 26 26 27 28 27 /** 29 28 * <p> 30 * TODO comment29 * Description for a usability problem. 31 30 * </p> 32 31 * 33 32 * @author Alexander Deicke 34 33 */ 35 public class UsabilityDefect { 36 37 private UsabilityDefectSeverityLevel severityLevel = UsabilityDefectSeverityLevel.NONE; 38 39 private String description; 40 41 private final EnumMap<UsabilityDefectSeverityLevel, Double> severity; 42 34 public class UsabilityProblemDescription { 43 35 /** 44 36 * <p> 45 * T ODO: comment37 * The severity of the defect. 46 38 * </p> 47 * 39 */ 40 41 private UsabilityProblemSeverityLevel severityLevel = UsabilityProblemSeverityLevel.NONE; 42 43 /** 44 * <p> 45 * A detailed description of the defect. 46 * </p> 47 */ 48 private String description; 49 50 /** 51 * <p> 52 * Assignment of all possible severity values to a certain threshold. This is used, to determine 53 * the severity level during the usability evaluation. 54 * </p> 55 */ 56 private final EnumMap<UsabilityProblemSeverityLevel, Double> severity; 57 58 /** 59 * <p> 60 * Constructor. Creates a new UsabilityDefectDescription for given description and all possible 61 * severity level. 62 * </p> 63 * 48 64 * @param description 65 * description of the defect 49 66 * @param severity 67 * all possible severity level and their threshold 50 68 */ 51 public Usability Defect(String description,52 EnumMap<UsabilityDefectSeverityLevel, Double> severity)69 public UsabilityProblemDescription(String description, 70 EnumMap<UsabilityProblemSeverityLevel, Double> severity) 53 71 { 54 72 this.description = description; … … 58 76 /** 59 77 * <p> 60 * TODO: comment78 * Gets the severity level of this defect. 61 79 * </p> 62 * 63 * @return 80 * 81 * @return severity level of this defect 64 82 */ 65 public Usability DefectSeverityLevel getSeverityLevel() {83 public UsabilityProblemSeverityLevel getSeverityLevel() { 66 84 return this.severityLevel; 67 85 } … … 69 87 /** 70 88 * <p> 71 * TODO: comment 89 * Checks, if a defect is present. Therefore it uses a value, which is used to determine the 90 * severity level. 72 91 * </p> 73 * 92 * 74 93 * @param evaluationMetric 75 * @return 94 * value, which determines the severity level of a defect 95 * @return iff defect is present, a {@linkplain UsabilityProblemDescription} of the defect 76 96 */ 77 public Optional<UsabilityDefect> isPresent(float evaluationMetric) { 78 Optional<UsabilityDefect> defect = Optional.absent(); 79 Map<UsabilityDefectSeverityLevel, Double> matchingSeverityLevels = Maps.filterValues(this.severity, severityForMetric(evaluationMetric)); 80 if(matchingSeverityLevels.isEmpty()) { 97 public Optional<UsabilityProblemDescription> isPresent(float evaluationMetric) { 98 Optional<UsabilityProblemDescription> defect = Optional.absent(); 99 Map<UsabilityProblemSeverityLevel, Double> matchingSeverityLevels = 100 Maps.filterValues(this.severity, severityForMetric(evaluationMetric)); 101 if (matchingSeverityLevels.isEmpty()) { 81 102 return defect; 82 103 } … … 87 108 /** 88 109 * <p> 89 * TODO: comment110 * Initializes the properties of a {@linkplain UsabilityProblemDescription}. 90 111 * </p> 91 * 112 * 92 113 * @param matchingSeverityLevels 114 * all severity level, where {@linkplain evaluationMetric} exceeds the threshold 93 115 * @param evaluationMetric 116 * measure for the defect 94 117 */ 95 private void setDefectAttributes(Map<Usability DefectSeverityLevel, Double> matchingSeverityLevels,118 private void setDefectAttributes(Map<UsabilityProblemSeverityLevel, Double> matchingSeverityLevels, 96 119 float evaluationMetric) 97 120 { 98 BiMap<Double, UsabilityDefectSeverityLevel> inverse = HashBiMap.create(matchingSeverityLevels).inverse(); 121 BiMap<Double, UsabilityProblemSeverityLevel> inverse = 122 HashBiMap.create(matchingSeverityLevels).inverse(); 99 123 this.severityLevel = inverse.get(Collections.max(inverse.keySet())); 100 124 this.description = String.format(this.description, evaluationMetric); … … 103 127 /** 104 128 * <p> 105 * TODO: comment129 * Gets severity level depending on a measurement for the defect. 106 130 * </p> 107 * @param evaluationMetric 108 * 109 * @return 131 * 132 * @param evaluationMetric 133 * measure for the defect 134 * 135 * @return severity level, if measurement is equal or bigger as the threshold of the severity 136 * level 110 137 */ 111 private Predicate< 138 private Predicate<Double> severityForMetric(final float evaluationMetric) { 112 139 return new Predicate<Double>() { 113 140 114 141 public boolean apply(Double severityThreshold) { 115 return evaluationMetric == severityThreshold || evaluationMetric > severityThreshold; 142 return evaluationMetric == severityThreshold || 143 evaluationMetric > severityThreshold; 116 144 } 117 145 118 146 }; 119 147 }
Note: See TracChangeset
for help on using the changeset viewer.