@Test public void testCompareStrict() throws Exception { assertFalse(comp.compareStrict(null, null, null, null)); assertFalse(comp.compareStrict("", "", "", "")); assertFalse(comp.compareStrict("", null, "", null)); assertAuthStrict("", " ", false, " ", " "); assertAuthStrict("L.", null, false, null, null); assertAuthStrict("Bluff & Fingerh.", null, false, "Lindl.", null); assertAuthStrict("Lindl.", null, true, "Lindl.", null); assertAuthStrict(null, "1978", false, null, "1934"); assertAuthStrict(null, "1978", false, null, "1978"); assertAuthStrict("H. Christ", null, false, "C. Chr.", null); assertAuthStrict("Reichenbach", "1837", false, "Abasicarpon Andrz. ex Rchb.", null); assertAuthStrict("Reichenbach", null, true, "Abasicarpon Andrz. ex Rchb.", null); assertAuthStrict("Reichenbach", "1837", true, "Abasicarpon Andrz. ex Rchb.", "1837"); assertAuthStrict("Torr et Gray", null, true, "Torr. & A.Gray", null); assertAuthStrict("Boed.", null, true, "Boed.", null); assertAuthStrict("Boed.", null, false, "F.Boos", null); assertAuthStrict("Boed.", null, false, "Boott", null); assertAuthStrict("Boed.", null, false, "F.Bolus", null); assertAuthStrict("Boed.", null, false, "Borchs.", null); assertAuthStrict("Hett.", null, false, "Scheffers", null); assertAuthStrict("Hett.", null, false, "Schew.", null); assertAuthStrict("Hett.", null, false, "Schemmann", null); assertAuthStrict("Hett.", null, false, "W.Mast.", null); assertAuthStrict("Hett.", null, false, "Kirschst.", null); assertTrue(comp.compareStrict("Ridgway", "1893", "Ridgway", "1893")); assertTrue(comp.compareStrict("K. Koch", null, "K. Koch", null)); assertTrue(comp.compareStrict("K.Koch", null, "K. Koch", null)); assertTrue(comp.compareStrict("A. Nelson", null, "A Nélson", null)); assertTrue(comp.compareStrict("Colla", null, "Bertero ex Colla", null)); assertTrue(comp.compareStrict("Taczanowski & Berlepsch", "1885", "Berlepsch & Taczanowski", "1884")); assertFalse(comp.compareStrict("Taczanowski & Berlepsch", "1885", "Berlepsch & Taczanowski", "1883")); assertFalse(comp.compareStrict("Oberholser", "1917", "Oberholser", "1919")); assertFalse(comp.compareStrict("Koch", "1897", "K. Koch", null)); assertFalse(comp.compareStrict("Gould", "1860", "Gould", "1862")); assertFalse(comp.compareStrict("Gould", "1860", "Gould", "1863")); assertFalse(comp.compareStrict("A. Nelson", null, "E.E. Nelson", null)); assertFalse(comp.compareStrict("Koch", null, "K. Koch", null)); assertTrue(comp.compareStrict("J Koch", null, "Koch", null)); assertTrue(comp.compareStrict("Taczanowski & Berlepsch", "1885", "Berlepsch & Taczanowski", "1885")); assertTrue(comp.compareStrict("J Koch", null, "Koch", null)); assertFalse(comp.compareStrict("Chapm.", null, "F.R.Chapm.", null)); assertTrue(comp.compareStrict("Chapm.", null, "A.W.Chapm.", null)); assertTrue(comp.compareStrict("Brugg.", null, "Brug.", null)); assertFalse(comp.compareStrict("A.Bruggen.", null, "Brug.", null)); assertTrue(comp.compareStrict("Brug.", null, "Pascal Bruggeman", null)); assertTrue(comp.compareStrict("Koch", null, "Johann Friedrich Wilhelm Koch", null)); assertTrue(comp.compareStrict("Koch", null, "J F W Koch", null)); assertFalse(comp.compareStrict("Koch.", null, "H Koch", null)); }
public boolean compareStrict(String author1, @Nullable String year1, String author2, @Nullable String year2) { Equality result = compareAuthorteam(author1, author2, minCommonSubstring, Integer.MAX_VALUE); if (result != Equality.EQUAL) { return false; } if (year1 == null && year2 == null) { return true; } return Equality.EQUAL == new YearComparator(year1, year2).compare(); }
AuthorComparator { public boolean compareStrict(String author1, @Nullable String year1, String author2, @Nullable String year2) { Equality result = compareAuthorteam(author1, author2, minCommonSubstring, Integer.MAX_VALUE); if (result != Equality.EQUAL) { return false; } if (year1 == null && year2 == null) { return true; } return Equality.EQUAL == new YearComparator(year1, year2).compare(); } }
AuthorComparator { public boolean compareStrict(String author1, @Nullable String year1, String author2, @Nullable String year2) { Equality result = compareAuthorteam(author1, author2, minCommonSubstring, Integer.MAX_VALUE); if (result != Equality.EQUAL) { return false; } if (year1 == null && year2 == null) { return true; } return Equality.EQUAL == new YearComparator(year1, year2).compare(); } private  AuthorComparator(Map<String, String> authors); }
AuthorComparator { public boolean compareStrict(String author1, @Nullable String year1, String author2, @Nullable String year2) { Equality result = compareAuthorteam(author1, author2, minCommonSubstring, Integer.MAX_VALUE); if (result != Equality.EQUAL) { return false; } if (year1 == null && year2 == null) { return true; } return Equality.EQUAL == new YearComparator(year1, year2).compare(); } private  AuthorComparator(Map<String, String> authors); static AuthorComparator createWithoutAuthormap(); static AuthorComparator createWithAuthormap(); static AuthorComparator createWithAuthormap(Map<String, String> authorMap); Equality compare(@Nullable String authors1, @Nullable String year1, @Nullable String authors2, @Nullable String year2); Equality compare(ParsedName n1, ParsedName n2); boolean compareStrict(String author1, @Nullable String year1, String author2, @Nullable String year2); }
AuthorComparator { public boolean compareStrict(String author1, @Nullable String year1, String author2, @Nullable String year2) { Equality result = compareAuthorteam(author1, author2, minCommonSubstring, Integer.MAX_VALUE); if (result != Equality.EQUAL) { return false; } if (year1 == null && year2 == null) { return true; } return Equality.EQUAL == new YearComparator(year1, year2).compare(); } private  AuthorComparator(Map<String, String> authors); static AuthorComparator createWithoutAuthormap(); static AuthorComparator createWithAuthormap(); static AuthorComparator createWithAuthormap(Map<String, String> authorMap); Equality compare(@Nullable String authors1, @Nullable String year1, @Nullable String authors2, @Nullable String year2); Equality compare(ParsedName n1, ParsedName n2); boolean compareStrict(String author1, @Nullable String year1, String author2, @Nullable String year2);  }