edu.umd.cs.findbugs.gui2

Class BugSet

public class BugSet extends Object implements Iterable<BugLeafNode>

BugSet is what we use instead of SortedBugCollections. BugSet is somewhat poorly named, in that its actually a HashList of bugs, not a Set of them. (It can't be a set because we need to be able to sort it, also, HashList is great for doing contains and indexOf, its just slow for removing which we never need to do) The power of BugSet is in query. You can query a BugSet with a BugAspects, a list of StringPairs like , and you will get out a new BugSet containing all of the bugs that are both high priority and unclassified. Also, after the first time a query is made, the results will come back instantly on future calls because the old queries are cached. Note that this caching can also lead to issues, problems with the BugTreeModel and the JTree getting out of sync, if there comes a time when the model and tree are out of sync but come back into sync if the tree is rebuilt, say by sorting the column headers, it probably means that resetData needs to be called on the model after doing one of its operations.

Author: Dan

Method Summary
booleancontains(BugAspects.SortableValue keyValuePair)
Contains takes a key/value pair
BugSetfilterNoCache()
BugLeafNodeget(int index)
String[]getAll(Sortables s)
Gets all the string values out of the bugs in the set
BugSetgetBugsMatchingFilter(Matcher m)
static BugSetgetMainBugSet()
mainBugSet should probably always be the same as the data field in the current BugTreeModel we haven't run into any issues where it isn't, but if the two aren't equal using ==, problems might occur.
BugLeafNodegetUnfiltered(int index)
intindexOf(BugLeafNode p)
intindexOfUnfiltered(BugLeafNode p)
Iterator<BugLeafNode>iterator()
BugSetquery(BugAspects a)
Gives you back the BugSet containing all bugs that match your query
intsize()
intsizeUnfiltered()

Method Detail

contains

public boolean contains(BugAspects.SortableValue keyValuePair)
Contains takes a key/value pair

Parameters: keyValuePair

Returns: true if a bug leaf from filterNoCache() matches the pair

filterNoCache

public BugSet filterNoCache()

get

public BugLeafNode get(int index)

getAll

public String[] getAll(Sortables s)
Gets all the string values out of the bugs in the set

Parameters: s The Sortables you want all values for

Returns: all values of the sortable passed in that occur in this bugset, in order based on the sortable's compare method.

getBugsMatchingFilter

public BugSet getBugsMatchingFilter(Matcher m)

getMainBugSet

public static BugSet getMainBugSet()
mainBugSet should probably always be the same as the data field in the current BugTreeModel we haven't run into any issues where it isn't, but if the two aren't equal using ==, problems might occur. If these problems do occur, See BugTreeModel.resetData() and perhaps adding a setAsRootAndCache() to it would fix the issue. This is not done right now for fear it might be slow.

getUnfiltered

public BugLeafNode getUnfiltered(int index)

indexOf

public int indexOf(BugLeafNode p)

indexOfUnfiltered

public int indexOfUnfiltered(BugLeafNode p)

iterator

public Iterator<BugLeafNode> iterator()

query

public BugSet query(BugAspects a)
Gives you back the BugSet containing all bugs that match your query

size

public int size()

sizeUnfiltered

public int sizeUnfiltered()
FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.