source: trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/tasktree/FilterResult.java @ 1135

Last change on this file since 1135 was 1135, checked in by adeicke, 11 years ago

Restructuring of package structure.

  • 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.ITaskTreeNode;
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<ITaskTreeNode> filteredNodes = Lists.newArrayList();
37
38    private List<ITaskTreeNode> nodesNotMatchedFilter = Lists.newArrayList();
39
40    @SuppressWarnings("rawtypes")
41    public FilterResult(Predicate filterPredicate) {
42        this.filterPredicate = filterPredicate;
43    }
44
45    @SuppressWarnings("unchecked")
46    public void addNode(ITaskTreeNode node) {
47        if (filterPredicate.apply(node)) {
48            filteredNodes.add(node);
49        }
50        else {
51            nodesNotMatchedFilter.add(node);
52        }
53    }
54
55    public List<ITaskTreeNode> nodesMatchedFilter() {
56        return this.filteredNodes;
57    }
58
59    public int nrOfNodesMatchedFilter() {
60        return this.filteredNodes.size();
61    }
62
63    public List<ITaskTreeNode> nodesNotMatchedFilter() {
64        return this.nodesNotMatchedFilter;
65    }
66
67    public int nrOfNodesNotMatchedFilter() {
68        return this.nodesNotMatchedFilter.size();
69    }
70
71}
Note: See TracBrowser for help on using the repository browser.