Changeset 1217 for trunk


Ignore:
Timestamp:
06/06/13 17:08:25 (12 years ago)
Author:
adeicke
Message:
  • Added proper formating and JavaDoc?.
  • Several renaming refactorings.
Location:
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability
Files:
4 added
3 deleted
27 edited
4 copied
5 moved

Legend:

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

    r1158 r1217  
    2121import de.ugoe.cs.autoquest.CommandHelpers; 
    2222import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 
    23 import de.ugoe.cs.autoquest.usability.rules.EmptyRuleset; 
     23import de.ugoe.cs.autoquest.usability.rules.PatternRuleset; 
    2424import de.ugoe.cs.autoquest.usability.rules.UsabilityResult; 
    2525import de.ugoe.cs.autoquest.usability.rules.UsabilityRuleset; 
     
    2929/** 
    3030 * <p> 
    31  * TODO comment 
     31 * Command to perform a automatic usability evaluation for a given task model. 
    3232 * </p> 
    3333 *  
     
    3636public class CMDperformUsabilityEvaluation implements Command { 
    3737 
     38    /** 
     39     * <p> 
     40     * index for name of task model under which it could be retrieved from 
     41     * {@link GlobalDataContainer} 
     42     * </p> 
     43     */ 
    3844    private final int taskModelParamaterIndex = 0; 
    39      
     45 
     46    /** 
     47     * <p> 
     48     * index for name under which evaluation result should be stored in {@link GlobalDataContainer} 
     49     * </p> 
     50     */ 
    4051    private final int evaluationResultParameterIndex = 1; 
    41      
     52 
     53    /** 
     54     * <p> 
     55     * default name for evaluation result, which is used to store it in {@link GlobalDataContainer} 
     56     * </p> 
     57     */ 
    4258    private final String defaultEvaluationResultParameterName = "usabilityEvaluationResult"; 
    43      
    44     private final UsabilityRuleset defaultUsabilityRuleset = new EmptyRuleset(); 
    45      
    46     /* (non-Javadoc) 
     59 
     60    /* 
     61     * (non-Javadoc) 
     62     *  
    4763     * @see de.ugoe.cs.util.console.Command#run(java.util.List) 
    4864     */ 
     
    5268        Optional<ITaskModel> taskModel = getTaskModelFromDataContainer(nameOfTaskModel); 
    5369        if (taskModel.isPresent()) { 
    54             UsabilityRuleset ruleset = getUsabilityRuleset(); 
     70            UsabilityRuleset ruleset = new PatternRuleset(taskModel.get()); 
    5571            UsabilityResult result = UsabilityEvaluator.evaluate(taskModel.get()).using(ruleset); 
    5672            String evaluationResultParameterName = getEvaluationResultParameter(parameters); 
    5773            storeUsabilityResultInDataContainer(evaluationResultParameterName, result); 
    5874        } 
    59         return; 
    6075    } 
    6176 
    6277    /** 
    6378     * <p> 
    64      * TODO: comment 
     79     * Gets name of task model from list of parameters. 
    6580     * </p> 
    66      * 
     81     *  
    6782     * @param parameters 
    68      * @return 
     83     *            parameters for the command 
     84     * @return name of task model 
    6985     */ 
    7086    private String getTaskModelParameter(List<Object> parameters) { 
    7187        try { 
    7288            return (String) parameters.get(taskModelParamaterIndex); 
    73         } catch (Exception e) { 
     89        } 
     90        catch (Exception e) { 
    7491            throw new IllegalArgumentException("must provide a task model name"); 
    7592        } 
     
    7895    /** 
    7996     * <p> 
    80      * TODO: comment 
     97     * Gets name under which evaluation result should be stored in {@link GlobalDataContainer} from 
     98     * list of parameters. If not present, the default value {@code usabilityEvaluationResult} is 
     99     * used! 
    81100     * </p> 
    82      * 
     101     *  
    83102     * @param parameters 
    84      * @return 
     103     *            parameters for the command 
     104     * @return name under which evaluation result should be stored 
    85105     */ 
    86106    private String getEvaluationResultParameter(List<Object> parameters) { 
    87         if(parameters.size() == 2) { 
     107        if (parameters.size() == 2) { 
    88108            return (String) parameters.get(evaluationResultParameterIndex); 
    89109        } 
    90110        return defaultEvaluationResultParameterName; 
    91111    } 
    92      
     112 
    93113    /** 
    94114     * <p> 
    95      * TODO: comment 
     115     * Retrieves task model from {@link GlobalDataContainer}. 
    96116     * </p> 
    97      * 
     117     *  
    98118     * @param nameOfTaskModel 
    99      * @return 
     119     *            name of task model, under which it is stored in {@link GlobalDataContainer} 
     120     * @return if present, task model 
    100121     */ 
    101122    private Optional<ITaskModel> getTaskModelFromDataContainer(String nameOfTaskModel) { 
    102123        Object dataObject = GlobalDataContainer.getInstance().getData(nameOfTaskModel); 
    103         if(dataObject != null) { 
    104             if(dataObject instanceof ITaskModel) { 
     124        if (dataObject != null) { 
     125            if (dataObject instanceof ITaskModel) { 
    105126                ITaskModel taskModel = (ITaskModel) dataObject; 
    106127                return Optional.of(taskModel); 
    107             } else { 
     128            } 
     129            else { 
    108130                CommandHelpers.objectNotType(nameOfTaskModel, "ITaskModel"); 
    109131                return Optional.absent(); 
     
    113135        return Optional.absent(); 
    114136    } 
    115      
     137 
    116138    /** 
    117139     * <p> 
    118      * TODO: comment 
     140     * Stores usability evaluation in {@link GlobalDataContainer}. 
    119141     * </p> 
    120      * 
    121      * @return 
     142     *  
     143     * @param evaluationResultParameterName 
     144     *            name under which usability result should be stored in {@link GlobalDataContainer} 
     145     *  
    122146     */ 
    123     private UsabilityRuleset getUsabilityRuleset() { 
    124         // TODO Auto-generated method stub 
    125         System.out.println("TODO: implement CMDperformUsabilityEvaluation.getUsabilityRuleset "); 
    126         return this.defaultUsabilityRuleset; 
    127     } 
    128      
    129     /** 
    130      * <p> 
    131      * TODO: comment 
    132      * </p> 
    133      * @param evaluationResultParameterName  
    134      * 
    135      */ 
    136     private void storeUsabilityResultInDataContainer(String evaluationResultParameterName, UsabilityResult result) { 
     147    private void storeUsabilityResultInDataContainer(String evaluationResultParameterName, 
     148                                                     UsabilityResult result) 
     149    { 
    137150        if (GlobalDataContainer.getInstance().addData(evaluationResultParameterName, result)) { 
    138151            CommandHelpers.dataOverwritten(evaluationResultParameterName); 
    139         }    
     152        } 
    140153    } 
    141154 
    142     /* (non-Javadoc) 
     155    /* 
     156     * (non-Javadoc) 
     157     *  
    143158     * @see de.ugoe.cs.util.console.Command#help() 
    144159     */ 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/EvaluationMethodCaller.java

    r1150 r1217  
    1717import com.google.common.base.Optional; 
    1818 
    19 import de.ugoe.cs.autoquest.usability.result.UsabilityDefect; 
     19import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 
    2020import de.ugoe.cs.autoquest.usability.rules.UsabilityMetric; 
    21 import de.ugoe.cs.autoquest.usability.rules.UsabilityUsageDefect; 
     21import de.ugoe.cs.autoquest.usability.rules.UsabilityUsageProblem; 
    2222 
    2323/** 
    2424 * <p> 
    25  * TODO comment 
     25 * Helper class, which calls the evaluation method depending on the type of the usability rule. 
    2626 * </p> 
    2727 *  
     
    2929 */ 
    3030public class EvaluationMethodCaller { 
    31      
    32     public Optional<UsabilityDefect> check(UsabilityMetric metric) { 
     31 
     32    /** 
     33     *  
     34     * <p> 
     35     * Calls evaluation method of a usability metric. 
     36     * </p> 
     37     *  
     38     * @param metric 
     39     *            on which evaluation method should be called 
     40     * @return description of metric/defect, iff metric exceeds predefined threshold 
     41     */ 
     42    public Optional<UsabilityProblemDescription> check(UsabilityMetric metric) { 
    3343        return metric.calculate(); 
    3444    } 
    35      
    36     public Optional<UsabilityDefect> check(UsabilityUsageDefect pattern) { 
    37         return pattern.check(); 
     45 
     46    /** 
     47     *  
     48     * <p> 
     49     * Calls evaluation method of a usability usage defect. 
     50     * </p> 
     51     *  
     52     * @param usageDefect 
     53     *            on which evaluation method should be called 
     54     * @return description of usage defect, iff it was detected during the usability evaluation 
     55     */ 
     56    public Optional<UsabilityProblemDescription> check(UsabilityUsageProblem usageDefect) { 
     57        return usageDefect.check(); 
    3858    } 
    3959} 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/UsabilityEvaluator.java

    r1152 r1217  
    2020 
    2121import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 
    22 import de.ugoe.cs.autoquest.usability.result.UsabilityDefect; 
     22import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 
    2323import de.ugoe.cs.autoquest.usability.rules.UsabilityResult; 
    2424import de.ugoe.cs.autoquest.usability.rules.UsabilityRule; 
     
    2828/** 
    2929 * <p> 
    30  * TODO comment 
     30 * The usability evaluator is responsible for performing a usability evaluation on a task model. 
     31 * Therefore he uses a {@link UsabilityRuleset}. 
    3132 * </p> 
    3233 *  
     
    3435 */ 
    3536public class UsabilityEvaluator { 
    36      
     37 
     38    /** 
     39     * <p> 
     40     * The task model, which should be evaluated. 
     41     * </p> 
     42     */ 
    3743    private ITaskModel taskModel; 
    3844 
    39     private UsabilityEvaluator(ITaskModel taskTree) { 
    40         this.taskModel = taskTree; 
    41     } 
    42      
    43     /** 
    44      * <p> 
    45      * TODO: comment 
    46      * </p> 
    47      * 
    48      * @param taskTree 
    49      * @return 
    50      */ 
    51     public static UsabilityEvaluator evaluate(ITaskModel taskTree) { 
    52         return new UsabilityEvaluator(taskTree); 
     45    private UsabilityEvaluator(ITaskModel taskModel) { 
     46        this.taskModel = taskModel; 
    5347    } 
    5448 
    5549    /** 
    5650     * <p> 
    57      * TODO: comment 
     51     * Creates and initializes a new instance. 
    5852     * </p> 
    59      * 
    60      * @param object 
    61      * @return 
     53     *  
     54     * @param taskModel 
     55     *            task model, which is subject of usability evaluation 
     56     * @return instance of {@link UsabilityEvaluator} 
     57     */ 
     58    public static UsabilityEvaluator evaluate(ITaskModel taskModel) { 
     59        return new UsabilityEvaluator(taskModel); 
     60    } 
     61 
     62    /** 
     63     * <p> 
     64     * Starts usability evaluation, using given {@link UsabilityRuleset}. 
     65     * </p> 
     66     *  
     67     * @param ruleset 
     68     *            {@link UsabilityRuleset} used for usability evaluation 
     69     * @return result of usability evaluation as {@link UsabilityResult} 
    6270     */ 
    6371    public UsabilityResult using(UsabilityRuleset ruleset) { 
     
    6573        EvaluationMethodCaller evaluationMethodCaller = new EvaluationMethodCaller(); 
    6674        UsabilityResult result = new UsabilityResult(); 
    67         for(UsabilityRule rule : ruleset.evaluationRules()) { 
    68             Optional<UsabilityDefect> defect = rule.callEvaluationMethod(evaluationMethodCaller); 
    69             if(defect.isPresent()) { 
    70                 result.addDefect(defect.get()); 
     75        for (UsabilityRule rule : ruleset.evaluationRules()) { 
     76            Optional<UsabilityProblemDescription> defect = 
     77                rule.callEvaluationMethod(evaluationMethodCaller); 
     78            if (defect.isPresent()) { 
     79                result.addProblem(defect.get()); 
    7180            } 
    7281        } 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/result/UsabilityProblemDescription.java

    r1216 r1217  
    2525import com.google.common.collect.Maps; 
    2626 
    27  
    2827/** 
    2928 * <p> 
    30  * TODO comment 
     29 * Description for a usability problem. 
    3130 * </p> 
    3231 *  
    3332 * @author Alexander Deicke 
    3433 */ 
    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      
     34public class UsabilityProblemDescription { 
    4335    /** 
    4436     * <p> 
    45      * TODO: comment 
     37     * The severity of the defect. 
    4638     * </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     *  
    4864     * @param description 
     65     *            description of the defect 
    4966     * @param severity 
     67     *            all possible severity level and their threshold 
    5068     */ 
    51     public UsabilityDefect(String description, 
    52                            EnumMap<UsabilityDefectSeverityLevel, Double> severity) 
     69    public UsabilityProblemDescription(String description, 
     70                                      EnumMap<UsabilityProblemSeverityLevel, Double> severity) 
    5371    { 
    5472        this.description = description; 
     
    5876    /** 
    5977     * <p> 
    60      * TODO: comment 
     78     * Gets the severity level of this defect. 
    6179     * </p> 
    62      * 
    63      * @return 
     80     *  
     81     * @return severity level of this defect 
    6482     */ 
    65     public UsabilityDefectSeverityLevel getSeverityLevel() { 
     83    public UsabilityProblemSeverityLevel getSeverityLevel() { 
    6684        return this.severityLevel; 
    6785    } 
     
    6987    /** 
    7088     * <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. 
    7291     * </p> 
    73      * 
     92     *  
    7493     * @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 
    7696     */ 
    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()) { 
    81102            return defect; 
    82103        } 
     
    87108    /** 
    88109     * <p> 
    89      * TODO: comment 
     110     * Initializes the properties of a {@linkplain UsabilityProblemDescription}. 
    90111     * </p> 
    91      * 
     112     *  
    92113     * @param matchingSeverityLevels 
     114     *            all severity level, where {@linkplain evaluationMetric} exceeds the threshold 
    93115     * @param evaluationMetric 
     116     *            measure for the defect 
    94117     */ 
    95     private void setDefectAttributes(Map<UsabilityDefectSeverityLevel, Double> matchingSeverityLevels, 
     118    private void setDefectAttributes(Map<UsabilityProblemSeverityLevel, Double> matchingSeverityLevels, 
    96119                                     float evaluationMetric) 
    97120    { 
    98         BiMap<Double, UsabilityDefectSeverityLevel> inverse = HashBiMap.create(matchingSeverityLevels).inverse(); 
     121        BiMap<Double, UsabilityProblemSeverityLevel> inverse = 
     122            HashBiMap.create(matchingSeverityLevels).inverse(); 
    99123        this.severityLevel = inverse.get(Collections.max(inverse.keySet())); 
    100124        this.description = String.format(this.description, evaluationMetric); 
     
    103127    /** 
    104128     * <p> 
    105      * TODO: comment 
     129     * Gets severity level depending on a measurement for the defect. 
    106130     * </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 
    110137     */ 
    111     private Predicate< Double> severityForMetric(final float evaluationMetric) { 
     138    private Predicate<Double> severityForMetric(final float evaluationMetric) { 
    112139        return new Predicate<Double>() { 
    113              
     140 
    114141            public boolean apply(Double severityThreshold) { 
    115                 return evaluationMetric == severityThreshold || evaluationMetric > severityThreshold; 
     142                return evaluationMetric == severityThreshold || 
     143                    evaluationMetric > severityThreshold; 
    116144            } 
    117              
     145 
    118146        }; 
    119147    } 
  • 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() { 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/result/UsabilityProblemSeverityLevel.java

    r1216 r1217  
    1717/** 
    1818 * <p> 
    19  * TODO comment 
     19 * All possible severity level for usability defects. 
    2020 * </p> 
    2121 *  
    2222 * @author Alexander Deicke 
    2323 */ 
    24 public enum UsabilityDefectSeverityLevel { 
    25      
     24public enum UsabilityProblemSeverityLevel { 
     25 
    2626    NONE, INFO, LOW, MEDIUM, HIGH; 
    2727 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/UsabilityMetric.java

    r1150 r1217  
    1717import com.google.common.base.Optional; 
    1818 
    19 import de.ugoe.cs.autoquest.usability.result.UsabilityDefect; 
     19import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 
    2020 
    2121/** 
    2222 * <p> 
    23  * TODO comment 
     23 * Interface for usability metrics. A metric is a way of measuring or evaluating a particular 
     24 * phenomenon or thing, in this case usability. 
    2425 * </p> 
    2526 *  
     
    2728 */ 
    2829public interface UsabilityMetric { 
    29      
    30     public Optional<UsabilityDefect> calculate(); 
     30 
     31    /** 
     32     *  
     33     * <p> 
     34     * Calculates the metric. 
     35     * </p> 
     36     *  
     37     * @return Detailed description of the usability problem, if calculated metric exceeds defined 
     38     *         threshold. 
     39     */ 
     40    public Optional<UsabilityProblemDescription> calculate(); 
    3141 
    3242} 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/UsabilityMetricsRuleset.java

    r1152 r1217  
    2626/** 
    2727 * <p> 
    28  * TODO comment 
     28 * A ruleset containing usability metrics, which might be indicators for potential usability 
     29 * problems. 
    2930 * </p> 
    3031 *  
     
    3435 
    3536    private List<UsabilityRule> metrics; 
    36      
     37 
    3738    /** 
    3839     * <p> 
    39      * TODO: comment 
     40     * Constructor. Creates new {@code UsabilityMetricsRuleset} for a given task model. 
    4041     * </p> 
    41      * 
     42     *  
    4243     */ 
    4344    private UsabilityMetricsRuleset(ITaskModel taskModel) { 
     
    4849    } 
    4950 
    50     /* (non-Javadoc) 
     51    /* 
     52     * (non-Javadoc) 
     53     *  
    5154     * @see de.ugoe.cs.autoquest.usability.UsabilityRuleset#evaluationRules() 
    5255     */ 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/UsabilityResult.java

    r1138 r1217  
    1818import com.google.common.collect.Multimap; 
    1919 
    20 import de.ugoe.cs.autoquest.usability.result.UsabilityDefect; 
    21 import de.ugoe.cs.autoquest.usability.result.UsabilityDefectSeverityLevel; 
    22  
     20import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 
     21import de.ugoe.cs.autoquest.usability.result.UsabilityProblemSeverityLevel; 
    2322 
    2423/** 
    2524 * <p> 
    26  * TODO comment 
     25 * The result of the usability evaluation, which contains all detected problems. 
    2726 * </p> 
    2827 *  
     
    3029 */ 
    3130public class UsabilityResult { 
    32      
    33     private Multimap<UsabilityDefectSeverityLevel, UsabilityDefect> detectedDefects; 
    34      
     31 
     32    /** 
     33     * <p> 
     34     * All detected problems and their appropriate severity level. 
     35     * </p> 
     36     */ 
     37    private Multimap<UsabilityProblemSeverityLevel, UsabilityProblemDescription> detectedProblems; 
     38 
     39    /** 
     40     *  
     41     * <p> 
     42     * Constructor. Creates a new result. 
     43     * </p> 
     44     *  
     45     */ 
    3546    public UsabilityResult() { 
    36         this.detectedDefects = ArrayListMultimap.create(); 
     47        this.detectedProblems = ArrayListMultimap.create(); 
    3748    } 
    3849 
    3950    /** 
    4051     * <p> 
    41      * TODO: comment 
     52     * Adds a usability problem to the result. 
    4253     * </p> 
    43      * 
    44      * @param usabilityDefect 
     54     *  
     55     * @param usabilityProblem 
     56     *            the problem, which should be added. 
    4557     */ 
    46     public void addDefect(UsabilityDefect usabilityDefect) { 
    47         this.detectedDefects.put(usabilityDefect.getSeverityLevel(), usabilityDefect); 
     58    public void addProblem(UsabilityProblemDescription usabilityProblem) { 
     59        this.detectedProblems.put(usabilityProblem.getSeverityLevel(), usabilityProblem); 
    4860    } 
    49      
    50     public boolean hasDefects() { 
    51         return !this.detectedDefects.isEmpty(); 
     61 
     62    /** 
     63     *  
     64     * <p> 
     65     * Checks, if problems were found during the usability evaluation. 
     66     * </p> 
     67     *  
     68     * @return true, iff problems were found 
     69     */ 
     70    public boolean hasDetectedProblems() { 
     71        return !this.detectedProblems.isEmpty(); 
    5272    } 
    5373 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/UsabilityRule.java

    r1152 r1217  
    1919import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 
    2020import de.ugoe.cs.autoquest.usability.EvaluationMethodCaller; 
    21 import de.ugoe.cs.autoquest.usability.result.UsabilityDefect; 
     21import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 
    2222 
    2323/** 
    2424 * <p> 
    25  * TODO comment 
     25 * A {@code UsabilityRule} is a abstract class, representing a usability guideline, metric 
     26 * interaction pattern etc., which should be checked during a automatic usability evaluation. 
    2627 * </p> 
    2728 *  
     
    2930 */ 
    3031public abstract class UsabilityRule { 
    31      
    32     protected final ITaskModel taskModel; 
    33      
    34     protected String name; 
    35      
    36     protected UsabilityDefect defect; 
    37      
     32 
    3833    /** 
    3934     * <p> 
    40      * TODO: comment 
     35     * {@link ITaskModel}, which is evaluated 
    4136     * </p> 
    42      * 
     37     */ 
     38    protected final ITaskModel taskModel; 
     39 
     40    /** 
     41     * <p> 
     42     * Name of the usability rule 
     43     * </p> 
     44     */ 
     45    protected String name; 
     46 
     47    /** 
     48     * <p> 
     49     * Corresponding defect description. 
     50     * </p> 
     51     */ 
     52    protected UsabilityProblemDescription defect; 
     53 
     54    /** 
     55     * <p> 
     56     * Constructor. Creates a new {@code UsabilityRule} for a given task model 
     57     * </p> 
     58     *  
    4359     */ 
    4460    public UsabilityRule(ITaskModel taskModel) { 
    4561        this.taskModel = taskModel; 
    4662    } 
    47      
    48     public abstract Optional<UsabilityDefect> callEvaluationMethod(EvaluationMethodCaller evaluationMethodCaller); 
     63 
     64    /** 
     65     *  
     66     * <p> 
     67     * Calls the evaluation method of this {@code UsabilityRule}. 
     68     * </p> 
     69     *  
     70     * @param evaluationMethodCaller 
     71     *            helper class, which calls the evaluation method based on the type of the 
     72     *            {@code UsabilityRule} 
     73     * @return {@link UsabilityProblemDescription}, iff violation against usability rule was detected 
     74     */ 
     75    public abstract Optional<UsabilityProblemDescription> callEvaluationMethod(EvaluationMethodCaller evaluationMethodCaller); 
    4976 
    5077} 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/UsabilityRuleset.java

    r1138 r1217  
    1919/** 
    2020 * <p> 
    21  * TODO comment 
     21 * A {@code UsabilityRuleset} is a container for {@link UsabilityRule}s. 
    2222 * </p> 
    2323 *  
     
    2828    /** 
    2929     * <p> 
    30      * TODO: comment 
     30     * Gets all {@link UsabilityRule}s contained in the {@code UsabilityRuleset}. 
    3131     * </p> 
    32      * 
    33      * @return 
     32     *  
     33     * @return all contained {@link UsabilityRule}s 
    3434     */ 
    3535    public List<UsabilityRule> evaluationRules(); 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/UsabilityUsageProblem.java

    r1216 r1217  
    1717import com.google.common.base.Optional; 
    1818 
    19 import de.ugoe.cs.autoquest.usability.result.UsabilityDefect; 
     19import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 
    2020 
    2121/** 
    2222 * <p> 
    23  * TODO comment 
     23 * Common interface for usability problems. Simple speaking, a usability problem is a specific 
     24 * problem that negatively affects the usage of a application. 
    2425 * </p> 
    2526 *  
    2627 * @author Alexander Deicke 
    2728 */ 
    28 public interface UsabilityUsageDefect { 
    29      
    30     public Optional<UsabilityDefect> check(); 
     29public interface UsabilityUsageProblem { 
     30 
     31    /** 
     32     *  
     33     * <p> 
     34     * Checks, if usability problem is present. 
     35     * </p> 
     36     *  
     37     * @return Detailed description of the usability problem, if it was detected. 
     38     */ 
     39    public Optional<UsabilityProblemDescription> check(); 
    3140 
    3241} 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/metrics/NoLetterOrDigitRatioMetric.java

    r1152 r1217  
    1515package de.ugoe.cs.autoquest.usability.rules.metrics; 
    1616 
    17 import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT; 
     17import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter.TEXT_INPUT; 
    1818import static de.ugoe.cs.autoquest.usability.util.TextInputUtil.aggregateEnteredTextFromTextInputs; 
    19 import static de.ugoe.cs.autoquest.usability.util.TextInputUtil.characterIsLetterOrDigitPredicate; 
     19import static de.ugoe.cs.autoquest.usability.util.TextInputUtil.characterIsNoLetterOrDigitPredicate; 
    2020 
    2121import java.util.List; 
     
    2828import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 
    2929import de.ugoe.cs.autoquest.usability.EvaluationMethodCaller; 
    30 import de.ugoe.cs.autoquest.usability.result.DefectDescriptionResolver; 
    31 import de.ugoe.cs.autoquest.usability.result.UsabilityDefect; 
     30import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescriptionResolver; 
     31import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 
    3232import de.ugoe.cs.autoquest.usability.rules.UsabilityMetric; 
    3333import de.ugoe.cs.autoquest.usability.rules.UsabilityRule; 
    34 import de.ugoe.cs.autoquest.usability.tasktree.FilterResult; 
    35 import de.ugoe.cs.autoquest.usability.tasktree.IterativeDFSFilterStrategy; 
    36 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskModelFilter; 
     34import de.ugoe.cs.autoquest.usability.taskmodel.filter.FilterResult; 
     35import de.ugoe.cs.autoquest.usability.taskmodel.filter.IterativeDFSFilterStrategy; 
     36import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskModelFilter; 
    3737 
    3838/** 
    3939 * <p> 
    40  * TODO comment 
     40 * Metric, which calculates the ratio ratio between non letter or digit characters and all entered 
     41 * characters. 
    4142 * </p> 
    4243 *  
     
    4748    /** 
    4849     * <p> 
    49      * TODO: comment 
     50     * Constructor. Creates a new {@code NoLetterOrDigitRatioMetric} for a given task model. 
    5051     * </p> 
    51      * 
    52      * @param taskTree 
     52     *  
     53     * @param taskModel 
    5354     */ 
    5455    public NoLetterOrDigitRatioMetric(ITaskModel taskModel) { 
    5556        super(taskModel); 
    5657        this.name = "NoLetterOrDigitRatio"; 
    57         this.defect = new DefectDescriptionResolver().descriptionFor(this.getClass().getSimpleName()); 
     58        this.defect = 
     59            new UsabilityProblemDescriptionResolver().descriptionFor(this.getClass() 
     60                .getSimpleName()); 
    5861    } 
    5962 
    60     /* (non-Javadoc) 
     63    /* 
     64     * (non-Javadoc) 
     65     *  
    6166     * @see de.ugoe.cs.autoquest.usability.rules.UsabilityRule#check() 
    6267     */ 
    6368    @Override 
    64     public Optional<UsabilityDefect> calculate() { 
     69    public Optional<UsabilityProblemDescription> calculate() { 
    6570        FilterResult textInputEvents = extractNodesFromTaskTree(); 
    6671        float evaluationMetric = calculateEvaluationMetric(textInputEvents.tasksMatchedFilter()); 
    6772        return this.defect.isPresent(evaluationMetric); 
    6873    } 
    69      
     74 
     75    /** 
     76     *  
     77     * <p> 
     78     * Filters all text input events from task model. 
     79     * </p> 
     80     *  
     81     * @return {@code FilterResult} 
     82     */ 
    7083    private FilterResult extractNodesFromTaskTree() { 
    7184        return new TaskModelFilter(new IterativeDFSFilterStrategy()).filterByEventType(TEXT_INPUT) 
    7285            .from(this.taskModel); 
    7386    } 
    74      
     87 
     88    /** 
     89     *  
     90     * <p> 
     91     * Calculates the metric. 
     92     * </p> 
     93     *  
     94     * @param textInputEvents 
     95     *            all text input events 
     96     * @return ratio between non letter or digit characters and all entered characters 
     97     */ 
    7598    private float calculateEvaluationMetric(List<ITask> textInputEvents) { 
    76         Multiset<String> enteredTextFragments = 
    77             aggregateEnteredTextFromTextInputs(textInputEvents); 
     99        Multiset<String> enteredTextFragments = aggregateEnteredTextFromTextInputs(textInputEvents); 
    78100        int allCharactersCount = 0; 
    79101        int noLetterOrDigitCount = 0; 
     
    82104            allCharactersCount += CharMatcher.ANY.countIn(textFragment) * occurencesOfTextFragment; 
    83105            noLetterOrDigitCount += 
    84                 CharMatcher.forPredicate(characterIsLetterOrDigitPredicate()).countIn(textFragment) * 
    85                     occurencesOfTextFragment; 
     106                CharMatcher.forPredicate(characterIsNoLetterOrDigitPredicate()) 
     107                    .countIn(textFragment) * occurencesOfTextFragment; 
    86108        } 
    87109        return allCharactersCount != 0 ? (float) noLetterOrDigitCount / (float) allCharactersCount 
     
    89111    } 
    90112 
    91     /* (non-Javadoc) 
    92      * @see de.ugoe.cs.autoquest.usability.rules.UsabilityRule#callEvaluationMetho(de.ugoe.cs.autoquest.usability.EvaluationMethodCaller) 
     113    /* 
     114     * (non-Javadoc) 
     115     *  
     116     * @see 
     117     * de.ugoe.cs.autoquest.usability.rules.UsabilityRule#callEvaluationMetho(de.ugoe.cs.autoquest 
     118     * .usability.EvaluationMethodCaller) 
    93119     */ 
    94120    @Override 
    95     public Optional<UsabilityDefect> callEvaluationMethod(EvaluationMethodCaller evaluationMethodCaller) 
     121    public Optional<UsabilityProblemDescription> callEvaluationMethod(EvaluationMethodCaller evaluationMethodCaller) 
    96122    { 
    97123        return evaluationMethodCaller.check(this); 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/metrics/TextInputEntryRepetitionsMetric.java

    r1199 r1217  
    1515package de.ugoe.cs.autoquest.usability.rules.metrics; 
    1616 
    17 import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT; 
     17import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter.TEXT_INPUT; 
    1818import static de.ugoe.cs.autoquest.usability.util.TextInputUtil.aggregateEnteredTextFromTextInputs; 
    1919 
     
    2828import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 
    2929import de.ugoe.cs.autoquest.usability.EvaluationMethodCaller; 
    30 import de.ugoe.cs.autoquest.usability.result.DefectDescriptionResolver; 
    31 import de.ugoe.cs.autoquest.usability.result.UsabilityDefect; 
     30import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescriptionResolver; 
     31import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 
    3232import de.ugoe.cs.autoquest.usability.rules.UsabilityMetric; 
    3333import de.ugoe.cs.autoquest.usability.rules.UsabilityRule; 
    34 import de.ugoe.cs.autoquest.usability.tasktree.FilterResult; 
    35 import de.ugoe.cs.autoquest.usability.tasktree.IterativeDFSFilterStrategy; 
    36 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskModelFilter; 
     34import de.ugoe.cs.autoquest.usability.taskmodel.filter.FilterResult; 
     35import de.ugoe.cs.autoquest.usability.taskmodel.filter.IterativeDFSFilterStrategy; 
     36import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskModelFilter; 
    3737 
    3838/** 
    3939 * <p> 
    40  * TODO comment 
     40 * Metric, which measures either the repetition of entered words or the maximum repetition of a 
     41 * single word. 
    4142 * </p> 
    4243 *  
     
    4748    /** 
    4849     * <p> 
    49      * TODO: comment 
     50     * Constructor. Creates a new {@link TextInputEntryRepetitionsMetric} for a given task model. 
    5051     * </p> 
    51      * 
    52      * @param taskTree 
     52     *  
     53     * @param taskModel 
    5354     */ 
    5455    public TextInputEntryRepetitionsMetric(ITaskModel taskModel) { 
    5556        super(taskModel); 
    5657        this.name = "TextInputEntryRepetitions"; 
    57         this.defect = new DefectDescriptionResolver().descriptionFor(this.getClass().getSimpleName()); 
     58        this.defect = 
     59            new UsabilityProblemDescriptionResolver().descriptionFor(this.getClass() 
     60                .getSimpleName()); 
    5861    } 
    5962 
    60     /* (non-Javadoc) 
     63    /* 
     64     * (non-Javadoc) 
     65     *  
    6166     * @see de.ugoe.cs.autoquest.usability.rules.UsabilityRule#check() 
    6267     */ 
    6368    @Override 
    64     public Optional<UsabilityDefect> calculate() { 
     69    public Optional<UsabilityProblemDescription> calculate() { 
    6570        FilterResult textInputEvents = extractNodesFromTaskTree(); 
    6671        float evaluationMetric = calculateEvaluationMetric(textInputEvents.tasksMatchedFilter()); 
    6772        return this.defect.isPresent(evaluationMetric); 
    6873    } 
    69      
     74 
     75    /** 
     76     *  
     77     * <p> 
     78     * Filters all text input events from task model. 
     79     * </p> 
     80     *  
     81     * @return {@code FilterResult} 
     82     */ 
    7083    private FilterResult extractNodesFromTaskTree() { 
    7184        return new TaskModelFilter(new IterativeDFSFilterStrategy()).filterByEventType(TEXT_INPUT) 
    7285            .from(this.taskModel); 
    7386    } 
    74      
     87 
     88    /** 
     89     *  
     90     * <p> 
     91     * Calculates the metric. 
     92     * </p> 
     93     *  
     94     * @param textInputEvents 
     95     *            all text input events 
     96     * @return either number of repeated words or the number of repetitions of the most entered word 
     97     */ 
    7598    private float calculateEvaluationMetric(List<ITask> textInputEvents) { 
    76         Multiset<String> enteredTextFragments = 
    77             aggregateEnteredTextFromTextInputs(textInputEvents); 
     99        Multiset<String> enteredTextFragments = aggregateEnteredTextFromTextInputs(textInputEvents); 
    78100        Multiset<String> orderedTextFragmentsWithMultipleOccurences = 
    79101            onlyTextFragmentsWithMultipleOccurences(enteredTextFragments); 
     
    86108            orderedTextFragmentsWithMultipleOccurences 
    87109                .count(wordWithHighestRepetitionInTextFragments); 
    88         return Math.max(numberOfRepeatedWords, maxRepetitions-1); 
     110        return Math.max(numberOfRepeatedWords, maxRepetitions - 1); 
    89111    } 
    90      
     112 
     113    /** 
     114     *  
     115     * <p> 
     116     * Return only words, which at least entered twice. 
     117     * </p> 
     118     *  
     119     * @param allTextInputs 
     120     *            all text input events 
     121     * @return all word, which used min. twice 
     122     */ 
    91123    private Multiset<String> onlyTextFragmentsWithMultipleOccurences(final Multiset<String> allTextInputs) 
    92124    { 
     
    104136    } 
    105137 
    106     /* (non-Javadoc) 
    107      * @see de.ugoe.cs.autoquest.usability.rules.UsabilityRule#callEvaluationMetho(de.ugoe.cs.autoquest.usability.EvaluationMethodCaller) 
     138    /* 
     139     * (non-Javadoc) 
     140     *  
     141     * @see 
     142     * de.ugoe.cs.autoquest.usability.rules.UsabilityRule#callEvaluationMetho(de.ugoe.cs.autoquest 
     143     * .usability.EvaluationMethodCaller) 
    108144     */ 
    109145    @Override 
    110     public Optional<UsabilityDefect> callEvaluationMethod(EvaluationMethodCaller evaluationMethodCaller) 
     146    public Optional<UsabilityProblemDescription> callEvaluationMethod(EvaluationMethodCaller evaluationMethodCaller) 
    111147    { 
    112148        return evaluationMethodCaller.check(this); 
    113149    } 
    114      
     150 
    115151} 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/metrics/TextInputRatioMetric.java

    r1152 r1217  
    1515package de.ugoe.cs.autoquest.usability.rules.metrics; 
    1616 
    17 import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT; 
     17import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter.TEXT_INPUT; 
    1818 
    1919import java.util.List; 
     
    2727import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 
    2828import de.ugoe.cs.autoquest.usability.EvaluationMethodCaller; 
    29 import de.ugoe.cs.autoquest.usability.result.DefectDescriptionResolver; 
    30 import de.ugoe.cs.autoquest.usability.result.UsabilityDefect; 
     29import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescriptionResolver; 
     30import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 
    3131import de.ugoe.cs.autoquest.usability.rules.UsabilityMetric; 
    3232import de.ugoe.cs.autoquest.usability.rules.UsabilityRule; 
    33 import de.ugoe.cs.autoquest.usability.tasktree.FilterResult; 
    34 import de.ugoe.cs.autoquest.usability.tasktree.IterativeDFSFilterStrategy; 
    35 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskModelFilter; 
     33import de.ugoe.cs.autoquest.usability.taskmodel.filter.FilterResult; 
     34import de.ugoe.cs.autoquest.usability.taskmodel.filter.IterativeDFSFilterStrategy; 
     35import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskModelFilter; 
    3636 
    3737/** 
    3838 * <p> 
    39  * TODO comment 
     39 * Metric, which measures the ratio between the text input and the non text input events. 
    4040 * </p> 
    4141 *  
     
    4646    /** 
    4747     * <p> 
    48      * TODO: comment 
     48     * Constructor. Creates a new {@code TextInputRatioMetric} for a given task model. 
    4949     * </p> 
    50      * 
     50     *  
    5151     * @param taskTree 
    5252     */ 
     
    5454        super(taskModel); 
    5555        this.name = "TextInputRatio"; 
    56         this.defect = new DefectDescriptionResolver().descriptionFor(this.getClass().getSimpleName()); 
     56        this.defect = 
     57            new UsabilityProblemDescriptionResolver().descriptionFor(this.getClass() 
     58                .getSimpleName()); 
    5759    } 
    5860 
    59     /* (non-Javadoc) 
     61    /* 
     62     * (non-Javadoc) 
     63     *  
    6064     * @see de.ugoe.cs.autoquest.usability.rules.UsabilityRule#check() 
    6165     */ 
    6266    @Override 
    63     public Optional<UsabilityDefect> calculate() { 
     67    public Optional<UsabilityProblemDescription> calculate() { 
    6468        FilterResult textInputEvents = extractNodesFromTaskTree(); 
    65         float evaluationMetric = calculateEvaluationMetric(textInputEvents.tasksMatchedFilter(), textInputEvents.tasksNotMatchedFilter()); 
     69        float evaluationMetric = 
     70            calculateEvaluationMetric(textInputEvents.tasksMatchedFilter(), 
     71                                      textInputEvents.tasksNotMatchedFilter()); 
    6672        return this.defect.isPresent(evaluationMetric); 
    6773    } 
    68      
     74 
     75    /** 
     76     *  
     77     * <p> 
     78     * Filters all text input events from task model. 
     79     * </p> 
     80     *  
     81     * @return {@code FilterResult} 
     82     */ 
    6983    private FilterResult extractNodesFromTaskTree() { 
    7084        return new TaskModelFilter(new IterativeDFSFilterStrategy()).filterByEventType(TEXT_INPUT) 
    7185            .from(this.taskModel); 
    7286    } 
    73      
    74     private float calculateEvaluationMetric(List<ITask> textInputEvents, List<ITask> nonTextInputEvents) { 
     87 
     88    /** 
     89     *  
     90     * <p> 
     91     * Calculates the metric. 
     92     * </p> 
     93     *  
     94     * @param textInputEvents 
     95     *            all text input events 
     96     * @param nonTextInputEvents 
     97     *            all non text input events 
     98     * @return ratio between text input and non text input events 
     99     */ 
     100    private float calculateEvaluationMetric(List<ITask> textInputEvents, 
     101                                            List<ITask> nonTextInputEvents) 
     102    { 
    75103        float numberOfTextInputEvents = textInputEvents.size(); 
    76104        float numberOfNonTextInputEvents = nrOfEventTasksNotMatchedFilter(nonTextInputEvents); 
     
    78106    } 
    79107 
     108    /** 
     109     *  
     110     * <p> 
     111     * Filters all {@link IEventTask}s from non text input event. 
     112     * </p> 
     113     *  
     114     * @param nonTextInputEvents 
     115     *            all non text input events 
     116     * @return number of {@link IEventTask}s 
     117     */ 
    80118    private int nrOfEventTasksNotMatchedFilter(List<ITask> nonTextInputEvents) { 
    81         return Iterables.size(Iterables.filter(nonTextInputEvents, 
    82                                                new Predicate<ITask>() { 
     119        return Iterables.size(Iterables.filter(nonTextInputEvents, new Predicate<ITask>() { 
    83120 
    84                                                    @Override 
    85                                                    public boolean apply(ITask task) { 
    86                                                        return task instanceof IEventTask; 
    87                                                    } 
    88                                                })); 
     121            @Override 
     122            public boolean apply(ITask task) { 
     123                return task instanceof IEventTask; 
     124            } 
     125        })); 
    89126    } 
    90127 
    91     /* (non-Javadoc) 
    92      * @see de.ugoe.cs.autoquest.usability.rules.UsabilityRule#callEvaluationMetho(de.ugoe.cs.autoquest.usability.EvaluationMethodCaller) 
     128    /* 
     129     * (non-Javadoc) 
     130     *  
     131     * @see 
     132     * de.ugoe.cs.autoquest.usability.rules.UsabilityRule#callEvaluationMetho(de.ugoe.cs.autoquest 
     133     * .usability.EvaluationMethodCaller) 
    93134     */ 
    94135    @Override 
    95     public Optional<UsabilityDefect> callEvaluationMethod(EvaluationMethodCaller evaluationMethodCaller) 
     136    public Optional<UsabilityProblemDescription> callEvaluationMethod(EvaluationMethodCaller evaluationMethodCaller) 
    96137    { 
    97138        return evaluationMethodCaller.check(this); 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/InteractionPattern.java

    r1204 r1217  
    1515package de.ugoe.cs.autoquest.usability.rules.patterns; 
    1616 
    17 import java.util.Arrays; 
    1817import java.util.List; 
    1918 
     
    2423import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    2524import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 
    26 import de.ugoe.cs.autoquest.usability.tasktree.IterativeDFSFilterStrategy; 
    27 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskModelFilter; 
    28 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter; 
     25import de.ugoe.cs.autoquest.usability.taskmodel.filter.IterativeDFSFilterStrategy; 
     26import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskModelFilter; 
     27import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 
    2928 
    3029/** 
    3130 * <p> 
    32  * TODO comment 
     31 * A interaction pattern is a simple approach to describe the structure of usage behaviour. 
    3332 * </p> 
    3433 *  
     
    3635 */ 
    3736public class InteractionPattern { 
    38      
     37 
     38    /** 
     39     * <p> 
     40     * {@link TaskModelFilter}, which is used to filter a task model after different {@link ITask}s 
     41     * </p> 
     42     */ 
    3943    private TaskModelFilter taskTreeFilter = new TaskModelFilter(new IterativeDFSFilterStrategy()); 
    40      
    41     private TaskTypeFilter concernedTask; 
    42  
     44 
     45    /** 
     46     * <p> 
     47     * Type of root task. Determines the order in which sub task appear. 
     48     * </p> 
     49     */ 
     50    private TaskTypeFilter rootTask; 
     51 
     52    /** 
     53     * <p> 
     54     * Helper objects, which decide whether or not a defined pattern condition holds. 
     55     * </p> 
     56     */ 
    4357    private List<InteractionPatternVisitor> patternVisitors; 
    44      
     58 
     59    /** 
     60     * <p> 
     61     * Flag, which indicates if the interaction pattern was found within a given task model. 
     62     * </p> 
     63     */ 
    4564    private boolean present = false; 
    46      
    47     /** 
    48      * <p> 
    49      * TODO: comment 
    50      * </p> 
    51      * 
    52      * @param concernedNode 
    53      * @param eventType 
    54      */ 
    55     public InteractionPattern(TaskTypeFilter concernedNode, 
    56                         InteractionPatternVisitor... patternVisitor) 
     65 
     66    /** 
     67     * <p> 
     68     * Constructor. Creates a new interaction pattern for a given root task and a collection of 
     69     * {@link InteractionPatternVisitor}s. 
     70     * </p> 
     71     *  
     72     * @param rootTask 
     73     *            Type of root task, which determines the order in which sub task appear. 
     74     * @param patternVisitors 
     75     *            {@link InteractionPatternVisitor}s, which decide whether or not a defined pattern 
     76     *            condition holds 
     77     */ 
     78    public InteractionPattern(TaskTypeFilter rootTask, 
     79                              List<InteractionPatternVisitor> patternVisitors) 
    5780    { 
    58         this.patternVisitors = Arrays.asList(patternVisitor); 
    59         this.concernedTask = concernedNode; 
    60     } 
    61  
     81        this.patternVisitors = patternVisitors; 
     82        this.rootTask = rootTask; 
     83    } 
     84 
     85    /** 
     86     *  
     87     * <p> 
     88     * Checks if a interaction pattern is contained in a given task model. 
     89     * </p> 
     90     *  
     91     * @param taskModel 
     92     *            {@link ITaskModel}, which might contain the interaction pattern 
     93     * @return true, iff interaction pattern is contained 
     94     */ 
    6295    public boolean containedIn(ITaskModel taskModel) { 
    6396        List<ITask> allConcernedTasks = filterAllConcernedTasksFrom(taskModel); 
    64         for(ITask concernedTask : allConcernedTasks) { 
    65             checkTask(concernedTask);   
    66             if(this.present) break; 
     97        for (ITask concernedTask : allConcernedTasks) { 
     98            checkTask(concernedTask); 
     99            if (this.present) 
     100                break; 
    67101        } 
    68102        return this.present; 
    69103    } 
    70104 
    71     private void checkTask(ITask concernedTask) { 
    72         applyAllVisitors(concernedTask); 
    73         if(allVisitorsArePresent()) { 
     105    /** 
     106     *  
     107     * <p> 
     108     * Checks a single {@link ITask} for the interaction pattern. 
     109     * </p> 
     110     *  
     111     * @param task 
     112     *            task, which might contain the interaction pattern 
     113     */ 
     114    private void checkTask(ITask task) { 
     115        applyAllVisitors(task); 
     116        if (allVisitorsArePresent()) { 
    74117            this.present = true; 
    75         } else { 
     118        } 
     119        else { 
    76120            resetAllVisitors(); 
    77121        } 
    78122    } 
    79      
     123 
     124    /** 
     125     *  
     126     * <p> 
     127     * Checks if a interaction pattern is contained in a given task. 
     128     * </p> 
     129     *  
     130     * @param task 
     131     *            task, which might contain the interaction pattern 
     132     * @return true, iff interaction pattern is contained 
     133     */ 
    80134    public boolean containedIn(ITask task) { 
    81135        checkTask(task); 
    82         return this.present;       
    83     } 
    84  
    85     private void applyAllVisitors(ITask concernedTask) { 
     136        return this.present; 
     137    } 
     138 
     139    /** 
     140     *  
     141     * <p> 
     142     * Method applys all {@link InteractionPatternVisitor}s, to check single interaction pattern 
     143     * conditions. 
     144     * </p> 
     145     *  
     146     * @param task 
     147     *            task, which might contain the interaction pattern 
     148     */ 
     149    private void applyAllVisitors(ITask task) { 
    86150        Optional<InteractionPatternVisitor> previousVisitor = Optional.absent(); 
    87         for(InteractionPatternVisitor visitor : patternVisitors) { 
    88                         if (appliedOnSelectionNode(previousVisitor)) { 
    89                                 for (ITask selection : previousVisitor.get().getRetainedSelectionNodes()) { 
    90                                         selection.accept(visitor); 
    91                                 } 
    92                         } else { 
    93                                 previousVisitor = Optional.of(visitor); 
    94                                 concernedTask.accept(visitor); 
    95                         } 
    96         } 
    97     } 
    98  
    99     private boolean appliedOnSelectionNode(Optional<InteractionPatternVisitor> previousVisitor) { 
    100         return previousVisitor.isPresent() && previousVisitor.get().hasExcludedSelectionNodes(); 
    101     } 
    102  
    103     /** 
    104      * <p> 
    105      * TODO: comment 
    106      * </p> 
    107      * 
    108      * @param taskTree 
    109      * @return 
     151        for (InteractionPatternVisitor visitor : patternVisitors) { 
     152            if (appliedOnSelectionNode(previousVisitor)) { 
     153                for (ITask selection : previousVisitor.get().getRetainedSelectionNodes()) { 
     154                    selection.accept(visitor); 
     155                } 
     156            } 
     157            else { 
     158                previousVisitor = Optional.of(visitor); 
     159                task.accept(visitor); 
     160            } 
     161        } 
     162    } 
     163 
     164    /** 
     165     *  
     166     * <p> 
     167     * Checks, if a {@link InteractionPatternVisitor} was applied on a {@link ISelection} task. 
     168     * </p> 
     169     *  
     170     * @param interactionPatternVisitor 
     171     *            {@link InteractionPatternVisitor} 
     172     * @return true, iff {@link InteractionPatternVisitor} was applied on {@link ISelection} task 
     173     */ 
     174    private boolean appliedOnSelectionNode(Optional<InteractionPatternVisitor> interactionPatternVisitor) 
     175    { 
     176        return interactionPatternVisitor.isPresent() && 
     177            interactionPatternVisitor.get().hasExcludedSelectionNodes(); 
     178    } 
     179 
     180    /** 
     181     * <p> 
     182     * Filters given task model after root task of interaction pattern. 
     183     * </p> 
     184     *  
     185     * @param taskModel 
     186     *            {@link ITaskModel} 
     187     * @return all tasks of task model, which matches root task of interaction pattern 
    110188     */ 
    111189    private List<ITask> filterAllConcernedTasksFrom(ITaskModel taskModel) { 
    112         return this.taskTreeFilter.filterByNodeType(this.concernedTask).from(taskModel).tasksMatchedFilter(); 
    113     } 
    114      
    115     /** 
    116      * <p> 
    117      * TODO: comment 
    118      * </p> 
    119      * 
    120      * @return 
     190        return this.taskTreeFilter.filterByNodeType(this.rootTask).from(taskModel) 
     191            .tasksMatchedFilter(); 
     192    } 
     193 
     194    /** 
     195     * <p> 
     196     * Checks, if all interaction pattern condition are evaluated to true. 
     197     * </p> 
     198     *  
     199     * @return true, iff all interaction pattern condition are true 
    121200     */ 
    122201    private boolean allVisitorsArePresent() { 
    123         Iterable<InteractionPatternVisitor> allPresent = Iterables.filter(this.patternVisitors, new Predicate<InteractionPatternVisitor>() { 
    124              
    125             public boolean apply(InteractionPatternVisitor visitor) { 
    126                 return visitor.isPresent(); 
    127             } 
    128              
    129         }); 
     202        Iterable<InteractionPatternVisitor> allPresent = 
     203            Iterables.filter(this.patternVisitors, new Predicate<InteractionPatternVisitor>() { 
     204 
     205                public boolean apply(InteractionPatternVisitor visitor) { 
     206                    return visitor.isPresent(); 
     207                } 
     208 
     209            }); 
    130210        return Iterables.size(allPresent) == this.patternVisitors.size(); 
    131211    } 
    132      
    133     /** 
    134      * <p> 
    135      * TODO: comment 
    136      * </p> 
    137      * 
     212 
     213    /** 
     214     * <p> 
     215     * Resets all interaction pattern condition. 
     216     * </p> 
     217     *  
    138218     */ 
    139219    private void resetAllVisitors() { 
    140         for(InteractionPatternVisitor visitor : this.patternVisitors) { 
     220        for (InteractionPatternVisitor visitor : this.patternVisitors) { 
    141221            visitor.reset(); 
    142222        } 
    143          
     223 
    144224    } 
    145225 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/InteractionPatternVisitor.java

    r1204 r1217  
    2525import de.ugoe.cs.autoquest.eventcore.StringEventType; 
    2626import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     27import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
     28import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; 
    2729import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
     30import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
    2831import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    2932import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskVisitor; 
    30 import de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter; 
    31 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter; 
     33import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter; 
     34import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 
    3235 
    3336/** 
     
    3942 */ 
    4043public abstract class InteractionPatternVisitor implements ITaskVisitor { 
    41      
    42         protected TaskTypeFilter taskType; 
    43          
     44 
     45    protected TaskTypeFilter taskType; 
     46 
    4447    protected EventTypeFilter eventType; 
    45      
     48 
    4649    protected InteractionPattern containedPattern; 
    47      
     50 
    4851    protected boolean present = false; 
    49      
     52 
    5053    protected List<ITask> retainedSelectionTasks = Lists.newArrayList(); 
    51      
    52     /* (non-Javadoc) 
    53      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask) 
     54 
     55    /* 
     56     * (non-Javadoc) 
     57     *  
     58     * @see 
     59     * de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc 
     60     * .IEventTask) 
    5461     */ 
    5562    public void visit(IEventTask event) { 
    56         if(!this.present && isEventVisitor()) { 
     63        if (!this.present && isEventVisitor()) { 
    5764            IEventType eventType = event.getEventType(); 
    58             if(eventType instanceof StringEventType) { 
     65            if (eventType instanceof StringEventType) { 
    5966                this.present = eventType.toString().equals(nameOfEventType()); 
    60             } else { 
     67            } 
     68            else { 
    6169                this.present = eventType.getClass().equals(this.eventType.clazz()); 
    6270            } 
    6371        } 
    6472    } 
    65      
     73 
    6674    public boolean isEventVisitor() { 
    6775        return this.eventType != null && this.containedPattern == null; 
    6876    } 
    69      
     77 
    7078    protected String nameOfEventType() { 
    7179        String ret = StringUtils.EMPTY; 
    7280        Iterable<String> splitted = Splitter.on("_").split(this.eventType.name()); 
    73         for(String str : splitted) { 
     81        for (String str : splitted) { 
    7482            str = str.toLowerCase(); 
    7583            ret += Character.toString(str.charAt(0)).toUpperCase() + str.substring(1); 
     
    7785        return ret; 
    7886    } 
    79      
    80     /* (non-Javadoc) 
    81      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.TaskVisitor#accept(de.ugoe.cs.autoquest.tasktrees.treeifc.ITask) 
     87 
     88    /* 
     89     * (non-Javadoc) 
     90     *  
     91     * @see 
     92     * de.ugoe.cs.autoquest.tasktrees.treeifc.TaskVisitor#accept(de.ugoe.cs.autoquest.tasktrees. 
     93     * treeifc.ITask) 
    8294     */ 
    8395    @Override 
    8496    public void visit(ITask task) { 
    85         task.accept(this); 
    86          
     97        if (task instanceof ISequence) { 
     98            this.visit((ISequence) task); 
     99        } 
     100        else if (task instanceof IIteration) { 
     101            this.visit((IIteration) task); 
     102        } 
     103        else if (task instanceof ISelection) { 
     104            this.visit((ISelection) task); 
     105        } 
     106        else { 
     107            this.visit((IOptional) task); 
     108        } 
    87109    } 
    88      
    89     /* (non-Javadoc) 
    90      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection) 
     110 
     111    /* 
     112     * (non-Javadoc) 
     113     *  
     114     * @see 
     115     * de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc 
     116     * .ISelection) 
    91117     */ 
    92118    public void visit(ISelection selection) { 
    93         if(isEventVisitor()) { 
     119        if (isEventVisitor()) { 
    94120            retainNodesWherePatternIsPresent(selection); 
    95121            this.present = patternIsPresent(); 
    96         } else { 
    97             this.present = containedPattern.containedIn(selection);   
     122        } 
     123        else { 
     124            this.present = containedPattern.containedIn(selection); 
    98125        } 
    99126    } 
    100127 
    101128    @SuppressWarnings("unchecked") 
    102         protected void retainNodesWherePatternIsPresent(ISelection selection) { 
    103         for(ITask task : selection.getChildren()) { 
     129    protected void retainNodesWherePatternIsPresent(ISelection selection) { 
     130        for (ITask task : selection.getChildren()) { 
    104131            this.present = false; 
    105132            task.accept(this); 
    106             if(this.present && this.taskType.filterPredicate().apply(selection)) { 
     133            if (this.present && this.taskType.filterPredicate().apply(selection)) { 
    107134                this.retainedSelectionTasks.add(selection); 
    108135            } 
    109             if(this.present) { 
    110                 break; 
     136            if (this.present) { 
     137                break; 
    111138            } 
    112139        } 
    113140    } 
    114      
     141 
    115142    private boolean patternIsPresent() { 
    116143        return !this.retainedSelectionTasks.isEmpty(); 
    117144    } 
    118      
     145 
    119146    /** 
    120147     * <p> 
    121148     * TODO: comment 
    122149     * </p> 
    123      * 
     150     *  
    124151     * @return 
    125152     */ 
     
    132159     * TODO: comment 
    133160     * </p> 
    134      * 
     161     *  
    135162     */ 
    136163    public void reset() { 
     
    143170     * TODO: comment 
    144171     * </p> 
    145      * 
     172     *  
    146173     * @return 
    147174     */ 
     
    154181     * TODO: comment 
    155182     * </p> 
    156      * 
     183     *  
    157184     * @return 
    158185     */ 
     
    160187        return this.retainedSelectionTasks; 
    161188    } 
    162      
     189 
    163190} 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/LongFormUsageProblem.java

    r1216 r1217  
    1515package de.ugoe.cs.autoquest.usability.rules.patterns; 
    1616 
    17 import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.MOUSE_CLICK; 
    18 import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.SCROLL; 
    19 import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT; 
    20 import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.ITERATION; 
    21 import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE; 
     17import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter.MOUSE_CLICK; 
     18import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter.SCROLL; 
     19import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter.TEXT_INPUT; 
     20import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter.ITERATION; 
     21import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter.SEQUENCE; 
    2222 
    2323import com.google.common.base.Optional; 
     
    2525import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 
    2626import de.ugoe.cs.autoquest.usability.EvaluationMethodCaller; 
    27 import de.ugoe.cs.autoquest.usability.result.DefectDescriptionResolver; 
    28 import de.ugoe.cs.autoquest.usability.result.UsabilityDefect; 
     27import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescriptionResolver; 
     28import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 
    2929import de.ugoe.cs.autoquest.usability.rules.UsabilityRule; 
    30 import de.ugoe.cs.autoquest.usability.rules.UsabilityUsageDefect; 
     30import de.ugoe.cs.autoquest.usability.rules.UsabilityUsageProblem; 
    3131 
    3232/** 
     
    3737 * @author Alexander Deicke 
    3838 */ 
    39 public class LongFormUsageDefect extends UsabilityRule implements UsabilityUsageDefect { 
     39public class LongFormUsageProblem extends UsabilityRule implements UsabilityUsageProblem { 
    4040 
    4141    private InteractionPattern longFormUsagePattern; 
    42      
     42 
    4343    /** 
    4444     * <p> 
    4545     * TODO: comment 
    4646     * </p> 
    47      * 
     47     *  
    4848     * @param taskTree 
    4949     */ 
    50     public LongFormUsageDefect(ITaskModel taskModel) { 
     50    public LongFormUsageProblem(ITaskModel taskModel) { 
    5151        super(taskModel); 
    5252        this.name = "LongFormUsagePattern"; 
    53         this.defect = new DefectDescriptionResolver().descriptionFor(this.getClass().getSimpleName()); 
     53        this.defect = 
     54            new UsabilityProblemDescriptionResolver().descriptionFor(this.getClass() 
     55                .getSimpleName()); 
    5456        initUsagePattern(); 
    5557    } 
     
    5961     * TODO: comment 
    6062     * </p> 
    61      * 
     63     *  
    6264     */ 
    6365    private void initUsagePattern() { 
    64         InteractionPatternBuilder builder = new InteractionPatternBuilder(); 
    65         InteractionPattern fillFormPattern = builder.concernedNode(ITERATION).startsWith(TEXT_INPUT).endsWith(SCROLL).build(); 
    66         this.longFormUsagePattern = builder.concernedNode(SEQUENCE).startsWith(MOUSE_CLICK).contains(fillFormPattern).endsWith(MOUSE_CLICK).build(); 
     66        InteractionPattern fillFormPattern = 
     67            InteractionPatternBuilder.newPattern().rootTask(ITERATION).startsWithEvent(TEXT_INPUT) 
     68                .endsWithEvent(SCROLL).patternFinished().build(); 
     69        this.longFormUsagePattern = 
     70            InteractionPatternBuilder.newPattern().rootTask(SEQUENCE).startsWithEvent(MOUSE_CLICK) 
     71                .containsPattern(fillFormPattern).endsWithEvent(MOUSE_CLICK).patternFinished() 
     72                .build(); 
    6773    } 
    6874 
    69     /* (non-Javadoc) 
     75    /* 
     76     * (non-Javadoc) 
     77     *  
    7078     * @see de.ugoe.cs.autoquest.usability.rules.UsabilityRule#check() 
    7179     */ 
    7280    @Override 
    73     public Optional<UsabilityDefect> check() { 
    74         Optional<UsabilityDefect> present = Optional.absent(); 
    75         if(this.longFormUsagePattern.containedIn(taskModel)) { 
     81    public Optional<UsabilityProblemDescription> check() { 
     82        Optional<UsabilityProblemDescription> present = Optional.absent(); 
     83        if (this.longFormUsagePattern.containedIn(taskModel)) { 
    7684            present = Optional.of(this.defect); 
    7785        } 
     
    7987    } 
    8088 
    81     /* (non-Javadoc) 
    82      * @see de.ugoe.cs.autoquest.usability.rules.UsabilityRule#callEvaluationMetho(de.ugoe.cs.autoquest.usability.EvaluationMethodCaller) 
     89    /* 
     90     * (non-Javadoc) 
     91     *  
     92     * @see 
     93     * de.ugoe.cs.autoquest.usability.rules.UsabilityRule#callEvaluationMetho(de.ugoe.cs.autoquest 
     94     * .usability.EvaluationMethodCaller) 
    8395     */ 
    8496    @Override 
    85     public Optional<UsabilityDefect> callEvaluationMethod(EvaluationMethodCaller evaluationMethodCaller) 
     97    public Optional<UsabilityProblemDescription> callEvaluationMethod(EvaluationMethodCaller evaluationMethodCaller) 
    8698    { 
    8799        return evaluationMethodCaller.check(this); 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/ContainsEventVisitor.java

    r1213 r1217  
    2222import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    2323import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 
    24 import de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter; 
    25 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter; 
     24import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter; 
     25import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 
    2626 
    2727/** 
     
    3838     * TODO: comment 
    3939     * </p> 
    40      * 
     40     *  
    4141     * @param containsType 
    4242     */ 
     
    4646    } 
    4747 
    48     /* (non-Javadoc) 
    49      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration) 
     48    /* 
     49     * (non-Javadoc) 
     50     *  
     51     * @see 
     52     * de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc 
     53     * .IIteration) 
    5054     */ 
    5155    public void visit(IIteration iteration) { 
     
    5357    } 
    5458 
    55     /* (non-Javadoc) 
    56      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.TaskVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional) 
     59    /* 
     60     * (non-Javadoc) 
     61     *  
     62     * @see 
     63     * de.ugoe.cs.autoquest.tasktrees.treeifc.TaskVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc 
     64     * .IOptional) 
    5765     */ 
    5866    public void visit(IOptional optional) { 
     
    6068    } 
    6169 
    62     /* (non-Javadoc) 
    63      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence) 
     70    /* 
     71     * (non-Javadoc) 
     72     *  
     73     * @see 
     74     * de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc 
     75     * .ISequence) 
    6476     */ 
    6577    public void visit(ISequence sequence) { 
    6678        checkAllChildrenAndReturnIfPatternIsPresent(sequence.getChildren()); 
    6779    } 
    68      
     80 
    6981    private void checkAllChildrenAndReturnIfPatternIsPresent(List<ITask> children) { 
    7082        for (ITask task : children) { 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/ContainsInteractionPatternVisitor.java

    r1213 r1217  
    2222import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPattern; 
    2323import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 
    24 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter; 
     24import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 
    2525 
    2626/** 
     
    3737     * TODO: comment 
    3838     * </p> 
    39      * 
     39     *  
    4040     * @param containsPattern 
    4141     */ 
    42     public ContainsInteractionPatternVisitor(InteractionPattern containsPattern, TaskTypeFilter taskType) { 
     42    public ContainsInteractionPatternVisitor(InteractionPattern containsPattern, 
     43                                             TaskTypeFilter taskType) 
     44    { 
    4345        this.containedPattern = containsPattern; 
    4446        this.taskType = taskType; 
    4547    } 
    4648 
    47     /* (non-Javadoc) 
    48      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration) 
     49    /* 
     50     * (non-Javadoc) 
     51     *  
     52     * @see 
     53     * de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc 
     54     * .IIteration) 
    4955     */ 
    5056    public void visit(IIteration iteration) { 
     
    5258    } 
    5359 
    54     /* (non-Javadoc) 
    55      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.TaskVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional) 
     60    /* 
     61     * (non-Javadoc) 
     62     *  
     63     * @see 
     64     * de.ugoe.cs.autoquest.tasktrees.treeifc.TaskVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc 
     65     * .IOptional) 
    5666     */ 
    5767    public void visit(IOptional optional) { 
     
    5969    } 
    6070 
    61     /* (non-Javadoc) 
    62      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence) 
     71    /* 
     72     * (non-Javadoc) 
     73     *  
     74     * @see 
     75     * de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc 
     76     * .ISequence) 
    6377     */ 
    6478    public void visit(ISequence sequence) { 
    6579        checkAllChildrenAndReturnIfPatternIsPresent(sequence); 
    6680    } 
    67      
     81 
    6882    private void checkAllChildrenAndReturnIfPatternIsPresent(ISequence sequence) { 
    6983        for (ITask child : sequence.getChildren()) { 
    70             if(checkTaskAndReturnIfPatternIsPresent(child)) { 
     84            if (checkTaskAndReturnIfPatternIsPresent(child)) { 
    7185                this.present = true; 
    7286                break; 
     
    7488        } 
    7589    } 
    76      
     90 
    7791    private boolean checkTaskAndReturnIfPatternIsPresent(ITask task) { 
    78         if(isEvent(task)) return false; 
     92        if (isEvent(task)) 
     93            return false; 
    7994        return this.containedPattern.containedIn(task); 
    8095    } 
    81      
     96 
    8297    private boolean isEvent(ITask task) { 
    8398        return task instanceof IEventTask; 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/EndsWithEventVisitor.java

    r1213 r1217  
    1919import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
    2020import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 
    21 import de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter; 
    22 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter; 
     21import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter; 
     22import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 
    2323import de.ugoe.cs.autoquest.usability.util.PatternsVisitorUtil; 
    2424 
     
    3636     * TODO: comment 
    3737     * </p> 
    38      * 
     38     *  
    3939     * @param eventType 
    4040     */ 
     
    4444    } 
    4545 
    46     /* (non-Javadoc) 
    47      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration) 
     46    /* 
     47     * (non-Javadoc) 
     48     *  
     49     * @see 
     50     * de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc 
     51     * .IIteration) 
    4852     */ 
    4953    public void visit(IIteration iteration) { 
     
    5155    } 
    5256 
    53     /* (non-Javadoc) 
    54      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.TaskVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional) 
     57    /* 
     58     * (non-Javadoc) 
     59     *  
     60     * @see 
     61     * de.ugoe.cs.autoquest.tasktrees.treeifc.TaskVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc 
     62     * .IOptional) 
    5563     */ 
    5664    public void visit(IOptional optional) { 
     
    5866    } 
    5967 
    60     /* (non-Javadoc) 
    61      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence) 
     68    /* 
     69     * (non-Javadoc) 
     70     *  
     71     * @see 
     72     * de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc 
     73     * .ISequence) 
    6274     */ 
    6375    public void visit(ISequence sequence) { 
    64         PatternsVisitorUtil.lastNodeOf(sequence.getChildren()).accept(this);    
     76        PatternsVisitorUtil.lastSubTaskOf(sequence.getChildren()).accept(this); 
    6577    } 
    66      
     78 
    6779} 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/EndsWithInteractionPatternVisitor.java

    r1213 r1217  
    2222import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPattern; 
    2323import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 
    24 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter; 
     24import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 
    2525import de.ugoe.cs.autoquest.usability.util.PatternsVisitorUtil; 
    2626 
     
    3838     * TODO: comment 
    3939     * </p> 
    40      * 
     40     *  
    4141     * @param endsWithPattern 
    4242     */ 
    43     public EndsWithInteractionPatternVisitor(InteractionPattern endsWithPattern, TaskTypeFilter taskType) { 
     43    public EndsWithInteractionPatternVisitor(InteractionPattern endsWithPattern, 
     44                                             TaskTypeFilter taskType) 
     45    { 
    4446        this.containedPattern = endsWithPattern; 
    4547        this.taskType = taskType; 
    4648    } 
    4749 
    48     /* (non-Javadoc) 
    49      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration) 
     50    /* 
     51     * (non-Javadoc) 
     52     *  
     53     * @see 
     54     * de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc 
     55     * .IIteration) 
    5056     */ 
    5157    public void visit(IIteration iteration) { 
    52         this.present = containedPattern.containedIn(iteration);  
     58        this.present = containedPattern.containedIn(iteration); 
    5359    } 
    5460 
    55     /* (non-Javadoc) 
    56      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.TaskVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional) 
     61    /* 
     62     * (non-Javadoc) 
     63     *  
     64     * @see 
     65     * de.ugoe.cs.autoquest.tasktrees.treeifc.TaskVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc 
     66     * .IOptional) 
    5767     */ 
    5868    public void visit(IOptional optional) { 
    59         this.present = containedPattern.containedIn(optional);  
     69        this.present = containedPattern.containedIn(optional); 
    6070    } 
    6171 
    62     /* (non-Javadoc) 
    63      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence) 
     72    /* 
     73     * (non-Javadoc) 
     74     *  
     75     * @see 
     76     * de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc 
     77     * .ISequence) 
    6478     */ 
    6579    public void visit(ISequence sequence) { 
    66         ITask lastTask = PatternsVisitorUtil.lastNodeOf(sequence.getChildren()); 
    67         if(isEvent(lastTask)) { 
     80        ITask lastTask = PatternsVisitorUtil.lastSubTaskOf(sequence.getChildren()); 
     81        if (isEvent(lastTask)) { 
    6882            this.present = containedPattern.containedIn(sequence); 
    69         } else { 
     83        } 
     84        else { 
    7085            this.present = containedPattern.containedIn(lastTask); 
    71         }     
     86        } 
    7287    } 
    7388 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/StartsWithEventVisitor.java

    r1213 r1217  
    1919import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
    2020import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 
    21 import de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter; 
    22 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter; 
     21import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter; 
     22import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 
    2323import de.ugoe.cs.autoquest.usability.util.PatternsVisitorUtil; 
    2424 
     
    3636     * TODO: comment 
    3737     * </p> 
    38      * 
     38     *  
    3939     * @param eventType 
    4040     */ 
     
    4444    } 
    4545 
    46     /* (non-Javadoc) 
    47      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration) 
     46    /* 
     47     * (non-Javadoc) 
     48     *  
     49     * @see 
     50     * de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc 
     51     * .IIteration) 
    4852     */ 
    4953    public void visit(IIteration iteration) { 
    5054        iteration.getMarkedTask().accept(this); 
    5155    } 
    52      
    53     /* (non-Javadoc) 
    54      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.TaskVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional) 
     56 
     57    /* 
     58     * (non-Javadoc) 
     59     *  
     60     * @see 
     61     * de.ugoe.cs.autoquest.tasktrees.treeifc.TaskVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc 
     62     * .IOptional) 
    5563     */ 
    5664    public void visit(IOptional optional) { 
     
    5866    } 
    5967 
    60     /* (non-Javadoc) 
    61      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence) 
     68    /* 
     69     * (non-Javadoc) 
     70     *  
     71     * @see 
     72     * de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc 
     73     * .ISequence) 
    6274     */ 
    6375    public void visit(ISequence sequence) { 
    64         PatternsVisitorUtil.firstNodeOf(sequence.getChildren()).accept(this);    
     76        PatternsVisitorUtil.firstSubtaskOf(sequence.getChildren()).accept(this); 
    6577    } 
    66      
     78 
    6779} 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/StartsWithInteractionPatternVisitor.java

    r1213 r1217  
    2222import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPattern; 
    2323import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 
    24 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter; 
     24import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 
    2525import de.ugoe.cs.autoquest.usability.util.PatternsVisitorUtil; 
    2626 
     
    3838     * TODO: comment 
    3939     * </p> 
    40      * 
     40     *  
    4141     * @param startsWithPattern 
    4242     */ 
    43     public StartsWithInteractionPatternVisitor(InteractionPattern startsWithPattern, TaskTypeFilter taskType) { 
     43    public StartsWithInteractionPatternVisitor(InteractionPattern startsWithPattern, 
     44                                               TaskTypeFilter taskType) 
     45    { 
    4446        this.containedPattern = startsWithPattern; 
    4547        this.taskType = taskType; 
    4648    } 
    4749 
    48     /* (non-Javadoc) 
    49      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration) 
     50    /* 
     51     * (non-Javadoc) 
     52     *  
     53     * @see 
     54     * de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc 
     55     * .IIteration) 
    5056     */ 
    5157    public void visit(IIteration iteration) { 
    52         this.present = containedPattern.containedIn(iteration);   
     58        this.present = containedPattern.containedIn(iteration); 
    5359    } 
    5460 
    55     /* (non-Javadoc) 
    56      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.TaskVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional) 
     61    /* 
     62     * (non-Javadoc) 
     63     *  
     64     * @see 
     65     * de.ugoe.cs.autoquest.tasktrees.treeifc.TaskVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc 
     66     * .IOptional) 
    5767     */ 
    5868    public void visit(IOptional optional) { 
    59         this.present = containedPattern.containedIn(optional);   
     69        this.present = containedPattern.containedIn(optional); 
    6070    } 
    6171 
    62     /* (non-Javadoc) 
    63      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence) 
     72    /* 
     73     * (non-Javadoc) 
     74     *  
     75     * @see 
     76     * de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc 
     77     * .ISequence) 
    6478     */ 
    6579    public void visit(ISequence sequence) { 
    66         ITask firstTask = PatternsVisitorUtil.firstNodeOf(sequence.getChildren()); 
    67         if(isEvent(firstTask)) { 
     80        ITask firstTask = PatternsVisitorUtil.firstSubtaskOf(sequence.getChildren()); 
     81        if (isEvent(firstTask)) { 
    6882            this.present = containedPattern.containedIn(sequence); 
    69         } else { 
     83        } 
     84        else { 
    7085            this.present = containedPattern.containedIn(firstTask); 
    71         }     
     86        } 
    7287    } 
    7388 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/taskmodel/filter/FilterResult.java

    r1216 r1217  
    1313//   limitations under the License. 
    1414 
    15 package de.ugoe.cs.autoquest.usability.tasktree; 
     15package de.ugoe.cs.autoquest.usability.taskmodel.filter; 
    1616 
    1717import java.util.List; 
     
    4545    @SuppressWarnings("unchecked") 
    4646    public void addTask(ITask task) { 
    47         boolean notFilteredYet = !filteredTasks.contains(task) && !tasksNotMatchedFilter.contains(task); 
    48         if(notFilteredYet) { 
    49                 if (filterPredicate.apply(task)) { 
    50                     filteredTasks.add(task); 
    51                 } 
    52                 else { 
    53                     tasksNotMatchedFilter.add(task); 
    54                 } 
    55         } 
     47        boolean notFilteredYet = 
     48            !filteredTasks.contains(task) && !tasksNotMatchedFilter.contains(task); 
     49        if (notFilteredYet) { 
     50            if (filterPredicate.apply(task)) { 
     51                filteredTasks.add(task); 
     52            } 
     53            else { 
     54                tasksNotMatchedFilter.add(task); 
     55            } 
     56        } 
    5657    } 
    5758 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/taskmodel/filter/IterativeDFSFilterStrategy.java

    r1216 r1217  
    1313//   limitations under the License. 
    1414 
    15 package de.ugoe.cs.autoquest.usability.tasktree; 
     15package de.ugoe.cs.autoquest.usability.taskmodel.filter; 
    1616 
    1717import java.util.LinkedList; 
     
    2626import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    2727import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 
    28 import de.ugoe.cs.autoquest.usability.tasktree.filters.EventTargetFilter; 
    29 import de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter; 
    30 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter; 
     28import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTargetFilter; 
     29import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter; 
     30import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 
    3131 
    3232/** 
     
    8686    } 
    8787 
    88     private void processChildrenOfCurrentTask(Queue<ITask> unvisitedTasks, 
    89                                               ITask task) 
    90     { 
     88    private void processChildrenOfCurrentTask(Queue<ITask> unvisitedTasks, ITask task) { 
    9189        if (task instanceof IStructuringTemporalRelationship) { 
    9290            for (ITask child : ((IStructuringTemporalRelationship) task).getChildren()) { 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/taskmodel/filter/TaskModelFilterStrategy.java

    r1216 r1217  
    1313//   limitations under the License. 
    1414 
    15 package de.ugoe.cs.autoquest.usability.tasktree; 
     15package de.ugoe.cs.autoquest.usability.taskmodel.filter; 
    1616 
    1717import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 
    18 import de.ugoe.cs.autoquest.usability.tasktree.filters.EventTargetFilter; 
    19 import de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter; 
    20 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter; 
     18import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTargetFilter; 
     19import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter; 
     20import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 
    2121 
    2222/** 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/taskmodel/filter/types/EventTargetFilter.java

    r1152 r1217  
    1313//   limitations under the License. 
    1414 
    15 package de.ugoe.cs.autoquest.usability.tasktree.filters; 
     15package de.ugoe.cs.autoquest.usability.taskmodel.filter.types; 
    1616 
    1717import com.google.common.base.Function; 
     
    2727/** 
    2828 * <p> 
    29  * TODO comment 
     29 * Event target filter for {@link EventTask}s. 
    3030 * </p> 
    3131 *  
     
    4444    } 
    4545 
     46    /* 
     47     * (non-Javadoc) 
     48     *  
     49     * @see de.ugoe.cs.autoquest.usability.tasktree.filters.TaskFilter#getId() 
     50     */ 
    4651    @SuppressWarnings("unchecked") 
    4752    @Override 
     
    5055    } 
    5156 
     57    /* 
     58     * (non-Javadoc) 
     59     *  
     60     * @see de.ugoe.cs.autoquest.usability.tasktree.filters.TaskFilter#getId() 
     61     */ 
    5262    @SuppressWarnings("rawtypes") 
    5363    @Override 
     
    5969    } 
    6070 
     71    /** 
     72     *  
     73     * <p> 
     74     * Gets the event target of a {@link ITask}. 
     75     * </p> 
     76     *  
     77     * @return event target 
     78     */ 
    6179    private Function<ITask, IEventTarget> taskExtractionFunction() { 
    6280        return new Function<ITask, IEventTarget>() { 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/taskmodel/filter/types/EventTypeFilter.java

    r1152 r1217  
    1313//   limitations under the License. 
    1414 
    15 package de.ugoe.cs.autoquest.usability.tasktree.filters; 
     15package de.ugoe.cs.autoquest.usability.taskmodel.filter.types; 
    1616 
    1717import com.google.common.base.Function; 
     
    3131/** 
    3232 * <p> 
    33  * TODO comment 
     33 * Event type filter for {@link EventTask}s. 
    3434 * </p> 
    3535 *  
     
    3939 
    4040    MOUSE_BUTTON_INTERACTION(MouseButtonInteraction.class), 
    41      
     41 
    4242    MOUSE_CLICK(MouseClick.class), 
    43      
     43 
    4444    MOUSE_INTERACTION(MouseInteraction.class), 
    45      
     45 
    4646    TEXT_INPUT(TextInput.class), 
    47      
     47 
    4848    SCROLL(Scroll.class), 
    49      
     49 
    5050    USER_INTERACTION(IInteraction.class); 
    5151 
     
    5555        this.eventTypeClazz = eventTypeClazz; 
    5656    } 
    57      
     57 
     58    /* 
     59     * (non-Javadoc) 
     60     *  
     61     * @see de.ugoe.cs.autoquest.usability.tasktree.filters.TaskFilter#getId() 
     62     */ 
    5863    @SuppressWarnings("unchecked") 
    5964    @Override 
     
    6267    } 
    6368 
     69    /* 
     70     * (non-Javadoc) 
     71     *  
     72     * @see de.ugoe.cs.autoquest.usability.tasktree.filters.TaskFilter#getId() 
     73     */ 
    6474    @SuppressWarnings("rawtypes") 
    6575    @Override 
     
    7181    } 
    7282 
     83    /** 
     84     *  
     85     * <p> 
     86     * Gets the event type of a {@link ITask}. 
     87     * </p> 
     88     *  
     89     * @return event type 
     90     */ 
    7391    private Function<ITask, IEventType> taskExtractionFunction() { 
    7492        return new Function<ITask, IEventType>() { 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/taskmodel/filter/types/TaskFilter.java

    r1152 r1217  
    1313//   limitations under the License. 
    1414 
    15 package de.ugoe.cs.autoquest.usability.tasktree.filters; 
     15package de.ugoe.cs.autoquest.usability.taskmodel.filter.types; 
    1616 
    1717import com.google.common.base.Predicate; 
     
    1919/** 
    2020 * <p> 
    21  * TODO comment 
     21 * A task filter allows to filter a collection of tasks, considering a provided predicate. 
    2222 * </p> 
    2323 *  
     
    2626public interface TaskFilter<T> { 
    2727 
     28    /** 
     29     *  
     30     * <p> 
     31     * {@link Class} of type or property, which is used to filter tasks. 
     32     * </p> 
     33     *  
     34     * @return 
     35     */ 
    2836    public Class<T> clazz(); 
    2937 
     38    /** 
     39     *  
     40     * <p> 
     41     * Provides predicate to filter tasks. 
     42     * </p> 
     43     *  
     44     * @return 
     45     */ 
    3046    @SuppressWarnings("rawtypes") 
    3147    public Predicate filterPredicate(); 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/taskmodel/filter/types/TaskModelFilter.java

    r1152 r1217  
    1313//   limitations under the License. 
    1414 
    15 package de.ugoe.cs.autoquest.usability.tasktree.filters; 
     15package de.ugoe.cs.autoquest.usability.taskmodel.filter.types; 
    1616 
    1717import com.google.common.base.Preconditions; 
    1818 
    1919import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 
    20 import de.ugoe.cs.autoquest.usability.tasktree.FilterResult; 
    21 import de.ugoe.cs.autoquest.usability.tasktree.TaskModelFilterStrategy; 
     20import de.ugoe.cs.autoquest.usability.taskmodel.filter.FilterResult; 
     21import de.ugoe.cs.autoquest.usability.taskmodel.filter.TaskModelFilterStrategy; 
    2222 
    2323/** 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/taskmodel/filter/types/TaskTypeFilter.java

    r1152 r1217  
    1313//   limitations under the License. 
    1414 
    15 package de.ugoe.cs.autoquest.usability.tasktree.filters; 
     15package de.ugoe.cs.autoquest.usability.taskmodel.filter.types; 
    1616 
    1717import com.google.common.base.Predicate; 
     
    2626/** 
    2727 * <p> 
    28  * TODO comment 
     28 * Task type filter for {@link ITask}s. 
    2929 * </p> 
    3030 *  
     
    3434 
    3535    EVENT_TASK_NODE(IEventTask.class), 
    36      
     36 
    3737    ITERATION(IIteration.class), 
    38      
     38 
    3939    SEQUENCE(ISequence.class), 
    40      
    41     SELECTION(ISelection.class),; 
     40 
     41    SELECTION(ISelection.class); 
    4242 
    4343    private Class<? extends ITask> taskTypeClazz; 
     
    4747    } 
    4848 
     49    /* 
     50     * (non-Javadoc) 
     51     *  
     52     * @see de.ugoe.cs.autoquest.usability.tasktree.filters.TaskFilter#getId() 
     53     */ 
    4954    @SuppressWarnings("unchecked") 
    5055    @Override 
     
    5358    } 
    5459 
     60    /* 
     61     * (non-Javadoc) 
     62     *  
     63     * @see de.ugoe.cs.autoquest.usability.tasktree.filters.TaskFilter#getId() 
     64     */ 
    5565    @SuppressWarnings("rawtypes") 
    5666    @Override 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/util/NullTask.java

    r1163 r1217  
    2222/** 
    2323 * <p> 
    24  * TODO comment 
     24 * Implementation of Null Object pattern {@link http://en.wikipedia.org/wiki/Null_Object_pattern}. 
    2525 * </p> 
    2626 *  
     
    2929public class NullTask implements ITask { 
    3030 
    31     /**  */ 
    3231    private static final long serialVersionUID = 1236779392413787860L; 
    3332 
    34     /* (non-Javadoc) 
     33    /* 
     34     * (non-Javadoc) 
     35     *  
    3536     * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITask#getId() 
    3637     */ 
     
    3940        return -1; 
    4041    } 
    41      
    42     /* (non-Javadoc) 
     42 
     43    /* 
     44     * (non-Javadoc) 
     45     *  
    4346     * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode#getName() 
    4447     */ 
     
    4750    } 
    4851 
    49     /* (non-Javadoc) 
     52    /* 
     53     * (non-Javadoc) 
     54     *  
    5055     * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode#getDescription() 
    5156     */ 
     
    5459    } 
    5560 
    56     /* (non-Javadoc) 
    57      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode#equals(de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode) 
     61    /* 
     62     * (non-Javadoc) 
     63     *  
     64     * @see 
     65     * de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode#equals(de.ugoe.cs.autoquest.tasktrees 
     66     * .treeifc.ITaskTreeNode) 
    5867     */ 
    5968    public boolean equals(ITask task) { 
    6069        return false; 
    6170    } 
    62      
    63     /* (non-Javadoc) 
     71 
     72    /* 
     73     * (non-Javadoc) 
     74     *  
    6475     * @see java.lang.Object#clone() 
    6576     */ 
     
    6980    } 
    7081 
    71     /* (non-Javadoc) 
    72      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode#accept(de.ugoe.cs.autoquest.tasktrees.treeifc.NodeVisitor) 
     82    /* 
     83     * (non-Javadoc) 
     84     *  
     85     * @see 
     86     * de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode#accept(de.ugoe.cs.autoquest.tasktrees 
     87     * .treeifc.NodeVisitor) 
    7388     */ 
    7489    public void accept(ITaskVisitor visitor) { 
    7590        // do nothing 
    7691    } 
    77      
     92 
    7893} 
    79  
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/util/PatternsVisitorUtil.java

    r1164 r1217  
    1515package de.ugoe.cs.autoquest.usability.util; 
    1616 
    17 import java.util.List; 
     17import java.util.Collection; 
    1818 
    1919import com.google.common.collect.Iterables; 
    2020 
    2121import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    22 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 
    23 import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; 
    24 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 
     22import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 
    2523 
    2624/** 
    2725 * <p> 
    28  * TODO comment 
     26 * Util class for {@link InteractionPatternVisitor}. 
    2927 * </p> 
    3028 *  
     
    3634        // no instantiation 
    3735    } 
    38      
     36 
    3937    /** 
    4038     * <p> 
    41      * TODO: comment 
     39     * Gets the first sub task. 
    4240     * </p> 
    43      * 
    44      * @param taskTreeNode 
    45      * @return 
     41     *  
     42     * @param tasks 
     43     *            collection of tasks 
     44     * @return first sub task 
    4645     */ 
    47     public static ITaskModel createTaskModelFromUserSessions(List<IUserSession> userSessions) { 
    48         return new TaskFactory().createTaskModel(userSessions); 
    49     } 
    50      
    51     /** 
    52      * <p> 
    53      * TODO: comment 
    54      * </p> 
    55      * 
    56      * @param taskTreeNodes 
    57      * @return 
    58      */ 
    59     public static ITask firstNodeOf(List<ITask> tasks) { 
     46    public static ITask firstSubtaskOf(Collection<ITask> tasks) { 
    6047        return Iterables.getFirst(tasks, new NullTask()); 
    6148    } 
     
    6350    /** 
    6451     * <p> 
    65      * TODO: comment 
     52     * Gets the last sub task. 
    6653     * </p> 
    67      * 
    68      * @param taskTreeNodes 
    69      * @return 
     54     *  
     55     * @param tasks 
     56     *            collection of tasks 
     57     * @return last sub task 
    7058     */ 
    71     public static ITask lastNodeOf(List<ITask> tasks) { 
     59    public static ITask lastSubTaskOf(Collection<ITask> tasks) { 
    7260        return Iterables.getLast(tasks, new NullTask()); 
    7361    } 
    74      
     62 
    7563} 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/util/TextInputUtil.java

    r1152 r1217  
    3131/** 
    3232 * <p> 
    33  * TODO comment 
     33 * Util class to handle text input events/tasks. 
    3434 * </p> 
    3535 *  
     
    4242    } 
    4343 
     44    /** 
     45     *  
     46     * <p> 
     47     * Returns all entered words and signs of text input events. 
     48     * </p> 
     49     *  
     50     * @param tasksWithTextInputEvents 
     51     *            tasks with event type {@link TextInput} 
     52     * @return set of all entered word and signs with unique entries 
     53     */ 
    4454    public static Multiset<String> aggregateEnteredTextFromTextInputs(List<ITask> tasksWithTextInputEvents) 
    4555    { 
     
    5262    } 
    5363 
     64    /** 
     65     *  
     66     * <p> 
     67     * Splits entered text into words and signs. 
     68     * </p> 
     69     *  
     70     * @param enteredText 
     71     *            entered text (e.g. from text input event) 
     72     * @return collection of words and signs 
     73     */ 
    5474    public static Iterable<String> splitTextIntoWordsAndSigns(String enteredText) { 
    5575        CharMatcher onlyWords = 
    56             CharMatcher.WHITESPACE.or(CharMatcher 
    57                 .forPredicate(characterIsJavaIdentifierPartPredicate())); 
     76            CharMatcher.WHITESPACE.or(CharMatcher.forPredicate(characterIsNoJavaIdentifierPart())); 
    5877        CharMatcher onlySigns = 
    59             CharMatcher.WHITESPACE.or(CharMatcher 
    60                 .forPredicate(characterIsJavaIdentifierPartPredicate()).negate()); 
     78            CharMatcher.WHITESPACE.or(CharMatcher.forPredicate(characterIsNoJavaIdentifierPart()) 
     79                .negate()); 
    6180        Iterable<String> words = 
    6281            Splitter.on(onlyWords).omitEmptyStrings().trimResults().split(enteredText); 
     
    6685    } 
    6786 
    68     public static Predicate<Character> characterIsJavaIdentifierPartPredicate() { 
     87    /** 
     88     *  
     89     * <p> 
     90     * Determines, if a character is not part of a Java identifier. 
     91     * </p> 
     92     *  
     93     * @return true, iff no part of Java identifier 
     94     */ 
     95    public static Predicate<Character> characterIsNoJavaIdentifierPart() { 
    6996        return new Predicate<Character>() { 
    7097 
     
    77104    } 
    78105 
    79     public static Predicate<Character> characterIsLetterOrDigitPredicate() { 
     106    /** 
     107     *  
     108     * <p> 
     109     * Determines if the specified character is not a letter or digit. 
     110     * </p> 
     111     *  
     112     * @return 
     113     */ 
     114    public static Predicate<Character> characterIsNoLetterOrDigitPredicate() { 
    80115        return new Predicate<Character>() { 
    81116 
Note: See TracChangeset for help on using the changeset viewer.