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
RevLine 
[1150]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
[1217]17import java.util.Collection;
[1150]18
19import com.google.common.collect.Iterables;
20
[1152]21import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
[1217]22import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor;
[1150]23
24/**
25 * <p>
[1217]26 * Util class for {@link InteractionPatternVisitor}.
[1150]27 * </p>
28 *
29 * @author Alexander Deicke
30 */
31public class PatternsVisitorUtil {
32
33    private PatternsVisitorUtil() {
34        // no instantiation
35    }
[1217]36
[1150]37    /**
38     * <p>
[1217]39     * Gets the first sub task.
[1150]40     * </p>
[1217]41     *
42     * @param tasks
43     *            collection of tasks
44     * @return first sub task
[1150]45     */
[1217]46    public static ITask firstSubtaskOf(Collection<ITask> tasks) {
[1164]47        return Iterables.getFirst(tasks, new NullTask());
[1150]48    }
49
50    /**
51     * <p>
[1217]52     * Gets the last sub task.
[1150]53     * </p>
[1217]54     *
55     * @param tasks
56     *            collection of tasks
57     * @return last sub task
[1150]58     */
[1217]59    public static ITask lastSubTaskOf(Collection<ITask> tasks) {
[1164]60        return Iterables.getLast(tasks, new NullTask());
[1150]61    }
[1217]62
[1150]63}
Note: See TracBrowser for help on using the repository browser.