@Test public void testIncludesNamesFromSynonym() { Taxon synonym = new Taxon(); VernacularName n1 = new VernacularName(); n1.setVernacularName("Nut Sedge"); n1.setLanguage(new Locale("en")); n1.setTaxon(synonym); synonym.setVernacularNames(of(n1)); taxon.setSynonymNameUsages(of(synonym)); names = new VernacularNames(taxon); assertEquals("Nut Sedge", names.getSortedByLanguage().get("English").first()); assertEquals("Sedge", names.getSortedByLanguage().get("English").last()); assertEquals("швар", names.getSortedByLanguage().get("Ukrainian").first()); assertEquals("starrslekta", names.getSortedByLanguage().get("Unknown").first()); assertEquals("starrslekta2", names.getSortedByLanguage().get("Unknown").last()); }
public SortedMap<String, SortedSet<String>> getSortedByLanguage() { if (sorted == null) { sorted = new SortedCache(); for (VernacularName name : names) { if (name.getLanguage() == null || name.getLanguage().equals(Locale.ROOT)) { sorted.put("Unknown", name.getVernacularName()); } else { sorted.put(name.getLanguage().getDisplayName(), name.getVernacularName()); } } } return sorted.map; }
VernacularNames { public SortedMap<String, SortedSet<String>> getSortedByLanguage() { if (sorted == null) { sorted = new SortedCache(); for (VernacularName name : names) { if (name.getLanguage() == null || name.getLanguage().equals(Locale.ROOT)) { sorted.put("Unknown", name.getVernacularName()); } else { sorted.put(name.getLanguage().getDisplayName(), name.getVernacularName()); } } } return sorted.map; } }
VernacularNames { public SortedMap<String, SortedSet<String>> getSortedByLanguage() { if (sorted == null) { sorted = new SortedCache(); for (VernacularName name : names) { if (name.getLanguage() == null || name.getLanguage().equals(Locale.ROOT)) { sorted.put("Unknown", name.getVernacularName()); } else { sorted.put(name.getLanguage().getDisplayName(), name.getVernacularName()); } } } return sorted.map; } VernacularNames(Taxon taxon); }
VernacularNames { public SortedMap<String, SortedSet<String>> getSortedByLanguage() { if (sorted == null) { sorted = new SortedCache(); for (VernacularName name : names) { if (name.getLanguage() == null || name.getLanguage().equals(Locale.ROOT)) { sorted.put("Unknown", name.getVernacularName()); } else { sorted.put(name.getLanguage().getDisplayName(), name.getVernacularName()); } } } return sorted.map; } VernacularNames(Taxon taxon); Set<VernacularName> getNames(); Set<Taxon> getSynonymsIncluded(); SortedMap<String, SortedSet<String>> getSortedByLanguage(); Set<Organisation> getSources(); }
VernacularNames { public SortedMap<String, SortedSet<String>> getSortedByLanguage() { if (sorted == null) { sorted = new SortedCache(); for (VernacularName name : names) { if (name.getLanguage() == null || name.getLanguage().equals(Locale.ROOT)) { sorted.put("Unknown", name.getVernacularName()); } else { sorted.put(name.getLanguage().getDisplayName(), name.getVernacularName()); } } } return sorted.map; } VernacularNames(Taxon taxon); Set<VernacularName> getNames(); Set<Taxon> getSynonymsIncluded(); SortedMap<String, SortedSet<String>> getSortedByLanguage(); Set<Organisation> getSources();  }