source: trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/util/PatternsVisitorUtil.java @ 1152

Last change on this file since 1152 was 1152, checked in by pharms, 11 years ago
  • complete refactoring of task tree model with a separation of task models and task instances
  • Property svn:mime-type set to text/plain
File size: 1.9 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.util;
16
17import java.util.List;
18
19import com.google.common.collect.Iterables;
20
21import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
22import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
23import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory;
24
25/**
26 * <p>
27 * TODO comment
28 * </p>
29 *
30 * @author Alexander Deicke
31 */
32public class PatternsVisitorUtil {
33
34    private PatternsVisitorUtil() {
35        // no instantiation
36    }
37   
38    /**
39     * <p>
40     * TODO: comment
41     * </p>
42     *
43     * @param taskTreeNode
44     * @return
45     */
46    public static ITaskModel createTaskModelFromNode(ITask task) {
47        return new TaskFactory().createTaskTree(task);
48    }
49   
50    /**
51     * <p>
52     * TODO: comment
53     * </p>
54     *
55     * @param taskTreeNodes
56     * @return
57     */
58    public static ITask firstNodeOf(List<ITask> tasks) {
59        return Iterables.getFirst(tasks, new NullNode());
60    }
61
62    /**
63     * <p>
64     * TODO: comment
65     * </p>
66     *
67     * @param taskTreeNodes
68     * @return
69     */
70    public static ITask lastNodeOf(List<ITask> tasks) {
71        return Iterables.getLast(tasks, new NullNode());
72    }
73   
74}
Note: See TracBrowser for help on using the repository browser.