Search in sources :

Example 1 with Mode

use of org.apache.datasketches.tuple.adouble.DoubleSummary.Mode in project sketches-core by DataSketches.

the class MiscTest method checkUpdatableSketchBuilderReset.

@Test
public void checkUpdatableSketchBuilderReset() {
    final DoubleSummary.Mode mode = Mode.Sum;
    final UpdatableSketchBuilder<Double, DoubleSummary> bldr = new UpdatableSketchBuilder<>(new DoubleSummaryFactory(mode));
    bldr.reset();
    final UpdatableSketch<Double, DoubleSummary> sk = bldr.build();
    assertTrue(sk.isEmpty());
}
Also used : Mode(org.apache.datasketches.tuple.adouble.DoubleSummary.Mode) DoubleSummary(org.apache.datasketches.tuple.adouble.DoubleSummary) DoubleSummaryFactory(org.apache.datasketches.tuple.adouble.DoubleSummaryFactory) Test(org.testng.annotations.Test)

Example 2 with Mode

use of org.apache.datasketches.tuple.adouble.DoubleSummary.Mode in project sketches-core by DataSketches.

the class MiscTest method checkCopyCtor.

@Test
public void checkCopyCtor() {
    final DoubleSummary.Mode mode = Mode.Sum;
    final UpdatableSketchBuilder<Double, DoubleSummary> bldr = new UpdatableSketchBuilder<>(new DoubleSummaryFactory(mode));
    bldr.reset();
    final UpdatableSketch<Double, DoubleSummary> sk = bldr.build();
    sk.update(1.0, 1.0);
    assertEquals(sk.getRetainedEntries(), 1);
    final UpdatableSketch<Double, DoubleSummary> sk2 = sk.copy();
    assertEquals(sk2.getRetainedEntries(), 1);
}
Also used : Mode(org.apache.datasketches.tuple.adouble.DoubleSummary.Mode) DoubleSummary(org.apache.datasketches.tuple.adouble.DoubleSummary) DoubleSummaryFactory(org.apache.datasketches.tuple.adouble.DoubleSummaryFactory) Test(org.testng.annotations.Test)

Aggregations

DoubleSummary (org.apache.datasketches.tuple.adouble.DoubleSummary)2 Mode (org.apache.datasketches.tuple.adouble.DoubleSummary.Mode)2 DoubleSummaryFactory (org.apache.datasketches.tuple.adouble.DoubleSummaryFactory)2 Test (org.testng.annotations.Test)2