private ValueDistributionAnalyzerResult reduceSingleResults( final Collection<? extends ValueDistributionAnalyzerResult> analyzerResults) { final Map<String, Integer> reducedValueCounts = new HashMap<>(); Integer nullCount = 0; final ValueDistributionAnalyzerResult first = analyzerResults.iterator().next(); for (final ValueDistributionAnalyzerResult partialResult : analyzerResults) { if ((partialResult instanceof SingleValueDistributionResult) || (partialResult instanceof ReducedSingleValueDistributionResult)) { nullCount = reduceValueCounts(reducedValueCounts, nullCount, partialResult); } else { throw new IllegalStateException( "Unsupported type of " + ValueDistributionAnalyzerResult.class.getSimpleName() + ": " + partialResult.getClass().getSimpleName()); } } return new ReducedSingleValueDistributionResult(first.getName(), reducedValueCounts, nullCount); }
public ValueCountList getTopValues() { final ValueCountListImpl valueCountList = ValueCountListImpl.createTopList(2); for (final ValueFrequency valueFrequency : getValueCounts()) { valueCountList.register(valueFrequency); } return valueCountList; }