Changeset 1217 for trunk/autoquest-core-usability-evaluation
- Timestamp:
- 06/06/13 17:08:25 (11 years ago)
- 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 21 21 import de.ugoe.cs.autoquest.CommandHelpers; 22 22 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 23 import de.ugoe.cs.autoquest.usability.rules. EmptyRuleset;23 import de.ugoe.cs.autoquest.usability.rules.PatternRuleset; 24 24 import de.ugoe.cs.autoquest.usability.rules.UsabilityResult; 25 25 import de.ugoe.cs.autoquest.usability.rules.UsabilityRuleset; … … 29 29 /** 30 30 * <p> 31 * TODO comment31 * Command to perform a automatic usability evaluation for a given task model. 32 32 * </p> 33 33 * … … 36 36 public class CMDperformUsabilityEvaluation implements Command { 37 37 38 /** 39 * <p> 40 * index for name of task model under which it could be retrieved from 41 * {@link GlobalDataContainer} 42 * </p> 43 */ 38 44 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 */ 40 51 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 */ 42 58 private final String defaultEvaluationResultParameterName = "usabilityEvaluationResult"; 43 44 private final UsabilityRuleset defaultUsabilityRuleset = new EmptyRuleset();45 46 /* (non-Javadoc)59 60 /* 61 * (non-Javadoc) 62 * 47 63 * @see de.ugoe.cs.util.console.Command#run(java.util.List) 48 64 */ … … 52 68 Optional<ITaskModel> taskModel = getTaskModelFromDataContainer(nameOfTaskModel); 53 69 if (taskModel.isPresent()) { 54 UsabilityRuleset ruleset = getUsabilityRuleset();70 UsabilityRuleset ruleset = new PatternRuleset(taskModel.get()); 55 71 UsabilityResult result = UsabilityEvaluator.evaluate(taskModel.get()).using(ruleset); 56 72 String evaluationResultParameterName = getEvaluationResultParameter(parameters); 57 73 storeUsabilityResultInDataContainer(evaluationResultParameterName, result); 58 74 } 59 return;60 75 } 61 76 62 77 /** 63 78 * <p> 64 * TODO: comment79 * Gets name of task model from list of parameters. 65 80 * </p> 66 * 81 * 67 82 * @param parameters 68 * @return 83 * parameters for the command 84 * @return name of task model 69 85 */ 70 86 private String getTaskModelParameter(List<Object> parameters) { 71 87 try { 72 88 return (String) parameters.get(taskModelParamaterIndex); 73 } catch (Exception e) { 89 } 90 catch (Exception e) { 74 91 throw new IllegalArgumentException("must provide a task model name"); 75 92 } … … 78 95 /** 79 96 * <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! 81 100 * </p> 82 * 101 * 83 102 * @param parameters 84 * @return 103 * parameters for the command 104 * @return name under which evaluation result should be stored 85 105 */ 86 106 private String getEvaluationResultParameter(List<Object> parameters) { 87 if (parameters.size() == 2) {107 if (parameters.size() == 2) { 88 108 return (String) parameters.get(evaluationResultParameterIndex); 89 109 } 90 110 return defaultEvaluationResultParameterName; 91 111 } 92 112 93 113 /** 94 114 * <p> 95 * TODO: comment115 * Retrieves task model from {@link GlobalDataContainer}. 96 116 * </p> 97 * 117 * 98 118 * @param nameOfTaskModel 99 * @return 119 * name of task model, under which it is stored in {@link GlobalDataContainer} 120 * @return if present, task model 100 121 */ 101 122 private Optional<ITaskModel> getTaskModelFromDataContainer(String nameOfTaskModel) { 102 123 Object dataObject = GlobalDataContainer.getInstance().getData(nameOfTaskModel); 103 if (dataObject != null) {104 if (dataObject instanceof ITaskModel) {124 if (dataObject != null) { 125 if (dataObject instanceof ITaskModel) { 105 126 ITaskModel taskModel = (ITaskModel) dataObject; 106 127 return Optional.of(taskModel); 107 } else { 128 } 129 else { 108 130 CommandHelpers.objectNotType(nameOfTaskModel, "ITaskModel"); 109 131 return Optional.absent(); … … 113 135 return Optional.absent(); 114 136 } 115 137 116 138 /** 117 139 * <p> 118 * TODO: comment140 * Stores usability evaluation in {@link GlobalDataContainer}. 119 141 * </p> 120 * 121 * @return 142 * 143 * @param evaluationResultParameterName 144 * name under which usability result should be stored in {@link GlobalDataContainer} 145 * 122 146 */ 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 { 137 150 if (GlobalDataContainer.getInstance().addData(evaluationResultParameterName, result)) { 138 151 CommandHelpers.dataOverwritten(evaluationResultParameterName); 139 } 152 } 140 153 } 141 154 142 /* (non-Javadoc) 155 /* 156 * (non-Javadoc) 157 * 143 158 * @see de.ugoe.cs.util.console.Command#help() 144 159 */ -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/EvaluationMethodCaller.java
r1150 r1217 17 17 import com.google.common.base.Optional; 18 18 19 import de.ugoe.cs.autoquest.usability.result.Usability Defect;19 import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 20 20 import de.ugoe.cs.autoquest.usability.rules.UsabilityMetric; 21 import de.ugoe.cs.autoquest.usability.rules.UsabilityUsage Defect;21 import de.ugoe.cs.autoquest.usability.rules.UsabilityUsageProblem; 22 22 23 23 /** 24 24 * <p> 25 * TODO comment25 * Helper class, which calls the evaluation method depending on the type of the usability rule. 26 26 * </p> 27 27 * … … 29 29 */ 30 30 public 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) { 33 43 return metric.calculate(); 34 44 } 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(); 38 58 } 39 59 } -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/UsabilityEvaluator.java
r1152 r1217 20 20 21 21 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 22 import de.ugoe.cs.autoquest.usability.result.Usability Defect;22 import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 23 23 import de.ugoe.cs.autoquest.usability.rules.UsabilityResult; 24 24 import de.ugoe.cs.autoquest.usability.rules.UsabilityRule; … … 28 28 /** 29 29 * <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}. 31 32 * </p> 32 33 * … … 34 35 */ 35 36 public class UsabilityEvaluator { 36 37 38 /** 39 * <p> 40 * The task model, which should be evaluated. 41 * </p> 42 */ 37 43 private ITaskModel taskModel; 38 44 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; 53 47 } 54 48 55 49 /** 56 50 * <p> 57 * TODO: comment51 * Creates and initializes a new instance. 58 52 * </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} 62 70 */ 63 71 public UsabilityResult using(UsabilityRuleset ruleset) { … … 65 73 EvaluationMethodCaller evaluationMethodCaller = new EvaluationMethodCaller(); 66 74 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()); 71 80 } 72 81 } -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/result/UsabilityProblemDescription.java
r1216 r1217 25 25 import com.google.common.collect.Maps; 26 26 27 28 27 /** 29 28 * <p> 30 * TODO comment29 * Description for a usability problem. 31 30 * </p> 32 31 * 33 32 * @author Alexander Deicke 34 33 */ 35 public class UsabilityDefect { 36 37 private UsabilityDefectSeverityLevel severityLevel = UsabilityDefectSeverityLevel.NONE; 38 39 private String description; 40 41 private final EnumMap<UsabilityDefectSeverityLevel, Double> severity; 42 34 public class UsabilityProblemDescription { 43 35 /** 44 36 * <p> 45 * T ODO: comment37 * The severity of the defect. 46 38 * </p> 47 * 39 */ 40 41 private UsabilityProblemSeverityLevel severityLevel = UsabilityProblemSeverityLevel.NONE; 42 43 /** 44 * <p> 45 * A detailed description of the defect. 46 * </p> 47 */ 48 private String description; 49 50 /** 51 * <p> 52 * Assignment of all possible severity values to a certain threshold. This is used, to determine 53 * the severity level during the usability evaluation. 54 * </p> 55 */ 56 private final EnumMap<UsabilityProblemSeverityLevel, Double> severity; 57 58 /** 59 * <p> 60 * Constructor. Creates a new UsabilityDefectDescription for given description and all possible 61 * severity level. 62 * </p> 63 * 48 64 * @param description 65 * description of the defect 49 66 * @param severity 67 * all possible severity level and their threshold 50 68 */ 51 public Usability Defect(String description,52 EnumMap<UsabilityDefectSeverityLevel, Double> severity)69 public UsabilityProblemDescription(String description, 70 EnumMap<UsabilityProblemSeverityLevel, Double> severity) 53 71 { 54 72 this.description = description; … … 58 76 /** 59 77 * <p> 60 * TODO: comment78 * Gets the severity level of this defect. 61 79 * </p> 62 * 63 * @return 80 * 81 * @return severity level of this defect 64 82 */ 65 public Usability DefectSeverityLevel getSeverityLevel() {83 public UsabilityProblemSeverityLevel getSeverityLevel() { 66 84 return this.severityLevel; 67 85 } … … 69 87 /** 70 88 * <p> 71 * TODO: comment 89 * Checks, if a defect is present. Therefore it uses a value, which is used to determine the 90 * severity level. 72 91 * </p> 73 * 92 * 74 93 * @param evaluationMetric 75 * @return 94 * value, which determines the severity level of a defect 95 * @return iff defect is present, a {@linkplain UsabilityProblemDescription} of the defect 76 96 */ 77 public Optional<UsabilityDefect> isPresent(float evaluationMetric) { 78 Optional<UsabilityDefect> defect = Optional.absent(); 79 Map<UsabilityDefectSeverityLevel, Double> matchingSeverityLevels = Maps.filterValues(this.severity, severityForMetric(evaluationMetric)); 80 if(matchingSeverityLevels.isEmpty()) { 97 public Optional<UsabilityProblemDescription> isPresent(float evaluationMetric) { 98 Optional<UsabilityProblemDescription> defect = Optional.absent(); 99 Map<UsabilityProblemSeverityLevel, Double> matchingSeverityLevels = 100 Maps.filterValues(this.severity, severityForMetric(evaluationMetric)); 101 if (matchingSeverityLevels.isEmpty()) { 81 102 return defect; 82 103 } … … 87 108 /** 88 109 * <p> 89 * TODO: comment110 * Initializes the properties of a {@linkplain UsabilityProblemDescription}. 90 111 * </p> 91 * 112 * 92 113 * @param matchingSeverityLevels 114 * all severity level, where {@linkplain evaluationMetric} exceeds the threshold 93 115 * @param evaluationMetric 116 * measure for the defect 94 117 */ 95 private void setDefectAttributes(Map<Usability DefectSeverityLevel, Double> matchingSeverityLevels,118 private void setDefectAttributes(Map<UsabilityProblemSeverityLevel, Double> matchingSeverityLevels, 96 119 float evaluationMetric) 97 120 { 98 BiMap<Double, UsabilityDefectSeverityLevel> inverse = HashBiMap.create(matchingSeverityLevels).inverse(); 121 BiMap<Double, UsabilityProblemSeverityLevel> inverse = 122 HashBiMap.create(matchingSeverityLevels).inverse(); 99 123 this.severityLevel = inverse.get(Collections.max(inverse.keySet())); 100 124 this.description = String.format(this.description, evaluationMetric); … … 103 127 /** 104 128 * <p> 105 * TODO: comment129 * Gets severity level depending on a measurement for the defect. 106 130 * </p> 107 * @param evaluationMetric 108 * 109 * @return 131 * 132 * @param evaluationMetric 133 * measure for the defect 134 * 135 * @return severity level, if measurement is equal or bigger as the threshold of the severity 136 * level 110 137 */ 111 private Predicate< 138 private Predicate<Double> severityForMetric(final float evaluationMetric) { 112 139 return new Predicate<Double>() { 113 140 114 141 public boolean apply(Double severityThreshold) { 115 return evaluationMetric == severityThreshold || evaluationMetric > severityThreshold; 142 return evaluationMetric == severityThreshold || 143 evaluationMetric > severityThreshold; 116 144 } 117 145 118 146 }; 119 147 } -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/result/UsabilityProblemDescriptionResolver.java
r1216 r1217 33 33 /** 34 34 * <p> 35 * TODO comment35 * Helper class, which creates a {@link UsabilityProblemDescription} for a usability rule. 36 36 * </p> 37 37 * 38 38 * @author Alexander Deicke 39 39 */ 40 public class DefectDescriptionResolver { 41 40 public class UsabilityProblemDescriptionResolver { 41 42 /** 43 * <p> 44 * .properties file, which contains all details concerning a usability defect. 45 * </p> 46 */ 42 47 private final String defectDescriptionFile = "defects.props"; 43 48 44 49 /** 45 50 * <p> 46 * TODO: comment51 * Creates a defect description for a {@link UsabilityRule}. 47 52 * </p> 48 53 * 49 54 * @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) { 53 59 Props allProperties = initProperties(); 54 60 Map<String, String> usabilityRuleProperties = … … 59 65 /** 60 66 * <p> 61 * TODO: comment62 * </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 65 71 */ 66 72 private Props initProperties() { … … 77 83 /** 78 84 * <p> 79 * TODO: comment80 * </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 83 89 */ 84 90 private Optional<File> getDefectDescriptionFile() { … … 94 100 } 95 101 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 */ 96 113 private void loadProperties(Optional<File> defectDescriptionFile, Props props) { 97 114 try { … … 105 122 /** 106 123 * <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 111 132 */ 112 133 private Map<String, String> allUsabilityRuleProperties(Props allProperties, 113 134 String usabilityRuleName) 114 135 { 115 136 Map<String, String> usabilityRuleProperties = Maps.newHashMap(); … … 120 141 /** 121 142 * <p> 122 * TODO: comment143 * Creates the usability defect. 123 144 * </p> 124 145 * 125 146 * @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 { 129 152 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 = 132 156 getSeverityMap(usabilityRuleProperties); 133 return new Usability Defect(description, severity);134 } 135 136 /** 137 * <p> 138 * TODO: comment139 * </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 142 166 */ 143 167 private Predicate<String> descriptionProperty() { … … 150 174 }; 151 175 } 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}. 156 181 * </p> 157 182 * 158 183 * @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) 162 188 { 163 EnumMap<Usability DefectSeverityLevel, Double> severityMap =164 Maps.newEnumMap(Usability DefectSeverityLevel.class);189 EnumMap<UsabilityProblemSeverityLevel, Double> severityMap = 190 Maps.newEnumMap(UsabilityProblemSeverityLevel.class); 165 191 Map<String, String> allSeverityProperties = 166 192 Maps.filterEntries(usabilityRuleProperties, allSeverityProperties()); 167 193 for (Entry<String, String> severityProperty : allSeverityProperties.entrySet()) { 168 Usability DefectSeverityLevel severityLevel =194 UsabilityProblemSeverityLevel severityLevel = 169 195 getSeverityLevel(severityProperty.getKey()); 170 196 Double rule = Double.valueOf(severityProperty.getValue()); … … 176 202 /** 177 203 * <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) { 185 212 int startSeverityLevel = severityProperty.lastIndexOf(".") + 1; 186 String severit LevelIdentifier =213 String severityLevelIdentifier = 187 214 severityProperty.substring(startSeverityLevel).toUpperCase(); 188 return Usability DefectSeverityLevel.valueOf(severitLevelIdentifier);189 } 190 191 /** 192 * <p> 193 * TODO: comment194 * </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 197 224 */ 198 225 private Predicate<Entry<String, String>> allSeverityProperties() { -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/result/UsabilityProblemSeverityLevel.java
r1216 r1217 17 17 /** 18 18 * <p> 19 * TODO comment19 * All possible severity level for usability defects. 20 20 * </p> 21 21 * 22 22 * @author Alexander Deicke 23 23 */ 24 public enum Usability DefectSeverityLevel {25 24 public enum UsabilityProblemSeverityLevel { 25 26 26 NONE, INFO, LOW, MEDIUM, HIGH; 27 27 -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/UsabilityMetric.java
r1150 r1217 17 17 import com.google.common.base.Optional; 18 18 19 import de.ugoe.cs.autoquest.usability.result.Usability Defect;19 import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 20 20 21 21 /** 22 22 * <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. 24 25 * </p> 25 26 * … … 27 28 */ 28 29 public 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(); 31 41 32 42 } -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/UsabilityMetricsRuleset.java
r1152 r1217 26 26 /** 27 27 * <p> 28 * TODO comment 28 * A ruleset containing usability metrics, which might be indicators for potential usability 29 * problems. 29 30 * </p> 30 31 * … … 34 35 35 36 private List<UsabilityRule> metrics; 36 37 37 38 /** 38 39 * <p> 39 * TODO: comment40 * Constructor. Creates new {@code UsabilityMetricsRuleset} for a given task model. 40 41 * </p> 41 * 42 * 42 43 */ 43 44 private UsabilityMetricsRuleset(ITaskModel taskModel) { … … 48 49 } 49 50 50 /* (non-Javadoc) 51 /* 52 * (non-Javadoc) 53 * 51 54 * @see de.ugoe.cs.autoquest.usability.UsabilityRuleset#evaluationRules() 52 55 */ -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/UsabilityResult.java
r1138 r1217 18 18 import com.google.common.collect.Multimap; 19 19 20 import de.ugoe.cs.autoquest.usability.result.UsabilityDefect; 21 import de.ugoe.cs.autoquest.usability.result.UsabilityDefectSeverityLevel; 22 20 import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 21 import de.ugoe.cs.autoquest.usability.result.UsabilityProblemSeverityLevel; 23 22 24 23 /** 25 24 * <p> 26 * T ODO comment25 * The result of the usability evaluation, which contains all detected problems. 27 26 * </p> 28 27 * … … 30 29 */ 31 30 public 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 */ 35 46 public UsabilityResult() { 36 this.detected Defects = ArrayListMultimap.create();47 this.detectedProblems = ArrayListMultimap.create(); 37 48 } 38 49 39 50 /** 40 51 * <p> 41 * TODO: comment52 * Adds a usability problem to the result. 42 53 * </p> 43 * 44 * @param usabilityDefect 54 * 55 * @param usabilityProblem 56 * the problem, which should be added. 45 57 */ 46 public void add Defect(UsabilityDefect usabilityDefect) {47 this.detected Defects.put(usabilityDefect.getSeverityLevel(), usabilityDefect);58 public void addProblem(UsabilityProblemDescription usabilityProblem) { 59 this.detectedProblems.put(usabilityProblem.getSeverityLevel(), usabilityProblem); 48 60 } 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(); 52 72 } 53 73 -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/UsabilityRule.java
r1152 r1217 19 19 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 20 20 import de.ugoe.cs.autoquest.usability.EvaluationMethodCaller; 21 import de.ugoe.cs.autoquest.usability.result.Usability Defect;21 import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 22 22 23 23 /** 24 24 * <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. 26 27 * </p> 27 28 * … … 29 30 */ 30 31 public abstract class UsabilityRule { 31 32 protected final ITaskModel taskModel; 33 34 protected String name; 35 36 protected UsabilityDefect defect; 37 32 38 33 /** 39 34 * <p> 40 * TODO: comment35 * {@link ITaskModel}, which is evaluated 41 36 * </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 * 43 59 */ 44 60 public UsabilityRule(ITaskModel taskModel) { 45 61 this.taskModel = taskModel; 46 62 } 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); 49 76 50 77 } -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/UsabilityRuleset.java
r1138 r1217 19 19 /** 20 20 * <p> 21 * TODO comment21 * A {@code UsabilityRuleset} is a container for {@link UsabilityRule}s. 22 22 * </p> 23 23 * … … 28 28 /** 29 29 * <p> 30 * TODO: comment30 * Gets all {@link UsabilityRule}s contained in the {@code UsabilityRuleset}. 31 31 * </p> 32 * 33 * @return 32 * 33 * @return all contained {@link UsabilityRule}s 34 34 */ 35 35 public List<UsabilityRule> evaluationRules(); -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/UsabilityUsageProblem.java
r1216 r1217 17 17 import com.google.common.base.Optional; 18 18 19 import de.ugoe.cs.autoquest.usability.result.Usability Defect;19 import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 20 20 21 21 /** 22 22 * <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. 24 25 * </p> 25 26 * 26 27 * @author Alexander Deicke 27 28 */ 28 public interface UsabilityUsageDefect { 29 30 public Optional<UsabilityDefect> check(); 29 public 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(); 31 40 32 41 } -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/metrics/NoLetterOrDigitRatioMetric.java
r1152 r1217 15 15 package de.ugoe.cs.autoquest.usability.rules.metrics; 16 16 17 import static de.ugoe.cs.autoquest.usability.task tree.filters.EventTypeFilter.TEXT_INPUT;17 import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter.TEXT_INPUT; 18 18 import static de.ugoe.cs.autoquest.usability.util.TextInputUtil.aggregateEnteredTextFromTextInputs; 19 import static de.ugoe.cs.autoquest.usability.util.TextInputUtil.characterIs LetterOrDigitPredicate;19 import static de.ugoe.cs.autoquest.usability.util.TextInputUtil.characterIsNoLetterOrDigitPredicate; 20 20 21 21 import java.util.List; … … 28 28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 29 29 import de.ugoe.cs.autoquest.usability.EvaluationMethodCaller; 30 import de.ugoe.cs.autoquest.usability.result. DefectDescriptionResolver;31 import de.ugoe.cs.autoquest.usability.result.Usability Defect;30 import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescriptionResolver; 31 import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 32 32 import de.ugoe.cs.autoquest.usability.rules.UsabilityMetric; 33 33 import de.ugoe.cs.autoquest.usability.rules.UsabilityRule; 34 import de.ugoe.cs.autoquest.usability.task tree.FilterResult;35 import de.ugoe.cs.autoquest.usability.task tree.IterativeDFSFilterStrategy;36 import de.ugoe.cs.autoquest.usability.task tree.filters.TaskModelFilter;34 import de.ugoe.cs.autoquest.usability.taskmodel.filter.FilterResult; 35 import de.ugoe.cs.autoquest.usability.taskmodel.filter.IterativeDFSFilterStrategy; 36 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskModelFilter; 37 37 38 38 /** 39 39 * <p> 40 * TODO comment 40 * Metric, which calculates the ratio ratio between non letter or digit characters and all entered 41 * characters. 41 42 * </p> 42 43 * … … 47 48 /** 48 49 * <p> 49 * TODO: comment50 * Constructor. Creates a new {@code NoLetterOrDigitRatioMetric} for a given task model. 50 51 * </p> 51 * 52 * @param task Tree52 * 53 * @param taskModel 53 54 */ 54 55 public NoLetterOrDigitRatioMetric(ITaskModel taskModel) { 55 56 super(taskModel); 56 57 this.name = "NoLetterOrDigitRatio"; 57 this.defect = new DefectDescriptionResolver().descriptionFor(this.getClass().getSimpleName()); 58 this.defect = 59 new UsabilityProblemDescriptionResolver().descriptionFor(this.getClass() 60 .getSimpleName()); 58 61 } 59 62 60 /* (non-Javadoc) 63 /* 64 * (non-Javadoc) 65 * 61 66 * @see de.ugoe.cs.autoquest.usability.rules.UsabilityRule#check() 62 67 */ 63 68 @Override 64 public Optional<Usability Defect> calculate() {69 public Optional<UsabilityProblemDescription> calculate() { 65 70 FilterResult textInputEvents = extractNodesFromTaskTree(); 66 71 float evaluationMetric = calculateEvaluationMetric(textInputEvents.tasksMatchedFilter()); 67 72 return this.defect.isPresent(evaluationMetric); 68 73 } 69 74 75 /** 76 * 77 * <p> 78 * Filters all text input events from task model. 79 * </p> 80 * 81 * @return {@code FilterResult} 82 */ 70 83 private FilterResult extractNodesFromTaskTree() { 71 84 return new TaskModelFilter(new IterativeDFSFilterStrategy()).filterByEventType(TEXT_INPUT) 72 85 .from(this.taskModel); 73 86 } 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 */ 75 98 private float calculateEvaluationMetric(List<ITask> textInputEvents) { 76 Multiset<String> enteredTextFragments = 77 aggregateEnteredTextFromTextInputs(textInputEvents); 99 Multiset<String> enteredTextFragments = aggregateEnteredTextFromTextInputs(textInputEvents); 78 100 int allCharactersCount = 0; 79 101 int noLetterOrDigitCount = 0; … … 82 104 allCharactersCount += CharMatcher.ANY.countIn(textFragment) * occurencesOfTextFragment; 83 105 noLetterOrDigitCount += 84 CharMatcher.forPredicate(characterIs LetterOrDigitPredicate()).countIn(textFragment) *85 occurencesOfTextFragment;106 CharMatcher.forPredicate(characterIsNoLetterOrDigitPredicate()) 107 .countIn(textFragment) * occurencesOfTextFragment; 86 108 } 87 109 return allCharactersCount != 0 ? (float) noLetterOrDigitCount / (float) allCharactersCount … … 89 111 } 90 112 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) 93 119 */ 94 120 @Override 95 public Optional<Usability Defect> callEvaluationMethod(EvaluationMethodCaller evaluationMethodCaller)121 public Optional<UsabilityProblemDescription> callEvaluationMethod(EvaluationMethodCaller evaluationMethodCaller) 96 122 { 97 123 return evaluationMethodCaller.check(this); -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/metrics/TextInputEntryRepetitionsMetric.java
r1199 r1217 15 15 package de.ugoe.cs.autoquest.usability.rules.metrics; 16 16 17 import static de.ugoe.cs.autoquest.usability.task tree.filters.EventTypeFilter.TEXT_INPUT;17 import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter.TEXT_INPUT; 18 18 import static de.ugoe.cs.autoquest.usability.util.TextInputUtil.aggregateEnteredTextFromTextInputs; 19 19 … … 28 28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 29 29 import de.ugoe.cs.autoquest.usability.EvaluationMethodCaller; 30 import de.ugoe.cs.autoquest.usability.result. DefectDescriptionResolver;31 import de.ugoe.cs.autoquest.usability.result.Usability Defect;30 import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescriptionResolver; 31 import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 32 32 import de.ugoe.cs.autoquest.usability.rules.UsabilityMetric; 33 33 import de.ugoe.cs.autoquest.usability.rules.UsabilityRule; 34 import de.ugoe.cs.autoquest.usability.task tree.FilterResult;35 import de.ugoe.cs.autoquest.usability.task tree.IterativeDFSFilterStrategy;36 import de.ugoe.cs.autoquest.usability.task tree.filters.TaskModelFilter;34 import de.ugoe.cs.autoquest.usability.taskmodel.filter.FilterResult; 35 import de.ugoe.cs.autoquest.usability.taskmodel.filter.IterativeDFSFilterStrategy; 36 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskModelFilter; 37 37 38 38 /** 39 39 * <p> 40 * TODO comment 40 * Metric, which measures either the repetition of entered words or the maximum repetition of a 41 * single word. 41 42 * </p> 42 43 * … … 47 48 /** 48 49 * <p> 49 * TODO: comment50 * Constructor. Creates a new {@link TextInputEntryRepetitionsMetric} for a given task model. 50 51 * </p> 51 * 52 * @param task Tree52 * 53 * @param taskModel 53 54 */ 54 55 public TextInputEntryRepetitionsMetric(ITaskModel taskModel) { 55 56 super(taskModel); 56 57 this.name = "TextInputEntryRepetitions"; 57 this.defect = new DefectDescriptionResolver().descriptionFor(this.getClass().getSimpleName()); 58 this.defect = 59 new UsabilityProblemDescriptionResolver().descriptionFor(this.getClass() 60 .getSimpleName()); 58 61 } 59 62 60 /* (non-Javadoc) 63 /* 64 * (non-Javadoc) 65 * 61 66 * @see de.ugoe.cs.autoquest.usability.rules.UsabilityRule#check() 62 67 */ 63 68 @Override 64 public Optional<Usability Defect> calculate() {69 public Optional<UsabilityProblemDescription> calculate() { 65 70 FilterResult textInputEvents = extractNodesFromTaskTree(); 66 71 float evaluationMetric = calculateEvaluationMetric(textInputEvents.tasksMatchedFilter()); 67 72 return this.defect.isPresent(evaluationMetric); 68 73 } 69 74 75 /** 76 * 77 * <p> 78 * Filters all text input events from task model. 79 * </p> 80 * 81 * @return {@code FilterResult} 82 */ 70 83 private FilterResult extractNodesFromTaskTree() { 71 84 return new TaskModelFilter(new IterativeDFSFilterStrategy()).filterByEventType(TEXT_INPUT) 72 85 .from(this.taskModel); 73 86 } 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 */ 75 98 private float calculateEvaluationMetric(List<ITask> textInputEvents) { 76 Multiset<String> enteredTextFragments = 77 aggregateEnteredTextFromTextInputs(textInputEvents); 99 Multiset<String> enteredTextFragments = aggregateEnteredTextFromTextInputs(textInputEvents); 78 100 Multiset<String> orderedTextFragmentsWithMultipleOccurences = 79 101 onlyTextFragmentsWithMultipleOccurences(enteredTextFragments); … … 86 108 orderedTextFragmentsWithMultipleOccurences 87 109 .count(wordWithHighestRepetitionInTextFragments); 88 return Math.max(numberOfRepeatedWords, maxRepetitions -1);110 return Math.max(numberOfRepeatedWords, maxRepetitions - 1); 89 111 } 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 */ 91 123 private Multiset<String> onlyTextFragmentsWithMultipleOccurences(final Multiset<String> allTextInputs) 92 124 { … … 104 136 } 105 137 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) 108 144 */ 109 145 @Override 110 public Optional<Usability Defect> callEvaluationMethod(EvaluationMethodCaller evaluationMethodCaller)146 public Optional<UsabilityProblemDescription> callEvaluationMethod(EvaluationMethodCaller evaluationMethodCaller) 111 147 { 112 148 return evaluationMethodCaller.check(this); 113 149 } 114 150 115 151 } -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/metrics/TextInputRatioMetric.java
r1152 r1217 15 15 package de.ugoe.cs.autoquest.usability.rules.metrics; 16 16 17 import static de.ugoe.cs.autoquest.usability.task tree.filters.EventTypeFilter.TEXT_INPUT;17 import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter.TEXT_INPUT; 18 18 19 19 import java.util.List; … … 27 27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 28 28 import de.ugoe.cs.autoquest.usability.EvaluationMethodCaller; 29 import de.ugoe.cs.autoquest.usability.result. DefectDescriptionResolver;30 import de.ugoe.cs.autoquest.usability.result.Usability Defect;29 import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescriptionResolver; 30 import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 31 31 import de.ugoe.cs.autoquest.usability.rules.UsabilityMetric; 32 32 import de.ugoe.cs.autoquest.usability.rules.UsabilityRule; 33 import de.ugoe.cs.autoquest.usability.task tree.FilterResult;34 import de.ugoe.cs.autoquest.usability.task tree.IterativeDFSFilterStrategy;35 import de.ugoe.cs.autoquest.usability.task tree.filters.TaskModelFilter;33 import de.ugoe.cs.autoquest.usability.taskmodel.filter.FilterResult; 34 import de.ugoe.cs.autoquest.usability.taskmodel.filter.IterativeDFSFilterStrategy; 35 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskModelFilter; 36 36 37 37 /** 38 38 * <p> 39 * TODO comment39 * Metric, which measures the ratio between the text input and the non text input events. 40 40 * </p> 41 41 * … … 46 46 /** 47 47 * <p> 48 * TODO: comment48 * Constructor. Creates a new {@code TextInputRatioMetric} for a given task model. 49 49 * </p> 50 * 50 * 51 51 * @param taskTree 52 52 */ … … 54 54 super(taskModel); 55 55 this.name = "TextInputRatio"; 56 this.defect = new DefectDescriptionResolver().descriptionFor(this.getClass().getSimpleName()); 56 this.defect = 57 new UsabilityProblemDescriptionResolver().descriptionFor(this.getClass() 58 .getSimpleName()); 57 59 } 58 60 59 /* (non-Javadoc) 61 /* 62 * (non-Javadoc) 63 * 60 64 * @see de.ugoe.cs.autoquest.usability.rules.UsabilityRule#check() 61 65 */ 62 66 @Override 63 public Optional<Usability Defect> calculate() {67 public Optional<UsabilityProblemDescription> calculate() { 64 68 FilterResult textInputEvents = extractNodesFromTaskTree(); 65 float evaluationMetric = calculateEvaluationMetric(textInputEvents.tasksMatchedFilter(), textInputEvents.tasksNotMatchedFilter()); 69 float evaluationMetric = 70 calculateEvaluationMetric(textInputEvents.tasksMatchedFilter(), 71 textInputEvents.tasksNotMatchedFilter()); 66 72 return this.defect.isPresent(evaluationMetric); 67 73 } 68 74 75 /** 76 * 77 * <p> 78 * Filters all text input events from task model. 79 * </p> 80 * 81 * @return {@code FilterResult} 82 */ 69 83 private FilterResult extractNodesFromTaskTree() { 70 84 return new TaskModelFilter(new IterativeDFSFilterStrategy()).filterByEventType(TEXT_INPUT) 71 85 .from(this.taskModel); 72 86 } 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 { 75 103 float numberOfTextInputEvents = textInputEvents.size(); 76 104 float numberOfNonTextInputEvents = nrOfEventTasksNotMatchedFilter(nonTextInputEvents); … … 78 106 } 79 107 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 */ 80 118 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>() { 83 120 84 85 86 87 88 121 @Override 122 public boolean apply(ITask task) { 123 return task instanceof IEventTask; 124 } 125 })); 89 126 } 90 127 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) 93 134 */ 94 135 @Override 95 public Optional<Usability Defect> callEvaluationMethod(EvaluationMethodCaller evaluationMethodCaller)136 public Optional<UsabilityProblemDescription> callEvaluationMethod(EvaluationMethodCaller evaluationMethodCaller) 96 137 { 97 138 return evaluationMethodCaller.check(this); -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/InteractionPattern.java
r1204 r1217 15 15 package de.ugoe.cs.autoquest.usability.rules.patterns; 16 16 17 import java.util.Arrays;18 17 import java.util.List; 19 18 … … 24 23 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 25 24 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 26 import de.ugoe.cs.autoquest.usability.task tree.IterativeDFSFilterStrategy;27 import de.ugoe.cs.autoquest.usability.task tree.filters.TaskModelFilter;28 import de.ugoe.cs.autoquest.usability.task tree.filters.TaskTypeFilter;25 import de.ugoe.cs.autoquest.usability.taskmodel.filter.IterativeDFSFilterStrategy; 26 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskModelFilter; 27 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 29 28 30 29 /** 31 30 * <p> 32 * TODO comment31 * A interaction pattern is a simple approach to describe the structure of usage behaviour. 33 32 * </p> 34 33 * … … 36 35 */ 37 36 public 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 */ 39 43 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 */ 43 57 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 */ 45 64 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) 57 80 { 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 */ 62 95 public boolean containedIn(ITaskModel taskModel) { 63 96 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; 67 101 } 68 102 return this.present; 69 103 } 70 104 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()) { 74 117 this.present = true; 75 } else { 118 } 119 else { 76 120 resetAllVisitors(); 77 121 } 78 122 } 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 */ 80 134 public boolean containedIn(ITask task) { 81 135 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) { 86 150 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 110 188 */ 111 189 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 121 200 */ 122 201 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 }); 130 210 return Iterables.size(allPresent) == this.patternVisitors.size(); 131 211 } 132 133 /** 134 * <p> 135 * TODO: comment136 * </p> 137 * 212 213 /** 214 * <p> 215 * Resets all interaction pattern condition. 216 * </p> 217 * 138 218 */ 139 219 private void resetAllVisitors() { 140 for (InteractionPatternVisitor visitor : this.patternVisitors) {220 for (InteractionPatternVisitor visitor : this.patternVisitors) { 141 221 visitor.reset(); 142 222 } 143 223 144 224 } 145 225 -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/InteractionPatternVisitor.java
r1204 r1217 25 25 import de.ugoe.cs.autoquest.eventcore.StringEventType; 26 26 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 27 import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 28 import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; 27 29 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 30 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 28 31 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 29 32 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskVisitor; 30 import de.ugoe.cs.autoquest.usability.task tree.filters.EventTypeFilter;31 import de.ugoe.cs.autoquest.usability.task tree.filters.TaskTypeFilter;33 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter; 34 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 32 35 33 36 /** … … 39 42 */ 40 43 public abstract class InteractionPatternVisitor implements ITaskVisitor { 41 42 43 44 45 protected TaskTypeFilter taskType; 46 44 47 protected EventTypeFilter eventType; 45 48 46 49 protected InteractionPattern containedPattern; 47 50 48 51 protected boolean present = false; 49 52 50 53 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) 54 61 */ 55 62 public void visit(IEventTask event) { 56 if (!this.present && isEventVisitor()) {63 if (!this.present && isEventVisitor()) { 57 64 IEventType eventType = event.getEventType(); 58 if (eventType instanceof StringEventType) {65 if (eventType instanceof StringEventType) { 59 66 this.present = eventType.toString().equals(nameOfEventType()); 60 } else { 67 } 68 else { 61 69 this.present = eventType.getClass().equals(this.eventType.clazz()); 62 70 } 63 71 } 64 72 } 65 73 66 74 public boolean isEventVisitor() { 67 75 return this.eventType != null && this.containedPattern == null; 68 76 } 69 77 70 78 protected String nameOfEventType() { 71 79 String ret = StringUtils.EMPTY; 72 80 Iterable<String> splitted = Splitter.on("_").split(this.eventType.name()); 73 for (String str : splitted) {81 for (String str : splitted) { 74 82 str = str.toLowerCase(); 75 83 ret += Character.toString(str.charAt(0)).toUpperCase() + str.substring(1); … … 77 85 return ret; 78 86 } 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) 82 94 */ 83 95 @Override 84 96 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 } 87 109 } 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) 91 117 */ 92 118 public void visit(ISelection selection) { 93 if (isEventVisitor()) {119 if (isEventVisitor()) { 94 120 retainNodesWherePatternIsPresent(selection); 95 121 this.present = patternIsPresent(); 96 } else { 97 this.present = containedPattern.containedIn(selection); 122 } 123 else { 124 this.present = containedPattern.containedIn(selection); 98 125 } 99 126 } 100 127 101 128 @SuppressWarnings("unchecked") 102 103 for (ITask task : selection.getChildren()) {129 protected void retainNodesWherePatternIsPresent(ISelection selection) { 130 for (ITask task : selection.getChildren()) { 104 131 this.present = false; 105 132 task.accept(this); 106 if (this.present && this.taskType.filterPredicate().apply(selection)) {133 if (this.present && this.taskType.filterPredicate().apply(selection)) { 107 134 this.retainedSelectionTasks.add(selection); 108 135 } 109 if (this.present) {110 136 if (this.present) { 137 break; 111 138 } 112 139 } 113 140 } 114 141 115 142 private boolean patternIsPresent() { 116 143 return !this.retainedSelectionTasks.isEmpty(); 117 144 } 118 145 119 146 /** 120 147 * <p> 121 148 * TODO: comment 122 149 * </p> 123 * 150 * 124 151 * @return 125 152 */ … … 132 159 * TODO: comment 133 160 * </p> 134 * 161 * 135 162 */ 136 163 public void reset() { … … 143 170 * TODO: comment 144 171 * </p> 145 * 172 * 146 173 * @return 147 174 */ … … 154 181 * TODO: comment 155 182 * </p> 156 * 183 * 157 184 * @return 158 185 */ … … 160 187 return this.retainedSelectionTasks; 161 188 } 162 189 163 190 } -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/LongFormUsageProblem.java
r1216 r1217 15 15 package de.ugoe.cs.autoquest.usability.rules.patterns; 16 16 17 import static de.ugoe.cs.autoquest.usability.task tree.filters.EventTypeFilter.MOUSE_CLICK;18 import static de.ugoe.cs.autoquest.usability.task tree.filters.EventTypeFilter.SCROLL;19 import static de.ugoe.cs.autoquest.usability.task tree.filters.EventTypeFilter.TEXT_INPUT;20 import static de.ugoe.cs.autoquest.usability.task tree.filters.TaskTypeFilter.ITERATION;21 import static de.ugoe.cs.autoquest.usability.task tree.filters.TaskTypeFilter.SEQUENCE;17 import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter.MOUSE_CLICK; 18 import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter.SCROLL; 19 import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter.TEXT_INPUT; 20 import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter.ITERATION; 21 import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter.SEQUENCE; 22 22 23 23 import com.google.common.base.Optional; … … 25 25 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 26 26 import de.ugoe.cs.autoquest.usability.EvaluationMethodCaller; 27 import de.ugoe.cs.autoquest.usability.result. DefectDescriptionResolver;28 import de.ugoe.cs.autoquest.usability.result.Usability Defect;27 import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescriptionResolver; 28 import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 29 29 import de.ugoe.cs.autoquest.usability.rules.UsabilityRule; 30 import de.ugoe.cs.autoquest.usability.rules.UsabilityUsage Defect;30 import de.ugoe.cs.autoquest.usability.rules.UsabilityUsageProblem; 31 31 32 32 /** … … 37 37 * @author Alexander Deicke 38 38 */ 39 public class LongFormUsage Defect extends UsabilityRule implements UsabilityUsageDefect{39 public class LongFormUsageProblem extends UsabilityRule implements UsabilityUsageProblem { 40 40 41 41 private InteractionPattern longFormUsagePattern; 42 42 43 43 /** 44 44 * <p> 45 45 * TODO: comment 46 46 * </p> 47 * 47 * 48 48 * @param taskTree 49 49 */ 50 public LongFormUsage Defect(ITaskModel taskModel) {50 public LongFormUsageProblem(ITaskModel taskModel) { 51 51 super(taskModel); 52 52 this.name = "LongFormUsagePattern"; 53 this.defect = new DefectDescriptionResolver().descriptionFor(this.getClass().getSimpleName()); 53 this.defect = 54 new UsabilityProblemDescriptionResolver().descriptionFor(this.getClass() 55 .getSimpleName()); 54 56 initUsagePattern(); 55 57 } … … 59 61 * TODO: comment 60 62 * </p> 61 * 63 * 62 64 */ 63 65 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(); 67 73 } 68 74 69 /* (non-Javadoc) 75 /* 76 * (non-Javadoc) 77 * 70 78 * @see de.ugoe.cs.autoquest.usability.rules.UsabilityRule#check() 71 79 */ 72 80 @Override 73 public Optional<Usability Defect> check() {74 Optional<Usability Defect> 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)) { 76 84 present = Optional.of(this.defect); 77 85 } … … 79 87 } 80 88 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) 83 95 */ 84 96 @Override 85 public Optional<Usability Defect> callEvaluationMethod(EvaluationMethodCaller evaluationMethodCaller)97 public Optional<UsabilityProblemDescription> callEvaluationMethod(EvaluationMethodCaller evaluationMethodCaller) 86 98 { 87 99 return evaluationMethodCaller.check(this); -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/ContainsEventVisitor.java
r1213 r1217 22 22 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 23 23 import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 24 import de.ugoe.cs.autoquest.usability.task tree.filters.EventTypeFilter;25 import de.ugoe.cs.autoquest.usability.task tree.filters.TaskTypeFilter;24 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter; 25 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 26 26 27 27 /** … … 38 38 * TODO: comment 39 39 * </p> 40 * 40 * 41 41 * @param containsType 42 42 */ … … 46 46 } 47 47 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) 50 54 */ 51 55 public void visit(IIteration iteration) { … … 53 57 } 54 58 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) 57 65 */ 58 66 public void visit(IOptional optional) { … … 60 68 } 61 69 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) 64 76 */ 65 77 public void visit(ISequence sequence) { 66 78 checkAllChildrenAndReturnIfPatternIsPresent(sequence.getChildren()); 67 79 } 68 80 69 81 private void checkAllChildrenAndReturnIfPatternIsPresent(List<ITask> children) { 70 82 for (ITask task : children) { -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/ContainsInteractionPatternVisitor.java
r1213 r1217 22 22 import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPattern; 23 23 import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 24 import de.ugoe.cs.autoquest.usability.task tree.filters.TaskTypeFilter;24 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 25 25 26 26 /** … … 37 37 * TODO: comment 38 38 * </p> 39 * 39 * 40 40 * @param containsPattern 41 41 */ 42 public ContainsInteractionPatternVisitor(InteractionPattern containsPattern, TaskTypeFilter taskType) { 42 public ContainsInteractionPatternVisitor(InteractionPattern containsPattern, 43 TaskTypeFilter taskType) 44 { 43 45 this.containedPattern = containsPattern; 44 46 this.taskType = taskType; 45 47 } 46 48 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) 49 55 */ 50 56 public void visit(IIteration iteration) { … … 52 58 } 53 59 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) 56 66 */ 57 67 public void visit(IOptional optional) { … … 59 69 } 60 70 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) 63 77 */ 64 78 public void visit(ISequence sequence) { 65 79 checkAllChildrenAndReturnIfPatternIsPresent(sequence); 66 80 } 67 81 68 82 private void checkAllChildrenAndReturnIfPatternIsPresent(ISequence sequence) { 69 83 for (ITask child : sequence.getChildren()) { 70 if (checkTaskAndReturnIfPatternIsPresent(child)) {84 if (checkTaskAndReturnIfPatternIsPresent(child)) { 71 85 this.present = true; 72 86 break; … … 74 88 } 75 89 } 76 90 77 91 private boolean checkTaskAndReturnIfPatternIsPresent(ITask task) { 78 if(isEvent(task)) return false; 92 if (isEvent(task)) 93 return false; 79 94 return this.containedPattern.containedIn(task); 80 95 } 81 96 82 97 private boolean isEvent(ITask task) { 83 98 return task instanceof IEventTask; -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/EndsWithEventVisitor.java
r1213 r1217 19 19 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 20 20 import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 21 import de.ugoe.cs.autoquest.usability.task tree.filters.EventTypeFilter;22 import de.ugoe.cs.autoquest.usability.task tree.filters.TaskTypeFilter;21 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter; 22 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 23 23 import de.ugoe.cs.autoquest.usability.util.PatternsVisitorUtil; 24 24 … … 36 36 * TODO: comment 37 37 * </p> 38 * 38 * 39 39 * @param eventType 40 40 */ … … 44 44 } 45 45 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) 48 52 */ 49 53 public void visit(IIteration iteration) { … … 51 55 } 52 56 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) 55 63 */ 56 64 public void visit(IOptional optional) { … … 58 66 } 59 67 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) 62 74 */ 63 75 public void visit(ISequence sequence) { 64 PatternsVisitorUtil.last NodeOf(sequence.getChildren()).accept(this);76 PatternsVisitorUtil.lastSubTaskOf(sequence.getChildren()).accept(this); 65 77 } 66 78 67 79 } -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/EndsWithInteractionPatternVisitor.java
r1213 r1217 22 22 import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPattern; 23 23 import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 24 import de.ugoe.cs.autoquest.usability.task tree.filters.TaskTypeFilter;24 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 25 25 import de.ugoe.cs.autoquest.usability.util.PatternsVisitorUtil; 26 26 … … 38 38 * TODO: comment 39 39 * </p> 40 * 40 * 41 41 * @param endsWithPattern 42 42 */ 43 public EndsWithInteractionPatternVisitor(InteractionPattern endsWithPattern, TaskTypeFilter taskType) { 43 public EndsWithInteractionPatternVisitor(InteractionPattern endsWithPattern, 44 TaskTypeFilter taskType) 45 { 44 46 this.containedPattern = endsWithPattern; 45 47 this.taskType = taskType; 46 48 } 47 49 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) 50 56 */ 51 57 public void visit(IIteration iteration) { 52 this.present = containedPattern.containedIn(iteration); 58 this.present = containedPattern.containedIn(iteration); 53 59 } 54 60 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) 57 67 */ 58 68 public void visit(IOptional optional) { 59 this.present = containedPattern.containedIn(optional); 69 this.present = containedPattern.containedIn(optional); 60 70 } 61 71 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) 64 78 */ 65 79 public void visit(ISequence sequence) { 66 ITask lastTask = PatternsVisitorUtil.last NodeOf(sequence.getChildren());67 if (isEvent(lastTask)) {80 ITask lastTask = PatternsVisitorUtil.lastSubTaskOf(sequence.getChildren()); 81 if (isEvent(lastTask)) { 68 82 this.present = containedPattern.containedIn(sequence); 69 } else { 83 } 84 else { 70 85 this.present = containedPattern.containedIn(lastTask); 71 } 86 } 72 87 } 73 88 -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/StartsWithEventVisitor.java
r1213 r1217 19 19 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 20 20 import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 21 import de.ugoe.cs.autoquest.usability.task tree.filters.EventTypeFilter;22 import de.ugoe.cs.autoquest.usability.task tree.filters.TaskTypeFilter;21 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter; 22 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 23 23 import de.ugoe.cs.autoquest.usability.util.PatternsVisitorUtil; 24 24 … … 36 36 * TODO: comment 37 37 * </p> 38 * 38 * 39 39 * @param eventType 40 40 */ … … 44 44 } 45 45 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) 48 52 */ 49 53 public void visit(IIteration iteration) { 50 54 iteration.getMarkedTask().accept(this); 51 55 } 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) 55 63 */ 56 64 public void visit(IOptional optional) { … … 58 66 } 59 67 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) 62 74 */ 63 75 public void visit(ISequence sequence) { 64 PatternsVisitorUtil.first NodeOf(sequence.getChildren()).accept(this);76 PatternsVisitorUtil.firstSubtaskOf(sequence.getChildren()).accept(this); 65 77 } 66 78 67 79 } -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/StartsWithInteractionPatternVisitor.java
r1213 r1217 22 22 import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPattern; 23 23 import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 24 import de.ugoe.cs.autoquest.usability.task tree.filters.TaskTypeFilter;24 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 25 25 import de.ugoe.cs.autoquest.usability.util.PatternsVisitorUtil; 26 26 … … 38 38 * TODO: comment 39 39 * </p> 40 * 40 * 41 41 * @param startsWithPattern 42 42 */ 43 public StartsWithInteractionPatternVisitor(InteractionPattern startsWithPattern, TaskTypeFilter taskType) { 43 public StartsWithInteractionPatternVisitor(InteractionPattern startsWithPattern, 44 TaskTypeFilter taskType) 45 { 44 46 this.containedPattern = startsWithPattern; 45 47 this.taskType = taskType; 46 48 } 47 49 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) 50 56 */ 51 57 public void visit(IIteration iteration) { 52 this.present = containedPattern.containedIn(iteration); 58 this.present = containedPattern.containedIn(iteration); 53 59 } 54 60 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) 57 67 */ 58 68 public void visit(IOptional optional) { 59 this.present = containedPattern.containedIn(optional); 69 this.present = containedPattern.containedIn(optional); 60 70 } 61 71 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) 64 78 */ 65 79 public void visit(ISequence sequence) { 66 ITask firstTask = PatternsVisitorUtil.first NodeOf(sequence.getChildren());67 if (isEvent(firstTask)) {80 ITask firstTask = PatternsVisitorUtil.firstSubtaskOf(sequence.getChildren()); 81 if (isEvent(firstTask)) { 68 82 this.present = containedPattern.containedIn(sequence); 69 } else { 83 } 84 else { 70 85 this.present = containedPattern.containedIn(firstTask); 71 } 86 } 72 87 } 73 88 -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/taskmodel/filter/FilterResult.java
r1216 r1217 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.usability.task tree;15 package de.ugoe.cs.autoquest.usability.taskmodel.filter; 16 16 17 17 import java.util.List; … … 45 45 @SuppressWarnings("unchecked") 46 46 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 } 56 57 } 57 58 -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/taskmodel/filter/IterativeDFSFilterStrategy.java
r1216 r1217 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.usability.task tree;15 package de.ugoe.cs.autoquest.usability.taskmodel.filter; 16 16 17 17 import java.util.LinkedList; … … 26 26 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 27 27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 28 import de.ugoe.cs.autoquest.usability.task tree.filters.EventTargetFilter;29 import de.ugoe.cs.autoquest.usability.task tree.filters.EventTypeFilter;30 import de.ugoe.cs.autoquest.usability.task tree.filters.TaskTypeFilter;28 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTargetFilter; 29 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter; 30 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 31 31 32 32 /** … … 86 86 } 87 87 88 private void processChildrenOfCurrentTask(Queue<ITask> unvisitedTasks, 89 ITask task) 90 { 88 private void processChildrenOfCurrentTask(Queue<ITask> unvisitedTasks, ITask task) { 91 89 if (task instanceof IStructuringTemporalRelationship) { 92 90 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 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.usability.task tree;15 package de.ugoe.cs.autoquest.usability.taskmodel.filter; 16 16 17 17 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 18 import de.ugoe.cs.autoquest.usability.task tree.filters.EventTargetFilter;19 import de.ugoe.cs.autoquest.usability.task tree.filters.EventTypeFilter;20 import de.ugoe.cs.autoquest.usability.task tree.filters.TaskTypeFilter;18 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTargetFilter; 19 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter; 20 import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 21 21 22 22 /** -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/taskmodel/filter/types/EventTargetFilter.java
r1152 r1217 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.usability.task tree.filters;15 package de.ugoe.cs.autoquest.usability.taskmodel.filter.types; 16 16 17 17 import com.google.common.base.Function; … … 27 27 /** 28 28 * <p> 29 * TODO comment29 * Event target filter for {@link EventTask}s. 30 30 * </p> 31 31 * … … 44 44 } 45 45 46 /* 47 * (non-Javadoc) 48 * 49 * @see de.ugoe.cs.autoquest.usability.tasktree.filters.TaskFilter#getId() 50 */ 46 51 @SuppressWarnings("unchecked") 47 52 @Override … … 50 55 } 51 56 57 /* 58 * (non-Javadoc) 59 * 60 * @see de.ugoe.cs.autoquest.usability.tasktree.filters.TaskFilter#getId() 61 */ 52 62 @SuppressWarnings("rawtypes") 53 63 @Override … … 59 69 } 60 70 71 /** 72 * 73 * <p> 74 * Gets the event target of a {@link ITask}. 75 * </p> 76 * 77 * @return event target 78 */ 61 79 private Function<ITask, IEventTarget> taskExtractionFunction() { 62 80 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 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.usability.task tree.filters;15 package de.ugoe.cs.autoquest.usability.taskmodel.filter.types; 16 16 17 17 import com.google.common.base.Function; … … 31 31 /** 32 32 * <p> 33 * TODO comment33 * Event type filter for {@link EventTask}s. 34 34 * </p> 35 35 * … … 39 39 40 40 MOUSE_BUTTON_INTERACTION(MouseButtonInteraction.class), 41 41 42 42 MOUSE_CLICK(MouseClick.class), 43 43 44 44 MOUSE_INTERACTION(MouseInteraction.class), 45 45 46 46 TEXT_INPUT(TextInput.class), 47 47 48 48 SCROLL(Scroll.class), 49 49 50 50 USER_INTERACTION(IInteraction.class); 51 51 … … 55 55 this.eventTypeClazz = eventTypeClazz; 56 56 } 57 57 58 /* 59 * (non-Javadoc) 60 * 61 * @see de.ugoe.cs.autoquest.usability.tasktree.filters.TaskFilter#getId() 62 */ 58 63 @SuppressWarnings("unchecked") 59 64 @Override … … 62 67 } 63 68 69 /* 70 * (non-Javadoc) 71 * 72 * @see de.ugoe.cs.autoquest.usability.tasktree.filters.TaskFilter#getId() 73 */ 64 74 @SuppressWarnings("rawtypes") 65 75 @Override … … 71 81 } 72 82 83 /** 84 * 85 * <p> 86 * Gets the event type of a {@link ITask}. 87 * </p> 88 * 89 * @return event type 90 */ 73 91 private Function<ITask, IEventType> taskExtractionFunction() { 74 92 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 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.usability.task tree.filters;15 package de.ugoe.cs.autoquest.usability.taskmodel.filter.types; 16 16 17 17 import com.google.common.base.Predicate; … … 19 19 /** 20 20 * <p> 21 * TODO comment21 * A task filter allows to filter a collection of tasks, considering a provided predicate. 22 22 * </p> 23 23 * … … 26 26 public interface TaskFilter<T> { 27 27 28 /** 29 * 30 * <p> 31 * {@link Class} of type or property, which is used to filter tasks. 32 * </p> 33 * 34 * @return 35 */ 28 36 public Class<T> clazz(); 29 37 38 /** 39 * 40 * <p> 41 * Provides predicate to filter tasks. 42 * </p> 43 * 44 * @return 45 */ 30 46 @SuppressWarnings("rawtypes") 31 47 public Predicate filterPredicate(); -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/taskmodel/filter/types/TaskModelFilter.java
r1152 r1217 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.usability.task tree.filters;15 package de.ugoe.cs.autoquest.usability.taskmodel.filter.types; 16 16 17 17 import com.google.common.base.Preconditions; 18 18 19 19 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 20 import de.ugoe.cs.autoquest.usability.task tree.FilterResult;21 import de.ugoe.cs.autoquest.usability.task tree.TaskModelFilterStrategy;20 import de.ugoe.cs.autoquest.usability.taskmodel.filter.FilterResult; 21 import de.ugoe.cs.autoquest.usability.taskmodel.filter.TaskModelFilterStrategy; 22 22 23 23 /** -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/taskmodel/filter/types/TaskTypeFilter.java
r1152 r1217 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.usability.task tree.filters;15 package de.ugoe.cs.autoquest.usability.taskmodel.filter.types; 16 16 17 17 import com.google.common.base.Predicate; … … 26 26 /** 27 27 * <p> 28 * T ODO comment28 * Task type filter for {@link ITask}s. 29 29 * </p> 30 30 * … … 34 34 35 35 EVENT_TASK_NODE(IEventTask.class), 36 36 37 37 ITERATION(IIteration.class), 38 38 39 39 SEQUENCE(ISequence.class), 40 41 SELECTION(ISelection.class) ,;40 41 SELECTION(ISelection.class); 42 42 43 43 private Class<? extends ITask> taskTypeClazz; … … 47 47 } 48 48 49 /* 50 * (non-Javadoc) 51 * 52 * @see de.ugoe.cs.autoquest.usability.tasktree.filters.TaskFilter#getId() 53 */ 49 54 @SuppressWarnings("unchecked") 50 55 @Override … … 53 58 } 54 59 60 /* 61 * (non-Javadoc) 62 * 63 * @see de.ugoe.cs.autoquest.usability.tasktree.filters.TaskFilter#getId() 64 */ 55 65 @SuppressWarnings("rawtypes") 56 66 @Override -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/util/NullTask.java
r1163 r1217 22 22 /** 23 23 * <p> 24 * TODO comment24 * Implementation of Null Object pattern {@link http://en.wikipedia.org/wiki/Null_Object_pattern}. 25 25 * </p> 26 26 * … … 29 29 public class NullTask implements ITask { 30 30 31 /** */32 31 private static final long serialVersionUID = 1236779392413787860L; 33 32 34 /* (non-Javadoc) 33 /* 34 * (non-Javadoc) 35 * 35 36 * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITask#getId() 36 37 */ … … 39 40 return -1; 40 41 } 41 42 /* (non-Javadoc) 42 43 /* 44 * (non-Javadoc) 45 * 43 46 * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode#getName() 44 47 */ … … 47 50 } 48 51 49 /* (non-Javadoc) 52 /* 53 * (non-Javadoc) 54 * 50 55 * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode#getDescription() 51 56 */ … … 54 59 } 55 60 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) 58 67 */ 59 68 public boolean equals(ITask task) { 60 69 return false; 61 70 } 62 63 /* (non-Javadoc) 71 72 /* 73 * (non-Javadoc) 74 * 64 75 * @see java.lang.Object#clone() 65 76 */ … … 69 80 } 70 81 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) 73 88 */ 74 89 public void accept(ITaskVisitor visitor) { 75 90 // do nothing 76 91 } 77 92 78 93 } 79 -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/util/PatternsVisitorUtil.java
r1164 r1217 15 15 package de.ugoe.cs.autoquest.usability.util; 16 16 17 import java.util. List;17 import java.util.Collection; 18 18 19 19 import com.google.common.collect.Iterables; 20 20 21 21 import 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; 22 import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 25 23 26 24 /** 27 25 * <p> 28 * TODO comment26 * Util class for {@link InteractionPatternVisitor}. 29 27 * </p> 30 28 * … … 36 34 // no instantiation 37 35 } 38 36 39 37 /** 40 38 * <p> 41 * TODO: comment39 * Gets the first sub task. 42 40 * </p> 43 * 44 * @param taskTreeNode 45 * @return 41 * 42 * @param tasks 43 * collection of tasks 44 * @return first sub task 46 45 */ 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) { 60 47 return Iterables.getFirst(tasks, new NullTask()); 61 48 } … … 63 50 /** 64 51 * <p> 65 * TODO: comment52 * Gets the last sub task. 66 53 * </p> 67 * 68 * @param taskTreeNodes 69 * @return 54 * 55 * @param tasks 56 * collection of tasks 57 * @return last sub task 70 58 */ 71 public static ITask last NodeOf(List<ITask> tasks) {59 public static ITask lastSubTaskOf(Collection<ITask> tasks) { 72 60 return Iterables.getLast(tasks, new NullTask()); 73 61 } 74 62 75 63 } -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/util/TextInputUtil.java
r1152 r1217 31 31 /** 32 32 * <p> 33 * TODO comment33 * Util class to handle text input events/tasks. 34 34 * </p> 35 35 * … … 42 42 } 43 43 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 */ 44 54 public static Multiset<String> aggregateEnteredTextFromTextInputs(List<ITask> tasksWithTextInputEvents) 45 55 { … … 52 62 } 53 63 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 */ 54 74 public static Iterable<String> splitTextIntoWordsAndSigns(String enteredText) { 55 75 CharMatcher onlyWords = 56 CharMatcher.WHITESPACE.or(CharMatcher 57 .forPredicate(characterIsJavaIdentifierPartPredicate())); 76 CharMatcher.WHITESPACE.or(CharMatcher.forPredicate(characterIsNoJavaIdentifierPart())); 58 77 CharMatcher onlySigns = 59 CharMatcher.WHITESPACE.or(CharMatcher 60 . forPredicate(characterIsJavaIdentifierPartPredicate()).negate());78 CharMatcher.WHITESPACE.or(CharMatcher.forPredicate(characterIsNoJavaIdentifierPart()) 79 .negate()); 61 80 Iterable<String> words = 62 81 Splitter.on(onlyWords).omitEmptyStrings().trimResults().split(enteredText); … … 66 85 } 67 86 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() { 69 96 return new Predicate<Character>() { 70 97 … … 77 104 } 78 105 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() { 80 115 return new Predicate<Character>() { 81 116
Note: See TracChangeset
for help on using the changeset viewer.