source: trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/testutil/GenerateTaskTreeUtil.java @ 1040

Last change on this file since 1040 was 1040, checked in by adeicke, 11 years ago
  • Removed lombok related annotations and util class
  • Added comments and formating due to match project defaults
  • Property svn:mime-type set to text/plain
File size: 3.5 KB
Line 
1//   Copyright 2012 Georg-August-Universität Göttingen, Germany
2//
3//   Licensed under the Apache License, Version 2.0 (the "License");
4//   you may not use this file except in compliance with the License.
5//   You may obtain a copy of the License at
6//
7//       http://www.apache.org/licenses/LICENSE-2.0
8//
9//   Unless required by applicable law or agreed to in writing, software
10//   distributed under the License is distributed on an "AS IS" BASIS,
11//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//   See the License for the specific language governing permissions and
13//   limitations under the License.
14
15package de.ugoe.cs.autoquest.usability.testutil;
16
17import java.util.logging.Level;
18
19import de.ugoe.cs.autoquest.commands.sequences.CMDcondenseGuiModel;
20import de.ugoe.cs.autoquest.commands.sequences.CMDcondenseMouseClicks;
21import de.ugoe.cs.autoquest.commands.sequences.CMDcorrectKeyInteractionTargets;
22import de.ugoe.cs.autoquest.commands.sequences.CMDdetectTextInputEvents;
23import de.ugoe.cs.autoquest.commands.sequences.CMDsortKeyInteractions;
24import de.ugoe.cs.autoquest.commands.usability.CMDgenerateTaskTree;
25import de.ugoe.cs.autoquest.plugin.jfc.commands.CMDparseJFC;
26import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTree;
27import de.ugoe.cs.autoquest.test.CommandRunner;
28import de.ugoe.cs.util.console.Console;
29import de.ugoe.cs.util.console.GlobalDataContainer;
30import de.ugoe.cs.util.console.TextConsole;
31
32/**
33 * <p>
34 * TODO comment
35 * </p>
36 *
37 * @author Alexander Deicke
38 */
39public class GenerateTaskTreeUtil {
40
41    private static final String seqName = "sequences";
42
43    private static final String taskTreeName = "taskTree";
44
45    public static ITaskTree getTaskTreeFromFile(String filename) {
46        new TextConsole(Level.FINEST);
47        parseTraceFile(filename);
48        condenseGuiModel();
49        sortKeyInteractions();
50        correctKeyInteractionTargets();
51        detectTextInputEvents();
52        condenseMouseClicks();
53        return generateTaskTree();
54    }
55
56    static private void parseTraceFile(String filetoparse) {
57        Console.println("parsing trace file");
58        CommandRunner.runCommand(CMDparseJFC.class, ClassLoader.getSystemResource(filetoparse)
59            .getFile(), seqName);
60    }
61
62    private static void condenseGuiModel() {
63        Console.println("condensing GUI model");
64        CommandRunner.runCommand(CMDcondenseGuiModel.class, seqName);
65    }
66
67    private static void sortKeyInteractions() {
68        Console.println("sorting key interactions");
69        CommandRunner.runCommand(CMDsortKeyInteractions.class, seqName);
70    }
71
72    private static void correctKeyInteractionTargets() {
73        Console.println("correcting key interaction targets");
74        CommandRunner.runCommand(CMDcorrectKeyInteractionTargets.class, seqName);
75    }
76
77    private static void detectTextInputEvents() {
78        Console.println("detecting text input events");
79        CommandRunner.runCommand(CMDdetectTextInputEvents.class, seqName);
80    }
81
82    private static void condenseMouseClicks() {
83        Console.println("condensing mouse click events");
84        CommandRunner.runCommand(CMDcondenseMouseClicks.class, seqName);
85    }
86
87    private static ITaskTree generateTaskTree() {
88        CommandRunner.runCommand(CMDgenerateTaskTree.class, seqName, taskTreeName);
89        GlobalDataContainer dataContainer = GlobalDataContainer.getInstance();
90        return (ITaskTree) dataContainer.getData(taskTreeName);
91    }
92
93}
Note: See TracBrowser for help on using the repository browser.