use of org.jabref.model.search.SearchMatcher in project jabref by JabRef.
the class GroupTreeNode method getMatchingGroups.
public List<GroupTreeNode> getMatchingGroups(List<BibEntry> entries) {
List<GroupTreeNode> groups = new ArrayList<>();
// Add myself if I contain the entries
SearchMatcher matcher = getSearchMatcher();
for (BibEntry entry : entries) {
if (matcher.isMatch(entry)) {
groups.add(this);
break;
}
}
// Traverse children
for (GroupTreeNode child : getChildren()) {
groups.addAll(child.getMatchingGroups(entries));
}
return groups;
}
use of org.jabref.model.search.SearchMatcher in project jabref by JabRef.
the class GroupTreeNode method calculateNumberOfMatches.
/**
* Determines the number of entries in the specified list which are matched by this group.
* @param entries list of entries to be searched
* @return number of hits
*/
public int calculateNumberOfMatches(List<BibEntry> entries) {
int hits = 0;
SearchMatcher matcher = getSearchMatcher();
for (BibEntry entry : entries) {
if (matcher.isMatch(entry)) {
hits++;
}
}
return hits;
}
Aggregations