@Test public void testInterpretGenus() throws Exception { ParsedName pn = new ParsedName(); pn.setGenusOrAbove("P."); pn.setSpecificEpithet("concolor"); NubMatchingServiceImpl.interpretGenus(pn, "Puma"); assertEquals("Puma concolor", pn.canonicalName()); pn.setGenusOrAbove("P."); NubMatchingServiceImpl.interpretGenus(pn, "Felis"); assertEquals("P. concolor", pn.canonicalName()); }
@VisibleForTesting protected static void interpretGenus(ParsedName pn, String genus) { if (pn != null && !Strings.isNullOrEmpty(genus) && pn.getGenusOrAbove() != null && genus.length() > 1) { if (pn.getGenusOrAbove().length() == 2 && pn.getGenusOrAbove().charAt(1) == '.' && pn.getGenusOrAbove().charAt(0) == genus.charAt(0) || pn.getGenusOrAbove().length() == 1 && pn.getGenusOrAbove().charAt(0) == genus.charAt(0)) { pn.setGenusOrAbove(genus); } } }
NubMatchingServiceImpl implements NameUsageMatchingService, NameUsageMatchingService2 { @VisibleForTesting protected static void interpretGenus(ParsedName pn, String genus) { if (pn != null && !Strings.isNullOrEmpty(genus) && pn.getGenusOrAbove() != null && genus.length() > 1) { if (pn.getGenusOrAbove().length() == 2 && pn.getGenusOrAbove().charAt(1) == '.' && pn.getGenusOrAbove().charAt(0) == genus.charAt(0) || pn.getGenusOrAbove().length() == 1 && pn.getGenusOrAbove().charAt(0) == genus.charAt(0)) { pn.setGenusOrAbove(genus); } } } }
NubMatchingServiceImpl implements NameUsageMatchingService, NameUsageMatchingService2 { @VisibleForTesting protected static void interpretGenus(ParsedName pn, String genus) { if (pn != null && !Strings.isNullOrEmpty(genus) && pn.getGenusOrAbove() != null && genus.length() > 1) { if (pn.getGenusOrAbove().length() == 2 && pn.getGenusOrAbove().charAt(1) == '.' && pn.getGenusOrAbove().charAt(0) == genus.charAt(0) || pn.getGenusOrAbove().length() == 1 && pn.getGenusOrAbove().charAt(0) == genus.charAt(0)) { pn.setGenusOrAbove(genus); } } } @Inject  NubMatchingServiceImpl(NubIndex nubIndex, HigherTaxaComparator htComp, NameParser parser); }
NubMatchingServiceImpl implements NameUsageMatchingService, NameUsageMatchingService2 { @VisibleForTesting protected static void interpretGenus(ParsedName pn, String genus) { if (pn != null && !Strings.isNullOrEmpty(genus) && pn.getGenusOrAbove() != null && genus.length() > 1) { if (pn.getGenusOrAbove().length() == 2 && pn.getGenusOrAbove().charAt(1) == '.' && pn.getGenusOrAbove().charAt(0) == genus.charAt(0) || pn.getGenusOrAbove().length() == 1 && pn.getGenusOrAbove().charAt(0) == genus.charAt(0)) { pn.setGenusOrAbove(genus); } } } @Inject  NubMatchingServiceImpl(NubIndex nubIndex, HigherTaxaComparator htComp, NameParser parser); NameUsageMatch2 v2(NameUsageMatch m); @Override NameUsageMatch match(String scientificName, @Nullable Rank rank, @Nullable LinneanClassification classification, boolean strict, boolean verbose); }
NubMatchingServiceImpl implements NameUsageMatchingService, NameUsageMatchingService2 { @VisibleForTesting protected static void interpretGenus(ParsedName pn, String genus) { if (pn != null && !Strings.isNullOrEmpty(genus) && pn.getGenusOrAbove() != null && genus.length() > 1) { if (pn.getGenusOrAbove().length() == 2 && pn.getGenusOrAbove().charAt(1) == '.' && pn.getGenusOrAbove().charAt(0) == genus.charAt(0) || pn.getGenusOrAbove().length() == 1 && pn.getGenusOrAbove().charAt(0) == genus.charAt(0)) { pn.setGenusOrAbove(genus); } } } @Inject  NubMatchingServiceImpl(NubIndex nubIndex, HigherTaxaComparator htComp, NameParser parser); NameUsageMatch2 v2(NameUsageMatch m); @Override NameUsageMatch match(String scientificName, @Nullable Rank rank, @Nullable LinneanClassification classification, boolean strict, boolean verbose); static final Map<TaxonomicStatus, Integer> STATUS_SCORE; }