[1040] | 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.
|
---|
[1030] | 14 |
|
---|
| 15 | package de.ugoe.cs.autoquest.usability.tasktree.filter;
|
---|
| 16 |
|
---|
| 17 | import com.google.common.base.Preconditions;
|
---|
| 18 |
|
---|
| 19 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTree;
|
---|
| 20 |
|
---|
[1040] | 21 | /**
|
---|
| 22 | * <p>
|
---|
| 23 | * TODO comment
|
---|
| 24 | * </p>
|
---|
| 25 | *
|
---|
| 26 | * @author Alexander Deicke
|
---|
| 27 | */
|
---|
[1030] | 28 | public class TaskTreeFilter {
|
---|
[1040] | 29 |
|
---|
[1030] | 30 | private final TaskTreeFilterStrategy taskTreeFilterStrategy;
|
---|
[1040] | 31 |
|
---|
[1030] | 32 | public TaskTreeFilter(TaskTreeFilterStrategy treeTraversalStrategy) {
|
---|
| 33 | Preconditions.checkNotNull(treeTraversalStrategy);
|
---|
| 34 | this.taskTreeFilterStrategy = treeTraversalStrategy;
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | public FilterEventTargetStep filterByEventTarget(EventTargetFilter eventTarget) {
|
---|
| 38 | return new FilterEventTargetStep(eventTarget);
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | public FilterEventTypeStep filterByEventType(EventTypeFilter eventType) {
|
---|
| 42 | return new FilterEventTypeStep(eventType);
|
---|
| 43 | }
|
---|
| 44 |
|
---|
[1040] | 45 | public FilterNodeTypeStep filterByNodeType(TaskTreeNodeTypeFilter nodeType) {
|
---|
| 46 | return new FilterNodeTypeStep(nodeType);
|
---|
| 47 | }
|
---|
| 48 |
|
---|
[1030] | 49 | public class FilterEventTargetStep {
|
---|
| 50 |
|
---|
| 51 | private final EventTargetFilter eventTarget;
|
---|
| 52 |
|
---|
| 53 | public FilterEventTargetStep(EventTargetFilter eventTarget) {
|
---|
| 54 | this.eventTarget = eventTarget;
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | public FilterStatistic from(ITaskTree taskTree) {
|
---|
| 58 | return taskTreeFilterStrategy.filter(taskTree, eventTarget);
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | public class FilterEventTypeStep {
|
---|
| 64 |
|
---|
| 65 | private final EventTypeFilter eventType;
|
---|
| 66 |
|
---|
| 67 | public FilterEventTypeStep(EventTypeFilter eventType) {
|
---|
| 68 | this.eventType = eventType;
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | public FilterStatistic from(ITaskTree taskTree) {
|
---|
| 72 | return taskTreeFilterStrategy.filter(taskTree, eventType);
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 | }
|
---|
[1040] | 76 |
|
---|
| 77 | public class FilterNodeTypeStep {
|
---|
| 78 |
|
---|
| 79 | private final TaskTreeNodeTypeFilter nodeType;
|
---|
| 80 |
|
---|
| 81 | public FilterNodeTypeStep(TaskTreeNodeTypeFilter nodeType) {
|
---|
| 82 | this.nodeType = nodeType;
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | public FilterStatistic from(ITaskTree taskTree) {
|
---|
| 86 | return taskTreeFilterStrategy.filter(taskTree, nodeType);
|
---|
| 87 | }
|
---|
| 88 |
|
---|
| 89 | }
|
---|
[1030] | 90 | }
|
---|