@Test public void testCompare() throws Exception { assertAuth("Debreczy & I. Rácz", null, Equality.EQUAL, "Rácz", null); assertAuth("DC. ex Lam. et DC.", null, Equality.EQUAL, "DC.", null); assertAuth(null, null, Equality.UNKNOWN, null, null); assertAuth("", " ", Equality.UNKNOWN, " ", " "); assertAuth("L.", null, Equality.UNKNOWN, null, null); assertAuth("Bluff & Fingerh.", null, Equality.DIFFERENT, "Lindl.", null); assertAuth("Lindl.", null, Equality.EQUAL, "Lindl.", null); assertAuth(null, "1978", Equality.DIFFERENT, null, "1934"); assertAuth(null, "1978", Equality.EQUAL, null, "1978"); assertAuth("H. Christ", null, Equality.DIFFERENT, "C. Chr.", null); assertAuth("Reichenbach", "1837", Equality.EQUAL, "Abasicarpon Andrz. ex Rchb.", null); assertAuth("Torr et Gray", null, Equality.EQUAL, "Torr. & A.Gray", null); assertAuth("A.Murr", "1863", Equality.EQUAL, "A.Murray bis.", null); assertAuth("Maxim.", null, Equality.EQUAL, "Max.", null); assertAuth("A.Murr", "1863", Equality.EQUAL, "A. Murray", null); assertAuth("A.Murr", "1863", Equality.EQUAL, "A.Murray bis.", null); assertAuth("A.Murr", "1863", Equality.EQUAL, "A. Murr.", null); assertAuth("A.Murr", "1863", Equality.DIFFERENT, "B. Murr.", null); assertAuth("Debreczy & I. Rácz", null, Equality.EQUAL, "Rácz", null); assertAuth("Debreczy & I. Rácz", null, Equality.EQUAL, "Debreczy", null); assertAuth("White, Herbert & Harvey", null, Equality.EQUAL, "A.J. White, Herbert et P.J. Harvey", null); assertAuth("A.J.White", null, Equality.EQUAL, "A.J. White, Herbert et P.J. Harvey", null); assertAuth("Harvey", null, Equality.EQUAL, "A.J. White, Herbert et P.J. Harvey", null); assertAuth("R.H.Roberts", null, Equality.DIFFERENT, "R.J.Roberts", null); assertAuth("V.J.Chapm.", null, Equality.DIFFERENT, "F.R.Chapm.", null); assertAuth("V.J.Chapm.", null, Equality.DIFFERENT, "F.Chapm.", null); assertAuth("Chapm.", null, Equality.EQUAL, "F.R.Chapm.", null); assertAuth("Chapm.", null, Equality.EQUAL, "A.W.Chapm.", null); assertAuth("Brot. ex Willk. & Lange", null, Equality.DIFFERENT, "L.", null); assertAuth("Brugg.", null, Equality.EQUAL, "Brug.", null); assertAuth("A.Bruggen.", null, Equality.EQUAL, "Brug.", null); assertAuth("Brug.", null, Equality.EQUAL, "Pascal Bruggeman", null); assertAuth("Presl ex DC.", null, Equality.EQUAL, "C. Presl ex de Candolle", null); assertAuth("G. Don f.", null, Equality.EQUAL, "G. Don fil.", null); assertAuth("Don f.", null, Equality.EQUAL, "Don fil.", null); assertAuth("F.K. Schimp. et Spenn.", null, Equality.EQUAL, "K.F. Schimp. et Spenn.", null); assertAuth("J.A. Weinm.", null, Equality.EQUAL, "Weinm.", null); assertAuth("DC. ex Lam. et DC.", null, Equality.EQUAL, "DC.", null); assertAuth("Koch", null, Equality.EQUAL, "Johann Friedrich Wilhelm Koch", null); assertAuth("Koch", null, Equality.EQUAL, "J F W Koch", null); assertAuth("Koch", null, Equality.EQUAL, "H Koch", null); assertAuth("L.f", null, Equality.EQUAL, "Linnaeus filius", null); assertAuth("L. f", null, Equality.EQUAL, "Linnaeus filius", null); assertAuth("L.fil.", null, Equality.EQUAL, "Linnaeus filius", null); assertAuth("Schultz-Bip", null, Equality.EQUAL, "Sch.Bip.", null); assertAuth("Bruand", "1850", Equality.EQUAL, "Bruand", "1851"); assertAuth("Bruand", "1850", Equality.DIFFERENT, null, "1998"); assertAuth("Bruand", "1850", Equality.EQUAL, null, "1850"); assertAuth("Bruand", "1850", Equality.EQUAL, null, "1851"); assertAuth("L. f.", null, Equality.EQUAL, "L.", null); assertAuth("L.", null, Equality.EQUAL, "L.fil.", null); assertAuth("L. Bolus", null, Equality.EQUAL, "L. Bol.", null); }
public Equality compare(@Nullable String authors1, @Nullable String year1, @Nullable String authors2, @Nullable String year2) { Equality result = compareAuthorteam(authors1, authors2, minCommonSubstring, MIN_AUTHOR_LENGTH_WITHOUT_LOOKUP); if (result != Equality.EQUAL) { Equality yresult = new YearComparator(year1, year2).compare(); if (yresult != Equality.UNKNOWN) { result = yresult; } } return result; }
AuthorComparator { public Equality compare(@Nullable String authors1, @Nullable String year1, @Nullable String authors2, @Nullable String year2) { Equality result = compareAuthorteam(authors1, authors2, minCommonSubstring, MIN_AUTHOR_LENGTH_WITHOUT_LOOKUP); if (result != Equality.EQUAL) { Equality yresult = new YearComparator(year1, year2).compare(); if (yresult != Equality.UNKNOWN) { result = yresult; } } return result; } }
AuthorComparator { public Equality compare(@Nullable String authors1, @Nullable String year1, @Nullable String authors2, @Nullable String year2) { Equality result = compareAuthorteam(authors1, authors2, minCommonSubstring, MIN_AUTHOR_LENGTH_WITHOUT_LOOKUP); if (result != Equality.EQUAL) { Equality yresult = new YearComparator(year1, year2).compare(); if (yresult != Equality.UNKNOWN) { result = yresult; } } return result; } private  AuthorComparator(Map<String, String> authors); }
AuthorComparator { public Equality compare(@Nullable String authors1, @Nullable String year1, @Nullable String authors2, @Nullable String year2) { Equality result = compareAuthorteam(authors1, authors2, minCommonSubstring, MIN_AUTHOR_LENGTH_WITHOUT_LOOKUP); if (result != Equality.EQUAL) { Equality yresult = new YearComparator(year1, year2).compare(); if (yresult != Equality.UNKNOWN) { result = yresult; } } return result; } 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 Equality compare(@Nullable String authors1, @Nullable String year1, @Nullable String authors2, @Nullable String year2) { Equality result = compareAuthorteam(authors1, authors2, minCommonSubstring, MIN_AUTHOR_LENGTH_WITHOUT_LOOKUP); if (result != Equality.EQUAL) { Equality yresult = new YearComparator(year1, year2).compare(); if (yresult != Equality.UNKNOWN) { result = yresult; } } return result; } 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);  }