-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:JabRef/jabref
* 'master' of github.com:JabRef/jabref: Allow spaces in DOIs Remove irrelevant log messages during XMP reading Adapt log4j configuration for cleaner junit tests #3511 Eclipse Django style #3655 Better code style for chained methods Update build.gradle Update build.gradle cleanup and refactoring in DuplicateCheck class code review fixes - consider pages of the same book separately in duplications detection process; add more tests differentiate inbooks with the same author and title, but different chapter Remove deprecated static BibtexParser.parse method Use stream in matcher (#3696) Add some BibtexNameFomatter comments Add exception for Jacoco Set jacoco toolVersion earlier set jacoco version globally
- Loading branch information
Showing
15 changed files
with
306 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
275 changes: 169 additions & 106 deletions
275
src/main/java/org/jabref/logic/bibtex/DuplicateCheck.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 4 additions & 15 deletions
19
src/main/java/org/jabref/model/search/matchers/AndMatcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,15 @@ | ||
package org.jabref.model.search.matchers; | ||
|
||
import org.jabref.model.entry.BibEntry; | ||
import org.jabref.model.search.SearchMatcher; | ||
|
||
/** | ||
* Subclass of MatcherSet that ANDs or ORs between its rules, returning 0 or | ||
* 1. | ||
* A set of matchers that returns true if all matcher match the given entry. | ||
*/ | ||
public class AndMatcher extends MatcherSet { | ||
|
||
@Override | ||
public boolean isMatch(BibEntry bibEntry) { | ||
int score = 0; | ||
|
||
// We let each rule add a maximum of 1 to the score. | ||
for (SearchMatcher rule : matchers) { | ||
if (rule.isMatch(bibEntry)) { | ||
score++; | ||
} | ||
} | ||
|
||
// Then an AND rule demands that score == number of rules | ||
return score == matchers.size(); | ||
public boolean isMatch(BibEntry entry) { | ||
return matchers.stream() | ||
.allMatch(rule -> rule.isMatch(entry)); | ||
} | ||
} |
19 changes: 4 additions & 15 deletions
19
src/main/java/org/jabref/model/search/matchers/OrMatcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,15 @@ | ||
package org.jabref.model.search.matchers; | ||
|
||
import org.jabref.model.entry.BibEntry; | ||
import org.jabref.model.search.SearchMatcher; | ||
|
||
/** | ||
* Subclass of MatcherSet that ANDs or ORs between its rules, returning 0 or | ||
* 1. | ||
* A set of matchers that returns true if any matcher matches the given entry. | ||
*/ | ||
public class OrMatcher extends MatcherSet { | ||
|
||
@Override | ||
public boolean isMatch(BibEntry bibEntry) { | ||
int score = 0; | ||
|
||
// We let each rule add a maximum of 1 to the score. | ||
for (SearchMatcher rule : matchers) { | ||
if (rule.isMatch(bibEntry)) { | ||
score++; | ||
} | ||
} | ||
|
||
// OR rule demands score > 0. | ||
return score > 0; | ||
public boolean isMatch(BibEntry entry) { | ||
return matchers.stream() | ||
.anyMatch(rule -> rule.isMatch(entry)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.