@Test public void testGetCountByRank() throws Exception { NormalizerStats stats = new NormalizerStats(1, 2, 12, 1, ImmutableMap.of(Origin.DENORMED_CLASSIFICATION, 2, Origin.IMPLICIT_NAME, 10, Origin.SOURCE, 50), ImmutableMap.of(Rank.KINGDOM, 2, Rank.GENUS, 10, Rank.SPECIES, 50), Lists.<String>newArrayList()); assertEquals(62, stats.getCount()); assertEquals(12, stats.getSynonyms()); assertEquals(2, stats.getDepth()); assertEquals(1, stats.getRoots()); assertEquals(1, stats.getIgnored()); assertEquals(50, stats.getCountByOrigin(Origin.SOURCE)); assertEquals(2, stats.getCountByOrigin(Origin.DENORMED_CLASSIFICATION)); assertEquals(10, stats.getCountByOrigin(Origin.IMPLICIT_NAME)); assertEquals(50, stats.getCountByRank(Rank.SPECIES)); assertEquals(10, stats.getCountByRank(Rank.GENUS)); assertEquals(2, stats.getCountByRank(Rank.KINGDOM)); assertEquals(0, stats.getCountByRank(Rank.FAMILY)); }
public int getCountByRank(Rank rank) { if (countByRank.containsKey(rank)) { return countByRank.get(rank); } return 0; }
NormalizerStats { public int getCountByRank(Rank rank) { if (countByRank.containsKey(rank)) { return countByRank.get(rank); } return 0; } }
NormalizerStats { public int getCountByRank(Rank rank) { if (countByRank.containsKey(rank)) { return countByRank.get(rank); } return 0; } @JsonCreator  NormalizerStats(@JsonProperty("roots") int roots, @JsonProperty("depth") int depth,
                         @JsonProperty("synonyms") int synonyms, @JsonProperty("ignored") int ignored,
                         @JsonProperty("countByOrigin") Map<Origin, Integer> countByOrigin,
                         @JsonProperty("countByRank") Map<Rank, Integer> countByRank, @JsonProperty("cycles") List<String> cycles); }
NormalizerStats { public int getCountByRank(Rank rank) { if (countByRank.containsKey(rank)) { return countByRank.get(rank); } return 0; } @JsonCreator  NormalizerStats(@JsonProperty("roots") int roots, @JsonProperty("depth") int depth,
                         @JsonProperty("synonyms") int synonyms, @JsonProperty("ignored") int ignored,
                         @JsonProperty("countByOrigin") Map<Origin, Integer> countByOrigin,
                         @JsonProperty("countByRank") Map<Rank, Integer> countByRank, @JsonProperty("cycles") List<String> cycles); List<String> getCycles(); int getCount(); int getRoots(); int getDepth(); int getSynonyms(); int getIgnored(); int getCountByRank(Rank rank); int getCountByOrigin(Origin o); Map<Origin, Integer> getCountByOrigin(); Map<Rank, Integer> getCountByRank(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); }
NormalizerStats { public int getCountByRank(Rank rank) { if (countByRank.containsKey(rank)) { return countByRank.get(rank); } return 0; } @JsonCreator  NormalizerStats(@JsonProperty("roots") int roots, @JsonProperty("depth") int depth,
                         @JsonProperty("synonyms") int synonyms, @JsonProperty("ignored") int ignored,
                         @JsonProperty("countByOrigin") Map<Origin, Integer> countByOrigin,
                         @JsonProperty("countByRank") Map<Rank, Integer> countByRank, @JsonProperty("cycles") List<String> cycles); List<String> getCycles(); int getCount(); int getRoots(); int getDepth(); int getSynonyms(); int getIgnored(); int getCountByRank(Rank rank); int getCountByOrigin(Origin o); Map<Origin, Integer> getCountByOrigin(); Map<Rank, Integer> getCountByRank(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }