Index: trunk/autoquest-core-usability/src/main/java/de/ugoe/cs/autoquest/usability/TextInputStatisticsRule.java
===================================================================
--- trunk/autoquest-core-usability/src/main/java/de/ugoe/cs/autoquest/usability/TextInputStatisticsRule.java	(revision 1335)
+++ trunk/autoquest-core-usability/src/main/java/de/ugoe/cs/autoquest/usability/TextInputStatisticsRule.java	(revision 1493)
@@ -15,5 +15,4 @@
 package de.ugoe.cs.autoquest.usability;
 
-import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -57,5 +56,5 @@
         calculateStatistics(taskModel.getUserSessions(), statistics);
 
-        UsabilityEvaluationResult results = new UsabilityEvaluationResult();
+        UsabilityEvaluationResult results = new UsabilityEvaluationResult(taskModel);
         analyzeStatistics(statistics, results);
 
@@ -80,26 +79,16 @@
                                      UsabilityEvaluationResult results)
     {
-        float allTextFieldInputs =
+        int allTextFieldInputs =
             statistics.getNoOfTextFieldInputs() + statistics.getNoOfTextAreaInputs();
 
-        float ratio = allTextFieldInputs / (float) statistics.getNoOfAllEvents();
-
-        UsabilityDefectSeverity severity = null;
-        if (ratio > 0.9) {
-            severity = UsabilityDefectSeverity.HIGH;
-        }
-        else if (ratio > 0.7) {
-            severity = UsabilityDefectSeverity.MEDIUM;
-        }
-        else if (ratio > 0.5) {
-            severity = UsabilityDefectSeverity.LOW;
-        }
-        else if (ratio > 0.3) {
-            severity = UsabilityDefectSeverity.INFO;
-        }
-
+        int ratio = 1000 * allTextFieldInputs / statistics.getNoOfAllEvents();
+
+        // TODO comment magic numbers
+        UsabilityDefectSeverity severity = UsabilityDefectSeverity.getSeverity
+            (ratio, 900, 700, 500, 300);
+        
         if (severity != null) {
-            Map<String, String> parameters = new HashMap<String, String>();
-            parameters.put("textInputRatio", DecimalFormat.getInstance().format(ratio * 100));
+            Map<String, Object> parameters = new HashMap<String, Object>();
+            parameters.put("textInputRatio", (ratio / 10));
 
             results.addDefect
@@ -122,47 +111,36 @@
             int noOfUsagesOfTextField1WithSameTextInTextField2 = entry.enteredTexts.size();
             
-            float ratioTextField1 =
-                noOfUsagesOfTextField1WithSameTextInTextField2 / (float) noOfUsagesOfTextField1;
-            
-            float ratioTextField2 =
-                noOfUsagesOfTextField1WithSameTextInTextField2 / (float) noOfUsagesOfTextField2;
-            
-            createTextFieldEntryRepetitionDefect
-                (ratioTextField1, entry.textField1, entry.textField2, results);
-            
-            createTextFieldEntryRepetitionDefect
-                (ratioTextField2, entry.textField2, entry.textField1, results);
-            
-        }
-    }
-
-    /**
-     *
-     */
-    private void createTextFieldEntryRepetitionDefect(float                     ratioOfEqualEntries,
+            int ratioTextField1 = 
+                1000 * noOfUsagesOfTextField1WithSameTextInTextField2 / noOfUsagesOfTextField1;
+            
+            int ratioTextField2 =
+                1000 * noOfUsagesOfTextField1WithSameTextInTextField2 / noOfUsagesOfTextField2;
+
+            createTextFieldEntryRepetitionDefect(ratioTextField1, entry.textField1,
+                                                 entry.textField2, results);
+            
+            createTextFieldEntryRepetitionDefect(ratioTextField2, entry.textField2,
+                                                 entry.textField1, results);
+            
+        }
+    }
+
+    /**
+     *
+     */
+    private void createTextFieldEntryRepetitionDefect(int                       ratioOfEqualEntries,
                                                       ITextField                textField1,
                                                       ITextField                textField2,
                                                       UsabilityEvaluationResult results)
     {
-        UsabilityDefectSeverity severity = null;
-        if (ratioOfEqualEntries > 0.9) {
-            severity = UsabilityDefectSeverity.HIGH;
-        }
-        else if (ratioOfEqualEntries > 0.5) {
-            severity = UsabilityDefectSeverity.MEDIUM;
-        }
-        else if (ratioOfEqualEntries > 0.2) {
-            severity = UsabilityDefectSeverity.LOW;
-        }
-        else if (ratioOfEqualEntries > 0.1) {
-            severity = UsabilityDefectSeverity.INFO;
-        }
+        // TODO comment magic numbers
+        UsabilityDefectSeverity severity = UsabilityDefectSeverity.getSeverity
+            (ratioOfEqualEntries, 900, 500, 200, 100);
         
         if (severity != null) {
-            Map<String, String> parameters = new HashMap<String, String>();
-            parameters.put("textRepetitionRatio",
-                           DecimalFormat.getInstance().format(ratioOfEqualEntries * 100));
-            parameters.put("textField1", textField1.toString());
-            parameters.put("textField2", textField2.toString());
+            Map<String, Object> parameters = new HashMap<String, Object>();
+            parameters.put("textRepetitionRatio", (ratioOfEqualEntries / 10));
+            parameters.put("textField1", textField1);
+            parameters.put("textField2", textField2);
 
             results.addDefect
@@ -192,28 +170,22 @@
             }
 
-            float ratio = (float) noLetterOrDigitCount / (float) allCharactersCount;
-
-            UsabilityDefectSeverity severity = null;
-            if (ratio > 0.1) { // every 10th sign
-                severity = UsabilityDefectSeverity.HIGH;
-            }
-            else if (ratio > 0.05) { // every 20th sign
-                severity = UsabilityDefectSeverity.MEDIUM;
-            }
-            else if (ratio > 0.02) { // every 50th sign
-                severity = UsabilityDefectSeverity.LOW;
-            }
-            else if (ratio > 0.01) { // every 100th sign
-                severity = UsabilityDefectSeverity.INFO;
-            }
+            int ratio = 1000 * noLetterOrDigitCount / allCharactersCount;
+
+            UsabilityDefectSeverity severity =
+                UsabilityDefectSeverity.getSeverity(ratio,
+                                                    100, // every 10th sign
+                                                    50, // every 20th sign
+                                                    20, // every 50th sign
+                                                    10 // every 100th sign
+                                                    );
 
             if (severity != null) {
-                Map<String, String> parameters = new HashMap<String, String>();
-                parameters.put("textField", textField.toString());
-                parameters.put("noLetterOrDigitRatio",
-                               DecimalFormat.getInstance().format(ratio * 100));
+                Map<String, Object> parameters = new HashMap<String, Object>();
+                parameters.put("textField", textField);
+                parameters.put("noLetterOrDigitRatio", (ratio / 10));
 
                 results.addDefect
-                    (severity, UsabilityDefectDescription.TEXT_FIELD_NO_LETTER_OR_DIGIT_RATIO, parameters);
+                    (severity, UsabilityDefectDescription.TEXT_FIELD_NO_LETTER_OR_DIGIT_RATIO,
+                     parameters);
             }
         }
