test_class.file: proxy/src/test/java/com/wavefront/agent/histogram/HistogramRecompressorTest.java
test_class.identifier: HistogramRecompressorTest
test_case.body: @Test
    public void testHistogramRecompressor() {
      HistogramRecompressor recompressor = new HistogramRecompressor(() -> (short) 32);
      Histogram testHistogram = Histogram.newBuilder().
          setType(HistogramType.TDIGEST).
          setDuration(60000).
          setBins(ImmutableList.of(1.0, 2.0, 3.0)).
          setCounts(ImmutableList.of(3, 2, 1)).
          build();
      Histogram outputHistoram = recompressor.apply(testHistogram);
      // nothing to compress
      assertEquals(outputHistoram, testHistogram);
  
      testHistogram.setBins(ImmutableList.of(1.0, 1.0, 1.0, 2.0, 3.0, 3.0, 3.0));
      testHistogram.setCounts(ImmutableList.of(3, 1, 2, 2, 1, 2, 3));
      outputHistoram = recompressor.apply(testHistogram);
      // compacted histogram
      assertEquals(ImmutableList.of(1.0, 2.0, 3.0), outputHistoram.getBins());
      assertEquals(ImmutableList.of(6, 2, 6), outputHistoram.getCounts());
  
      List<Double> bins = new ArrayList<>();
      List<Integer> counts = new ArrayList<>();
      for (int i = 0; i < 1000; i++) {
        bins.add((double)i);
        counts.add(1);
      }
      testHistogram.setBins(bins);
      testHistogram.setCounts(counts);
      outputHistoram = recompressor.apply(testHistogram);
      assertTrue(outputHistoram.getBins().size() < 48);
      assertEquals(1000, outputHistoram.getCounts().stream().mapToInt(x -> x).sum());
  
      testHistogram.setBins(bins.subList(0, 65));
      testHistogram.setCounts(counts.subList(0, 65));
      outputHistoram = recompressor.apply(testHistogram);
      assertTrue(outputHistoram.getBins().size() < 48);
      assertEquals(65, outputHistoram.getCounts().stream().mapToInt(x -> x).sum());
  
      testHistogram.setBins(bins.subList(0, 64));
      testHistogram.setCounts(counts.subList(0, 64));
      outputHistoram = recompressor.apply(testHistogram);
      assertEquals(64, outputHistoram.getBins().size());
      assertEquals(64, outputHistoram.getCounts().stream().mapToInt(x -> x).sum());
    }
test_case.class_method_signature: HistogramRecompressorTest.testHistogramRecompressor()
test_case.full_signature: @Test public void testHistogramRecompressor()
test_case.identifier: testHistogramRecompressor
test_case.invocations: build setCounts setBins setDuration setType newBuilder of of apply assertEquals setBins of setCounts of apply assertEquals of getBins assertEquals of getCounts add add setBins setCounts apply assertTrue size getBins assertEquals sum mapToInt stream getCounts setBins subList setCounts subList apply assertTrue size getBins assertEquals sum mapToInt stream getCounts setBins subList setCounts subList apply assertEquals size getBins assertEquals sum mapToInt stream getCounts
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testHistogramRecompressor()
focal_class.declarator: storageAccuracySupplier
focal_class.modifier: private final
focal_class.original_string: private final Supplier<Short> storageAccuracySupplier;
focal_class.type: Supplier<Short>
focal_class.var_name: storageAccuracySupplier
focal_class.declarator: histogramsCompacted = Utils.lazySupplier(() ->
        Metrics.newCounter(new TaggedMetricName("histogram", "histograms_compacted")))
focal_class.modifier: private final
focal_class.original_string: private final Supplier<Counter> histogramsCompacted = Utils.lazySupplier(() ->
        Metrics.newCounter(new TaggedMetricName("histogram", "histograms_compacted")));
focal_class.type: Supplier<Counter>
focal_class.var_name: histogramsCompacted
focal_class.declarator: histogramsRecompressed = Utils.lazySupplier(() ->
        Metrics.newCounter(new TaggedMetricName("histogram", "histograms_recompressed")))
focal_class.modifier: private final
focal_class.original_string: private final Supplier<Counter> histogramsRecompressed = Utils.lazySupplier(() ->
        Metrics.newCounter(new TaggedMetricName("histogram", "histograms_recompressed")));
focal_class.type: Supplier<Counter>
focal_class.var_name: histogramsRecompressed
focal_class.file: proxy/src/main/java/com/wavefront/agent/histogram/HistogramRecompressor.java
focal_class.identifier: HistogramRecompressor
focal_class.interfaces: implements Function<Histogram, Histogram>
focal_class.class_method_signature: HistogramRecompressor.HistogramRecompressor(Supplier<Short> storageAccuracySupplier)
focal_class.full_signature: public  HistogramRecompressor(Supplier<Short> storageAccuracySupplier)
focal_class.identifier: HistogramRecompressor
focal_class.modifiers: public
focal_class.parameters: (Supplier<Short> storageAccuracySupplier)
focal_class.signature:  HistogramRecompressor(Supplier<Short> storageAccuracySupplier)
focal_class.class_method_signature: HistogramRecompressor.apply(Histogram input)
focal_class.full_signature: @Override public Histogram apply(Histogram input)
focal_class.identifier: apply
focal_class.modifiers: @Override public
focal_class.parameters: (Histogram input)
focal_class.return: Histogram
focal_class.signature: Histogram apply(Histogram input)
focal_class.class_method_signature: HistogramRecompressor.hasDuplicateCentroids(wavefront.report.Histogram histogram)
focal_class.full_signature: @VisibleForTesting static boolean hasDuplicateCentroids(wavefront.report.Histogram histogram)
focal_class.identifier: hasDuplicateCentroids
focal_class.modifiers: @VisibleForTesting static
focal_class.parameters: (wavefront.report.Histogram histogram)
focal_class.return: boolean
focal_class.signature: boolean hasDuplicateCentroids(wavefront.report.Histogram histogram)
focal_class.class_method_signature: HistogramRecompressor.compactCentroids(wavefront.report.Histogram histogram)
focal_class.full_signature: @VisibleForTesting static wavefront.report.Histogram compactCentroids(wavefront.report.Histogram histogram)
focal_class.identifier: compactCentroids
focal_class.modifiers: @VisibleForTesting static
focal_class.parameters: (wavefront.report.Histogram histogram)
focal_class.return: wavefront.report.Histogram
focal_class.signature: wavefront.report.Histogram compactCentroids(wavefront.report.Histogram histogram)
focal_method.body: public HistogramRecompressor(Supplier<Short> storageAccuracySupplier) {
      this.storageAccuracySupplier = storageAccuracySupplier;
    }
focal_method.class_method_signature: HistogramRecompressor.HistogramRecompressor(Supplier<Short> storageAccuracySupplier)
focal_method.full_signature: public  HistogramRecompressor(Supplier<Short> storageAccuracySupplier)
focal_method.identifier: HistogramRecompressor
focal_method.modifiers: public
focal_method.parameters: (Supplier<Short> storageAccuracySupplier)
focal_method.signature:  HistogramRecompressor(Supplier<Short> storageAccuracySupplier)