Ignore:
Timestamp:
06/06/13 17:08:25 (11 years ago)
Author:
adeicke
Message:
  • Added proper formating and JavaDoc?.
  • Several renaming refactorings.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/result/UsabilityProblemDescriptionResolver.java

    r1216 r1217  
    3333/** 
    3434 * <p> 
    35  * TODO comment 
     35 * Helper class, which creates a {@link UsabilityProblemDescription} for a usability rule. 
    3636 * </p> 
    3737 *  
    3838 * @author Alexander Deicke 
    3939 */ 
    40 public class DefectDescriptionResolver { 
    41  
     40public class UsabilityProblemDescriptionResolver { 
     41 
     42    /** 
     43     * <p> 
     44     * .properties file, which contains all details concerning a usability defect. 
     45     * </p> 
     46     */ 
    4247    private final String defectDescriptionFile = "defects.props"; 
    4348 
    4449    /** 
    4550     * <p> 
    46      * TODO: comment 
     51     * Creates a defect description for a {@link UsabilityRule}. 
    4752     * </p> 
    4853     *  
    4954     * @param name 
    50      * @return 
    51      */ 
    52     public UsabilityDefect descriptionFor(String usabilityRuleName) { 
     55     *            of usability rule 
     56     * @return defect description for usability rule 
     57     */ 
     58    public UsabilityProblemDescription descriptionFor(String usabilityRuleName) { 
    5359        Props allProperties = initProperties(); 
    5460        Map<String, String> usabilityRuleProperties = 
     
    5965    /** 
    6066     * <p> 
    61      * TODO: comment 
    62      * </p> 
    63      *  
    64      * @return 
     67     * Initializes the properties, which are used to create the defect description. 
     68     * </p> 
     69     *  
     70     * @return properties needed to create defect description 
    6571     */ 
    6672    private Props initProperties() { 
     
    7783    /** 
    7884     * <p> 
    79      * TODO: comment 
    80      * </p> 
    81      *  
    82      * @return 
     85     * Loads the .properties file from the system. 
     86     * </p> 
     87     *  
     88     * @return iff present, {@link File} object of the .properties file 
    8389     */ 
    8490    private Optional<File> getDefectDescriptionFile() { 
     
    94100    } 
    95101 
     102    /** 
     103     *  
     104     * <p> 
     105     * Loads the values from the .properties. 
     106     * </p> 
     107     *  
     108     * @param defectDescriptionFile 
     109     *            .properties file 
     110     * @param props 
     111     *            object, which stores the loaded values 
     112     */ 
    96113    private void loadProperties(Optional<File> defectDescriptionFile, Props props) { 
    97114        try { 
     
    105122    /** 
    106123     * <p> 
    107      * TODO: comment 
    108      * </p> 
    109      *  
    110      * @return 
     124     * Returns all existing properties for a given usability rule. 
     125     * </p> 
     126     *  
     127     * @param allProperties 
     128     *            all properties available 
     129     * @param usabilityRuleName 
     130     *            name of usability rule 
     131     * @return all properties of certain usability rule 
    111132     */ 
    112133    private Map<String, String> allUsabilityRuleProperties(Props allProperties, 
    113                                                                    String usabilityRuleName) 
     134                                                           String usabilityRuleName) 
    114135    { 
    115136        Map<String, String> usabilityRuleProperties = Maps.newHashMap(); 
     
    120141    /** 
    121142     * <p> 
    122      * TODO: comment 
     143     * Creates the usability defect. 
    123144     * </p> 
    124145     *  
    125146     * @param usabilityRuleProperties 
    126      * @return 
    127      */ 
    128     private UsabilityDefect createUsabilityDefect(Map<String, String> usabilityRuleProperties) { 
     147     *            all properties needed for creation. 
     148     * @return defect description for a usability rule 
     149     */ 
     150    private UsabilityProblemDescription createUsabilityDefect(Map<String, String> usabilityRuleProperties) 
     151    { 
    129152        String description = 
    130             Iterables.getOnlyElement(Maps.filterKeys(usabilityRuleProperties, descriptionProperty()).values()); 
    131         EnumMap<UsabilityDefectSeverityLevel, Double> severity = 
     153            Iterables.getOnlyElement(Maps 
     154                .filterKeys(usabilityRuleProperties, descriptionProperty()).values()); 
     155        EnumMap<UsabilityProblemSeverityLevel, Double> severity = 
    132156            getSeverityMap(usabilityRuleProperties); 
    133         return new UsabilityDefect(description, severity); 
    134     } 
    135  
    136     /** 
    137      * <p> 
    138      * TODO: comment 
    139      * </p> 
    140      *  
    141      * @return 
     157        return new UsabilityProblemDescription(description, severity); 
     158    } 
     159 
     160    /** 
     161     * <p> 
     162     * Gets the description property. 
     163     * </p> 
     164     *  
     165     * @return description property 
    142166     */ 
    143167    private Predicate<String> descriptionProperty() { 
     
    150174        }; 
    151175    } 
    152      
    153     /** 
    154      * <p> 
    155      * TODO: comment 
     176 
     177    /** 
     178     * <p> 
     179     * Creates severity level map for defect description, by matching all entried from .properties 
     180     * file to corresponding {@link UsabilityProblemSeverityLevel}. 
    156181     * </p> 
    157182     *  
    158183     * @param usabilityRuleProperties 
    159      * @return 
    160      */ 
    161     private EnumMap<UsabilityDefectSeverityLevel, Double> getSeverityMap(Map<String, String> usabilityRuleProperties) 
     184     *            all properties of certain usability rule 
     185     * @return assignment of {@link UsabilityProblemSeverityLevel} and corresponding threshold 
     186     */ 
     187    private EnumMap<UsabilityProblemSeverityLevel, Double> getSeverityMap(Map<String, String> usabilityRuleProperties) 
    162188    { 
    163         EnumMap<UsabilityDefectSeverityLevel, Double> severityMap = 
    164             Maps.newEnumMap(UsabilityDefectSeverityLevel.class); 
     189        EnumMap<UsabilityProblemSeverityLevel, Double> severityMap = 
     190            Maps.newEnumMap(UsabilityProblemSeverityLevel.class); 
    165191        Map<String, String> allSeverityProperties = 
    166192            Maps.filterEntries(usabilityRuleProperties, allSeverityProperties()); 
    167193        for (Entry<String, String> severityProperty : allSeverityProperties.entrySet()) { 
    168             UsabilityDefectSeverityLevel severityLevel = 
     194            UsabilityProblemSeverityLevel severityLevel = 
    169195                getSeverityLevel(severityProperty.getKey()); 
    170196            Double rule = Double.valueOf(severityProperty.getValue()); 
     
    176202    /** 
    177203     * <p> 
    178      * TODO: comment 
    179      * </p> 
    180      *  
    181      * @param key 
    182      * @return 
    183      */ 
    184     private UsabilityDefectSeverityLevel getSeverityLevel(String severityProperty) { 
     204     * Matches severity level from .properties file against {@link UsabilityProblemSeverityLevel}. 
     205     * </p> 
     206     *  
     207     * @param severityProperty 
     208     *            severity level from .properties file 
     209     * @return matching {@link UsabilityProblemSeverityLevel} 
     210     */ 
     211    private UsabilityProblemSeverityLevel getSeverityLevel(String severityProperty) { 
    185212        int startSeverityLevel = severityProperty.lastIndexOf(".") + 1; 
    186         String severitLevelIdentifier = 
     213        String severityLevelIdentifier = 
    187214            severityProperty.substring(startSeverityLevel).toUpperCase(); 
    188         return UsabilityDefectSeverityLevel.valueOf(severitLevelIdentifier); 
    189     } 
    190  
    191     /** 
    192      * <p> 
    193      * TODO: comment 
    194      * </p> 
    195      *  
    196      * @return 
     215        return UsabilityProblemSeverityLevel.valueOf(severityLevelIdentifier); 
     216    } 
     217 
     218    /** 
     219     * <p> 
     220     * Gets the severity level properties. 
     221     * </p> 
     222     *  
     223     * @return severity level 
    197224     */ 
    198225    private Predicate<Entry<String, String>> allSeverityProperties() { 
Note: See TracChangeset for help on using the changeset viewer.