- Timestamp:
- 07/27/12 14:36:59 (12 years ago)
- Location:
- trunk/quest-core-usability/src/main/java/de/ugoe/cs/quest/usability
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-core-usability/src/main/java/de/ugoe/cs/quest/usability/TextInputStatisticsRule.java
r477 r496 60 60 checkTextInputRatio(statistics, results); 61 61 checkTextFieldEntryRepetitions(statistics, results); 62 checkTextFieldNoLetterOrDigitInputs(statistics, results); 62 63 } 63 64 … … 88 89 } 89 90 else if (ratio > 0.5) 91 { 92 severity = UsabilityDefectSeverity.LOW; 93 } 94 else if (ratio > 0.3) 90 95 { 91 96 severity = UsabilityDefectSeverity.INFO; … … 180 185 * TODO: comment 181 186 * 187 * @param statistics 188 * @param results 189 */ 190 //----------------------------------------------------------------------------------------------- 191 private void checkTextFieldNoLetterOrDigitInputs(TextInputStatistics statistics, 192 UsabilityEvaluationResult results) 193 { 194 int allCharactersCount = 0; 195 int noLetterOrDigitCount = 0; 196 197 for (int i = 0; i < statistics.getNoOfTextFieldInputs(); i++) 198 { 199 String[] fragments = statistics.getTextFieldInputFragments(i); 200 for (String fragment : fragments) 201 { 202 String effectiveFragment = fragment.trim(); 203 for (int j = 0; j < effectiveFragment.length(); j++) 204 { 205 if (!Character.isWhitespace(effectiveFragment.charAt(j))) 206 { 207 if (!Character.isLetterOrDigit(effectiveFragment.charAt(j))) 208 { 209 noLetterOrDigitCount++; 210 } 211 allCharactersCount++; 212 } 213 } 214 } 215 } 216 217 float ratio = (float) noLetterOrDigitCount / (float) allCharactersCount; 218 219 UsabilityDefectSeverity severity = null; 220 if (ratio > 0.1) // every 10th sign 221 { 222 severity = UsabilityDefectSeverity.HIGH; 223 } 224 else if (ratio > 0.05) // every 20th sign 225 { 226 severity = UsabilityDefectSeverity.MEDIUM; 227 } 228 else if (ratio > 0.02) // every 50th sign 229 { 230 severity = UsabilityDefectSeverity.LOW; 231 } 232 else if (ratio > 0.01) // every 100th sign 233 { 234 severity = UsabilityDefectSeverity.INFO; 235 } 236 237 if (severity != null) 238 { 239 Map<String, String> parameters = new HashMap<String, String>(); 240 parameters.put("noLetterOrDigitRatio", allCharactersCount + " entered characters of " + 241 "which " + noLetterOrDigitCount + " were no letter or digit"); 242 243 results.addDefect 244 (new UsabilityDefect 245 (severity, UsabilityDefectDescription.TEXT_FIELD_NO_LETTER_OR_DIGIT_RATIO, parameters)); 246 } 247 } 248 249 //----------------------------------------------------------------------------------------------- 250 /** 251 * TODO: comment 252 * 182 253 * @param taskTree 183 254 * @param statistics -
trunk/quest-core-usability/src/main/java/de/ugoe/cs/quest/usability/UsabilityDefectDescription.java
r475 r496 29 29 { 30 30 TEXT_FIELD_INPUT_RATIO, 31 TEXT_FIELD_INPUT_REPETITIONS; 31 TEXT_FIELD_INPUT_REPETITIONS, 32 TEXT_FIELD_NO_LETTER_OR_DIGIT_RATIO; 32 33 33 34 /** */
Note: See TracChangeset
for help on using the changeset viewer.