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/FilterStatistic.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 
     
    418 
    519import com.google.common.base.Predicate; 
     20import com.google.common.collect.LinkedListMultimap; 
    621import com.google.common.collect.Lists; 
     22import com.google.common.collect.Multimap; 
    723 
     24import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement; 
     25import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
    826import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; 
    927 
     28/** 
     29 * <p> 
     30 * TODO comment 
     31 * </p> 
     32 *  
     33 * @author Alexander Deicke 
     34 */ 
    1035public class FilterStatistic { 
    11      
     36 
    1237    @SuppressWarnings("rawtypes") 
    1338    private final Predicate filterPredicate; 
    1439 
    1540    private List<ITaskTreeNode> filteredNodes = Lists.newArrayList(); 
    16      
     41 
    1742    private List<ITaskTreeNode> nodesNotMatchedFilter = Lists.newArrayList(); 
    18      
     43 
    1944    @SuppressWarnings("rawtypes") 
    2045    public FilterStatistic(Predicate filterPredicate) { 
    2146        this.filterPredicate = filterPredicate; 
    2247    } 
    23      
     48 
    2449    @SuppressWarnings("unchecked") 
    2550    public void addNode(ITaskTreeNode node) { 
    2651        if (filterPredicate.apply(node)) { 
    2752            filteredNodes.add(node); 
    28         } else { 
     53        } 
     54        else { 
    2955            nodesNotMatchedFilter.add(node); 
    3056        } 
    3157    } 
    32      
     58 
    3359    public List<ITaskTreeNode> nodesMatchedFilter() { 
    3460        return this.filteredNodes; 
    3561    } 
    36      
     62 
    3763    public int nrOfNodesMatchedFilter() { 
    3864        return this.filteredNodes.size(); 
    3965    } 
    40      
     66 
    4167    public List<ITaskTreeNode> nodesNotMatchedFilter() { 
    4268        return this.nodesNotMatchedFilter; 
    4369    } 
    44      
     70 
    4571    public int nrOfNodesNotMatchedFilter() { 
    4672        return this.nodesNotMatchedFilter.size(); 
    4773    } 
    48      
     74 
     75    /** 
     76     * <p> 
     77     * TODO: comment 
     78     * </p> 
     79     * 
     80     * @param eventTargetParent 
     81     * @return 
     82     */ 
     83    public Multimap<IGUIElement, ITaskTreeNode> groupBy() { 
     84        Multimap<IGUIElement, ITaskTreeNode> groupedNodes = LinkedListMultimap.create(); 
     85        for(ITaskTreeNode node : filteredNodes) { 
     86            IGUIElement eventTask = (IGUIElement) ((IEventTask) node).getEventTarget(); 
     87            groupedNodes.put(eventTask.getParent(), node); 
     88        } 
     89        return groupedNodes; 
     90    } 
     91 
    4992} 
Note: See TracChangeset for help on using the changeset viewer.