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.treeimpl.TaskFactory;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * <p>
|
---|
27 | * TODO comment
|
---|
28 | * </p>
|
---|
29 | *
|
---|
30 | * @author Alexander Deicke
|
---|
31 | */
|
---|
32 | public 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 | }
|
---|