source: trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/tasktree/FilterResult.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: 2.0 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.tasktree;
16
17import java.util.List;
18
19import com.google.common.base.Predicate;
20import com.google.common.collect.Lists;
21
22import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
23
24/**
25 * <p>
26 * TODO comment
27 * </p>
28 *
29 * @author Alexander Deicke
30 */
31public class FilterResult {
32
33    @SuppressWarnings("rawtypes")
34    private final Predicate filterPredicate;
35
36    private List<ITask> filteredTasks = Lists.newArrayList();
37
38    private List<ITask> tasksNotMatchedFilter = Lists.newArrayList();
39
40    @SuppressWarnings("rawtypes")
41    public FilterResult(Predicate filterPredicate) {
42        this.filterPredicate = filterPredicate;
43    }
44
45    @SuppressWarnings("unchecked")
46    public void addTask(ITask task) {
47        if (filterPredicate.apply(task)) {
48            filteredTasks.add(task);
49        }
50        else {
51            tasksNotMatchedFilter.add(task);
52        }
53    }
54
55    public List<ITask> tasksMatchedFilter() {
56        return this.filteredTasks;
57    }
58
59    public int nrOfTasksMatchedFilter() {
60        return this.filteredTasks.size();
61    }
62
63    public List<ITask> tasksNotMatchedFilter() {
64        return this.tasksNotMatchedFilter;
65    }
66
67    public int nrOfTasksNotMatchedFilter() {
68        return this.tasksNotMatchedFilter.size();
69    }
70
71}
Note: See TracBrowser for help on using the repository browser.