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 |
|
---|
15 | package de.ugoe.cs.autoquest.usability.util;
|
---|
16 |
|
---|
17 | import java.util.List;
|
---|
18 |
|
---|
19 | import com.google.common.collect.Iterables;
|
---|
20 |
|
---|
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;
|
---|
25 |
|
---|
26 | /**
|
---|
27 | * <p>
|
---|
28 | * TODO comment
|
---|
29 | * </p>
|
---|
30 | *
|
---|
31 | * @author Alexander Deicke
|
---|
32 | */
|
---|
33 | public class PatternsVisitorUtil {
|
---|
34 |
|
---|
35 | private PatternsVisitorUtil() {
|
---|
36 | // no instantiation
|
---|
37 | }
|
---|
38 |
|
---|
39 | /**
|
---|
40 | * <p>
|
---|
41 | * TODO: comment
|
---|
42 | * </p>
|
---|
43 | *
|
---|
44 | * @param taskTreeNode
|
---|
45 | * @return
|
---|
46 | */
|
---|
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) {
|
---|
60 | return Iterables.getFirst(tasks, new NullTask());
|
---|
61 | }
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * <p>
|
---|
65 | * TODO: comment
|
---|
66 | * </p>
|
---|
67 | *
|
---|
68 | * @param taskTreeNodes
|
---|
69 | * @return
|
---|
70 | */
|
---|
71 | public static ITask lastNodeOf(List<ITask> tasks) {
|
---|
72 | return Iterables.getLast(tasks, new NullTask());
|
---|
73 | }
|
---|
74 |
|
---|
75 | }
|
---|