-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check for different editions in the duplicate check #2991
Conversation
private static boolean hasSameIdentifier(BibEntry one, BibEntry two) { | ||
private static boolean haveDifferentEditions(BibEntry one, BibEntry two) { | ||
if (one.getField(FieldName.EDITION).isPresent() && two.getField(FieldName.EDITION).isPresent()) { | ||
if (!one.getField(FieldName.EDITION).get().equals(two.getField(FieldName.EDITION).get())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can direclty compare Optionals with equals, but be aware that two empty optionals also equal.
https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html#equals-java.lang.Object-
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm aware of that. That's why I first checked both to be present, and then called .get()
on both to explicitly state that this line will only work if there is a value in the Optionals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, good! Then it's fine
@@ -26,7 +26,7 @@ | |||
* This class contains utility method for duplicate checking of entries. | |||
*/ | |||
public class DuplicateCheck { | |||
public static double duplicateThreshold = 0.75; // The overall threshold to signal a duplicate pair | |||
private static final double duplicateThreshold = 0.75; // The overall threshold to signal a duplicate pair |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a very minor thing, the constant variable should be uppercase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see the optional stuff
* upstream/master: Eclipse J Add switch indentation for Eclipse and add some new missing formatting options Check for different editions in the duplicate check (#2991) Add CheckStyle Check for Constants (final static) (#2992) Add Remove link context menu entry in file editor (#2972) Fix DiVA tests Remove <pre> tag from entries fetched using MathSciNet (#2990) Fix Brazilian Portugese language loading (#2981) Use sftp's symlink command to provide symlink to latest version Update gradle from 4.0 to 4.0.1 Fix group storage (#2978) Fix keybindings in entry editor (#2971)
Fixes #2960 by checking for different editions before the actual duplicate check.
If both BibEntries have a Edition field that mismatches, it cannot be a duplicate.