Search in sources :

Example 1 with SearchMatcher

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;
}
Also used : BibEntry(org.jabref.model.entry.BibEntry) ArrayList(java.util.ArrayList) SearchMatcher(org.jabref.model.search.SearchMatcher)

Example 2 with SearchMatcher

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;
}
Also used : BibEntry(org.jabref.model.entry.BibEntry) SearchMatcher(org.jabref.model.search.SearchMatcher)

Aggregations

BibEntry (org.jabref.model.entry.BibEntry)2 SearchMatcher (org.jabref.model.search.SearchMatcher)2 ArrayList (java.util.ArrayList)1