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

Last change on this file since 1217 was 1217, checked in by adeicke, 11 years ago
  • Added proper formating and JavaDoc?.
  • Several renaming refactorings.
  • Property svn:mime-type set to text/plain
File size: 1.7 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.Collection;
18
19import com.google.common.collect.Iterables;
20
21import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
22import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor;
23
24/**
25 * <p>
26 * Util class for {@link InteractionPatternVisitor}.
27 * </p>
28 *
29 * @author Alexander Deicke
30 */
31public class PatternsVisitorUtil {
32
33    private PatternsVisitorUtil() {
34        // no instantiation
35    }
36
37    /**
38     * <p>
39     * Gets the first sub task.
40     * </p>
41     *
42     * @param tasks
43     *            collection of tasks
44     * @return first sub task
45     */
46    public static ITask firstSubtaskOf(Collection<ITask> tasks) {
47        return Iterables.getFirst(tasks, new NullTask());
48    }
49
50    /**
51     * <p>
52     * Gets the last sub task.
53     * </p>
54     *
55     * @param tasks
56     *            collection of tasks
57     * @return last sub task
58     */
59    public static ITask lastSubTaskOf(Collection<ITask> tasks) {
60        return Iterables.getLast(tasks, new NullTask());
61    }
62
63}
Note: See TracBrowser for help on using the repository browser.