Ignore:
Timestamp:
01/16/13 17:51:51 (11 years ago)
Author:
adeicke
Message:
  • Removed lombok related annotations and util class
  • Added comments and formating due to match project defaults
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/tasktree/filter/IterativeDFSFilterStrategy.java

    r1030 r1040  
     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 
    115package de.ugoe.cs.autoquest.usability.tasktree.filter; 
    216 
     
    1024import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; 
    1125 
     26/** 
     27 * <p> 
     28 * TODO comment 
     29 * </p> 
     30 *  
     31 * @author Alexander Deicke 
     32 */ 
    1233public class IterativeDFSFilterStrategy implements TaskTreeFilterStrategy { 
    13      
     34 
    1435    private FilterStatistic filterStatistic; 
    15      
     36 
    1637    @SuppressWarnings("unchecked") 
    1738    @Override 
     
    3152        return this.filterStatistic; 
    3253    } 
    33      
     54 
     55    @SuppressWarnings("unchecked") 
     56    @Override 
     57    public FilterStatistic filter(ITaskTree taskTree, TaskTreeNodeTypeFilter nodeType) { 
     58        Predicate<ITaskTreeNode> filterPredicate = nodeType.filterPredicate(); 
     59        this.filterStatistic = new FilterStatistic(filterPredicate); 
     60        traverse(taskTree); 
     61        return this.filterStatistic; 
     62    } 
     63 
    3464    private void traverse(ITaskTree taskTree) { 
    3565        Stack<ITaskTreeNode> unvisitedNodes = new Stack<ITaskTreeNode>(); 
    3666        unvisitedNodes.push(taskTree.getRoot()); 
    37         while(stillUnvisitedNodes(unvisitedNodes)) { 
     67        while (stillUnvisitedNodes(unvisitedNodes)) { 
    3868            ITaskTreeNode node = unvisitedNodes.pop(); 
    3969            processCurrentNode(node); 
     
    4979        this.filterStatistic.addNode(node); 
    5080    } 
    51      
     81 
    5282    private void processChildrenOfCurrentNode(Stack<ITaskTreeNode> unvisitedNodes, 
    53                                               ITaskTreeNode node) { 
    54         for(ITaskTreeNode child : node.getChildren()) { 
     83                                              ITaskTreeNode node) 
     84    { 
     85        for (ITaskTreeNode child : node.getChildren()) { 
    5586            unvisitedNodes.push(child); 
    5687        } 
Note: See TracChangeset for help on using the changeset viewer.