@Test public void testGroupWithDifferentInitials() throws Exception { List<ParsedName> names = names( "Negundo aceroides subsp. violaceum (Booth ex G.Kirchn.) Holub", "Negundo aceroides subsp. violaceum (Booth ex Kirchn.) Holub", "Negundo aceroides var. violaceum G.Kirchn. in Petzold & G.Kirchn.", "Acer violaceum (T.Kirchn.) Simonkai", "Acer negundo var. violaceum (G. Kirchn.) H. Jaeger" ); Collection<BasionymGroup<ParsedName>> groups = sorter.groupBasionyms(names); assertEquals(3, groups.size()); for (BasionymGroup<ParsedName> g : groups) { assertFalse(g.getRecombinations().isEmpty()); switch (g.getRecombinations().get(0).getBracketAuthorship()) { case "Booth ex G.Kirchn.": assertEquals(2, g.getRecombinations().size()); assertNotNull(g.getBasionym()); break; case "T.Kirchn.": assertEquals(1, g.getRecombinations().size()); assertNull(g.getBasionym()); break; case "Booth ex Kirchn.": assertEquals(1, g.getRecombinations().size()); assertNull(g.getBasionym()); break; default: fail("Unknown basionym group " + g.getRecombinations().get(0)); } } }
public Collection<BasionymGroup<ParsedName>> groupBasionyms(Iterable<ParsedName> names) { return groupBasionyms(names, Functions.<ParsedName>identity()); }
BasionymSorter { public Collection<BasionymGroup<ParsedName>> groupBasionyms(Iterable<ParsedName> names) { return groupBasionyms(names, Functions.<ParsedName>identity()); } }
BasionymSorter { public Collection<BasionymGroup<ParsedName>> groupBasionyms(Iterable<ParsedName> names) { return groupBasionyms(names, Functions.<ParsedName>identity()); } BasionymSorter();  BasionymSorter(AuthorComparator authorComp); }
BasionymSorter { public Collection<BasionymGroup<ParsedName>> groupBasionyms(Iterable<ParsedName> names) { return groupBasionyms(names, Functions.<ParsedName>identity()); } BasionymSorter();  BasionymSorter(AuthorComparator authorComp); Collection<BasionymGroup<ParsedName>> groupBasionyms(Iterable<ParsedName> names); Collection<BasionymGroup<T>> groupBasionyms(Iterable<T> names, Function<T, ParsedName> func); }
BasionymSorter { public Collection<BasionymGroup<ParsedName>> groupBasionyms(Iterable<ParsedName> names) { return groupBasionyms(names, Functions.<ParsedName>identity()); } BasionymSorter();  BasionymSorter(AuthorComparator authorComp); Collection<BasionymGroup<ParsedName>> groupBasionyms(Iterable<ParsedName> names); Collection<BasionymGroup<T>> groupBasionyms(Iterable<T> names, Function<T, ParsedName> func);  }